2
0
Эх сурвалжийг харах

2009-06-03 Atsushi Enomoto <[email protected]>

        * HttpRequestChannel.cs : that SL2/ML2 does not seem to allow
          null callbacks, so add hacky ones.


svn path=/trunk/mcs/; revision=135285
Atsushi Eno 16 жил өмнө
parent
commit
af95841abe

+ 5 - 0
mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog

@@ -1,3 +1,8 @@
+2009-06-03  Atsushi Enomoto  <[email protected]>
+
+	* HttpRequestChannel.cs : that SL2/ML2 does not seem to allow null
+	  callbacks, so add hacky ones.
+
 2009-06-01  Atsushi Enomoto  <[email protected]>
 
 	* TcpDuplexSessionChannel.cs : WaitForMessage() should not return

+ 10 - 2
mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs

@@ -136,7 +136,11 @@ namespace System.ServiceModel.Channels
 					throw new InvalidOperationException (String.Format ("Cross domain web service access to {0} is not allowed", destination));
 #endif
 
-				Stream requestStream = web_request.EndGetRequestStream (web_request.BeginGetRequestStream (null, null));
+				object state = new object ();
+				Stream requestStream = web_request.EndGetRequestStream (web_request.BeginGetRequestStream (delegate (IAsyncResult result) {
+					if (result.AsyncState != state)
+						throw new InvalidOperationException ("The argument async result has wrong state");
+					}, state));
 				requestStream.Write (buffer.GetBuffer (), 0, (int) buffer.Length);
 				requestStream.Close ();
 			}
@@ -144,7 +148,11 @@ namespace System.ServiceModel.Channels
 			WebResponse res;
 			Stream resstr;
 			try {
-				res = web_request.EndGetResponse (web_request.BeginGetResponse (null, null));
+				object state = new object ();
+				res = web_request.EndGetResponse (web_request.BeginGetResponse (delegate (IAsyncResult result) {
+					if (result.AsyncState != state)
+						throw new InvalidOperationException ("The argument async result has wrong state");
+					}, state));
 				resstr = res.GetResponseStream ();
 			} catch (WebException we) {
 				res = we.Response;