Search code examples
iosmonoxamarin.iossystem.netsystem.net.sockets

nullreference of system.net.sockets on monotouch


I have three versions of the same application: iPhone, Mono Console, Windows Console application. All of them contain exactly the same code (via MonoTouch C#). On the Mono(Touch) framework I get the following exception from the Assembly Browser: (Windows works perfectly)

System.NullReferenceException: Object reference not set to an instance of an object
  at System.Net.Sockets.Socket+SocketAsyncResult.Complete () [0x00000] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System/System.Net.Sockets/Socket_2_1.cs:240
  at System.Net.Sockets.Socket+SocketAsyncResult.Complete (System.Exception e) [0x00007] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System/System.Net.Sockets/Socket_2_1.cs:304
  at System.Net.Sockets.Socket+Worker.Accept () [0x00077] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System/System.Net.Sockets/Socket_2_1.cs:510
  at System.Net.Sockets.Socket+Worker.DispatcherCB (System.Net.Sockets.SocketAsyncResult sar) [0x0009e] in /private/tmp/monobuild/build/BUILD/mono-2.10.9/mcs/class/System/System.Net.Sockets/Socket_2_1.cs:432

Are there any known problems using System.Net.Sockets on MonoTouch? Does anyone know what this exception means (besides the obvious NullReference)? I'm very new to this area. Hopefully someone can point me in the right direction.


Solution

  • This isn't a problem with MonoTouch, but with MonoDevelop.

    I suggest filing a bug here: http://bugzilla.xamarin.com so the appropriate people can look at it.

    This bug will not prevent you from using MonoTouch (just don't use the Assembly Browser for the assemblies that causes this, you can view the source code directly here instead: https://github.com/mono/mono/tree/mono-2-10).