Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
We're trying to add cross-platform network availability awareness.
It's simple with .Net -> subscribe to the standard NetworkAvailabilityChanged event.
In Mono, on OSX we immeadiately get an error.
Could you tell us the problem and when we might hope to get it fixed?
public class Test
void OnNetworkAddressChanged (object sender, EventArgs e)
void OnNetworkAvailabilityChanged (object sender, NetworkAvailabilityEventArgs e)
public void TestSetup()
NetworkChange.NetworkAvailabilityChanged += OnNetworkAvailabilityChanged;
NetworkChange.NetworkAddressChanged += OnNetworkAddressChanged;
public void TestCase ()
Assert.True (); //fails in setup - EntryPointNotFoundException in System.Net.NetworkInformation.NetworkChange:CreateNLSocket
public void TestDown()
NetworkChange.NetworkAvailabilityChanged -= OnNetworkAvailabilityChanged;
NetworkChange.NetworkAddressChanged -= OnNetworkAddressChanged;
/29/2013 16:17:43.507  ERROR AppDelegate.FinishedLaunching - Unexpected error: System.EntryPointNotFoundException: CreateNLSocket
at (wrapper managed-to-native) System.Net.NetworkInformation.NetworkChange:CreateNLSocket ()
at System.Net.NetworkInformation.NetworkChange.EnsureSocket () [0x00021] in /private/tmp/source/bockbuild/profiles/mono-mac-release/build-root/mono-3.0.6/_build/mono-3.0.6.git/mcs/class/System/System.Net.NetworkInformation/NetworkChange.cs:71
at System.Net.NetworkInformation.NetworkChange.Register (System.Net.NetworkInformation.NetworkAvailabilityChangedEventHandler d) [0x00000] in /private/tmp/source/bockbuild/profiles/mono-mac-release/build-root/mono-3.0.6/_build/mono-3.0.6.git/mcs/class/System/System.Net.NetworkInformation/NetworkChange.cs:165
at System.Net.NetworkInformation.NetworkChange.add_NetworkAvailabilityChanged (System.Net.NetworkInformation.NetworkAvailabilityChangedEventHandler value) [0x00000] in /private/tmp/source/bockbuild/profiles/mono-mac-release/build-root/mono-3.0.6/_build/mono-3.0.6.git/mcs/class/System/System.Net.NetworkInformation/NetworkChange.cs:60 (NetworkAvailabilityTest.Test.TestCase)
Are you linking the application? (Project Options->Mac OS X Packaging->[X] Include the Mono runtime in the application bundle->Linker Behavior: Link All)
I am not able to reproduce that exception in either linked or unlinked mode. Can you please derive a test sample that can be compiled without inferring your test harness or environment? Also, which version of Mono are you using? Would you paste the version information from the "Show Details" view in the "About Xamarin Studio" dialog?
Created attachment 3897 [details]
Running this test does not produce any exceptions.
The exception your are getting indicates that underlying code in the stack is missing entirely. Specifically CreateNLSocket is a native function that exists in the native library MonoPosixHelper , and is PInvoked by the NetworkChange class .
It's likely that MonoPosixHelper is not able to be found, and thus the native functions cannot be invoked. I'm not sure how you're using Mono, so it's hard to diagnose.
Can you set MONO_LOG_LEVEL=debug in your environment and paste the output?
Thanks a lot for your response!
Well I haven't done anything unusual - I simply install Mono by executing the dmg for 3.0.6 (I think I'm using the MRE installer).
I guess you aren't experiencing problems due to the internals NICs/Ethernet/Bluetooth configuration is different to mine.
I set the above statement in a terminal window and re-ran the test in Xamarin Studio (I'm not sure that's what you had in mind) - and the identical test output is produced.
I don't understand the 2 links at the bottom of your post... please give guidance as it seems this should be working out of the box....
So ... running the test under Mono 2.0.11 runs and green. If you run it under 3.0.6 it errors as above.
Is there a change in 3.0.6 at all for this? Is there a command I can issue?
Ok We've verified it's ok in 3.0.10 but now we have an issue - we cannot upgrade to 3.0.10 as there's an outstanding bug that prevents us building Mono on the Command Line.
This is a blocker. Will this be fixed soon ? Otherwise we're rather stuck...
As of right now Xamarin.Mac is not supported on 3.0.x. It will be soon, but I am not sure exactly when.
As a forewarning: earlier today I looked at the implementation of NetworkChange and saw that it is only actually supported under Linux. On other platforms the events will never be raised, so it is currently effectively useless. So unfortunately even though you ran into the exception on Mono 3.0.x, the API wouldn't have worked as advertised on the Mac.
I've done two things that will land in the future:
1. I've made the SCNetworkReachability API accessible in Xamarin.Mac. This is currently committed on our master branch and will be included in the next release of Xamarin.Mac. 
2. I've implemented System.Net.NetworkInformation.NetworkChange support for Mac OS X using SCNetworkReachability API. This is currently pending a land on the core mono branches. I will update this bug when it has landed. 
This means that going forward, you will be free to use either APIs (the BCL API or the OS X API). The OS X API is a little more expressive while the BCL API only exposes "a network is available".
When using both APIs, there is an underlying requirement that a CFMainLoop on the subscribing thread be running, as this is how availability messages are dispatched by the OS.
The patch for Mono itself has been merged into master.
That's a shame. I wish we knew yesterday....
... in the meantime is there any timescale for the next Xam/Mac release? We're rather reliant on it now.
Also this is the fourth or fifth issue where we've encountered a MONO API that is not implemented on OSX.
Is there a list - anywhere - of any further such issues? Otherwise it's impossible for us to plan our development tasks as we are repeatedly hit by runtime messages that result in us needing a subsequent Xam.Mac release.
Thanks again Aaron.
This tool should give you a good enough overview of what is available on Mono:
Sample test passes successfully