Open.NAT icon indicating copy to clipboard operation
Open.NAT copied to clipboard

Unhandled Object DisposedException (NetworkStream) on ARM

Open timothyparez opened this issue 7 years ago • 4 comments

On an x86/x64 machine with .NET or Mono the following code works:

var discoverer = new NatDiscoverer();

var device = await discoverer.DiscoverDeviceAsync(PortMapper.Upnp, 
                     new System.Threading.CancellationTokenSource());
var ip = await device.GetExternalIPAsync();

Console.WriteLine($"The external IP Address is: {ip}");

However, the same code on ARM with .Mono (tested 4.3 and 4.6) will output an error on:

var device = await discoverer.DiscoverDeviceAsync(PortMapper.Upnp, new System.Threading.CancellationTokenSource());

Got a bad hardware address length for an AF_PACKET 16 8

And throw an exception on:

var ip = await device.GetExternalIPAsync();

Unhandled Exception: System.ObjectDisposedException: Cannot access a disposed object. Object name: 'System.Net.Sockets.NetworkStream'. at System.Net.WebConnectionStream.EndWrite

This occurs on the RaspberryPI as well as other ARM devices such as the NanoPI.
Not sure whether the issue is caused by Open.NAT or Mono on ARM.

This was using the latest published NuGet package, I'll try to compile from source instead.

timothyparez avatar Oct 15 '16 15:10 timothyparez