3

I'm running Mono 2.10 and I've just upgrated to Monotouch 4.0.

An error occurred in my application:

System.NullReferenceException: Object reference not set to an instance of an object
  at System.ServiceModel.Dispatcher.BaseMessagesFormatter.DeserializeReply (System.ServiceModel.Channels.Message message, System.Object[] parameters) [0x000e3] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs:281 
  at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply (System.ServiceModel.Channels.Message message, System.Object[] parameters) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs:89 
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request (System.ServiceModel.Description.OperationDescription od, System.Object[] parameters) [0x001cb] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:552 
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.DoProcess (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters) [0x00038] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:482 
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Process (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:462

What's going on? Thank you.

P.S. With the previous version of MT (3.2.6), code was working perfectly.

UPDATE 1:

I've recompiled the application. Now the exception is the following:

System.Net.WebException: There was an error on processing web request: Status code 400(BadRequest): Bad Request
  at System.ServiceModel.Channels.HttpRequestChannel+HttpChannelRequestAsyncResult.WaitEnd () [0x0003b] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs:435 
  at System.ServiceModel.Channels.HttpRequestChannel.EndRequest (IAsyncResult result) [0x00029] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs:289 
  at System.ServiceModel.Channels.HttpRequestChannel.Request (System.ServiceModel.Channels.Message message, TimeSpan timeout) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs:63 
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:562 
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request (System.ServiceModel.Description.OperationDescription od, System.Object[] parameters) [0x00066] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:517

UPDATE 2:

I'm running mono version 2.10.5 and MT 4.0.6. I'm using WCF and try to call an external web service.

I use the following snippet of code to call the WS:

CustomBinding custom = new CustomBinding(new BinaryMessageEncodingBindingElement(),
    new HttpTransportBindingElement()
    {
       MaxReceivedMessageSize = 2147483647,
       MaxBufferSize = 2147483647
    }
);                  

EndpointAddress endpoint = new EndpointAddress(myUrl);
client = new MyServiceClient(custom, endpoint);

This exception is caught:

System.Net.WebException: There was an error on processing web request: Status code 400(BadRequest): Bad Request
  at System.ServiceModel.Channels.HttpRequestChannel+HttpChannelRequestAsyncResult.WaitEnd () [0x0003b] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs:435 
  at System.ServiceModel.Channels.HttpRequestChannel.EndRequest (IAsyncResult result) [0x00029] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs:289 
  at System.ServiceModel.Channels.HttpRequestChannel.Request (System.ServiceModel.Channels.Message message, TimeSpan timeout) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel.Channels/HttpRequestChannel.cs:63 
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request (System.ServiceModel.Channels.Message msg, TimeSpan timeout) [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:562 
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Request (System.ServiceModel.Description.OperationDescription od, System.Object[] parameters) [0x00066] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:517 
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.DoProcess (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters) [0x00038] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:482 
  at System.ServiceModel.MonoInternal.ClientRuntimeChannel.Process (System.Reflection.MethodBase method, System.String operationName, System.Object[] parameters) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs:462

If I use basicHttpBinding nothing happens. The message seems to be lost around the network.

client = new MyServiceClient(new BasicHttpBinding(BasicHttpSecurityMode.None), new EndpointAddress(myUrl + "/basic"));

The structure returned from the WS contains a list of MyClass elements. MyClass class has been tagged with [DataContract attribute] and members with [DataMember] attribute. If the service returns only strings, int or enums, the result is ok.

NOTE: Using mono version 2.10 and MT 3.2.6, the WS works in both situations.

Any suggestions? Thank you in advance.

Lorenzo B
  • 33,216
  • 24
  • 116
  • 190
  • Could you provide a test case for us to reproduce? – miguel.de.icaza Apr 07 '11 at 15:37
  • Thank you. Yesterday, I restored the previous version of MT. Now it seems to be ok. Now, when I open Monodevelop, there is an update for Mono Framework 2.10.1. Maybe, I have to do this update and then update to MT 4... – Lorenzo B Apr 08 '11 at 07:35
  • In the weekend I'll try to reproduce a test case. thank you again. – Lorenzo B Apr 08 '11 at 07:36
  • Some stuff was missing in MT 4.x (while present in 3.x). Can you tried the workaround from http://bugzilla.xamarin.com/show_bug.cgi?id=380 – poupou Aug 26 '11 at 13:54
  • Thank you for the suggestion, I've just tried the workaround but it doesn't work. Thanks again. – Lorenzo B Aug 26 '11 at 15:22
  • If the external web service is publicly available then I suggest you to fill a bug report, bugzilla.xamarin.com, and attach a small, self contained, test case to it. – poupou Aug 27 '11 at 15:03
  • 1
    Several WCF issues have been fixed in the upcoming MonoTouch 4.2. Please try it (once released) and, if unlucky, please fill a bug report :-) – poupou Sep 07 '11 at 20:59
  • @poupou Thank you for your suggestion. I've updated to 4.2 but the problem still remains. I'ill try to fill a bug report. Thank you again. I think the problem is the same as in this [post](http://stackoverflow.com/questions/5800643/latest-monotouch-4-0-problem-when-trying-to-access-a-wcf-service) – Lorenzo B Sep 28 '11 at 07:29

0 Answers0