Bug 13642 - NetworkChange always throws an exception
Summary: NetworkChange always throws an exception
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 6.4.0
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Aaron Bockover [MSFT]
Depends on:
Reported: 2013-07-31 05:01 UTC by Mark Daniel
Modified: 2013-10-10 12:58 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:

Description Mark Daniel 2013-07-31 05:01:08 UTC
The following line of code

NetworkChange.NetworkAddressChanged += new NetworkAddressChangedEventHandler(NetworkChange_NetworkAddressChanged);

Always throws an exception. The same is true on Mono for Android. It worked (or at least didn't throw an exception) before I updated to 4.8.0
Comment 1 Rolf Bjarne Kvinge [MSFT] 2013-07-31 19:25:21 UTC
This is the exception:

System.TypeInitializationException: An exception was thrown by the type initializer for System.Net.NetworkInformation.NetworkChange ---> System.Exception: mono_sc_reachability_enabled
  at at (wrapper managed-to-native) System.Net.NetworkInformation.MacNetworkChange:mono_sc_reachability_enabled ()
  at System.Net.NetworkInformation.MacNetworkChange.get_IsEnabled () [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net.NetworkInformation/NetworkChange.cs:66
  at System.Net.NetworkInformation.NetworkChange..cctor () [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net.NetworkInformation/NetworkChange.cs:46
  --- End of inner exception stack trace ---
  at crashlyticstest.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x00045] in /Users/rolf/Projects/instruments/AppDelegate.cs:73
  at at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
  at instruments.Application.Main (System.String[] args) [0x00001] in /Users/rolf/Projects/instruments/Main.cs:22

It looks like mono_sc_reachability_enabled wasn't found.

Aaron, can you have a look?
Comment 2 Jungmok Han 2013-08-07 14:51:16 UTC
We have the same issue.  It used to work before updating to the latest stable.  Is there any update on this one?
Comment 3 Aaron Bockover [MSFT] 2013-08-07 17:13:52 UTC
Hmm, I'm not seeing this on Mono 3.2.0. The following program on OS X always prints "Changed" one time and exits:


using System;
using System.Net.NetworkInformation;

static class Test
    static void Main ()
        NetworkChange.NetworkAddressChanged += (sender, e) => Console.WriteLine ("Changed");


Is this only on Android? mono_sc_reachability_enabled might be getting stripped out of native code?
Comment 4 Rolf Bjarne Kvinge [MSFT] 2013-08-07 18:00:26 UTC
Aaron, this is on iOS, not OSX.
Comment 5 Aaron Bockover [MSFT] 2013-08-07 18:10:00 UTC
Oh, missed the product on the bug. I just saw the "same is true for Mono for Android". I suspect the symbol is just getting stripped, but I'll look into it.
Comment 6 Manish 2013-08-26 04:04:02 UTC
same problem here.
Comment 7 Shawn Baker 2013-09-13 12:54:18 UTC
Any word on this bug? This is preventing us from doing the iOS 7 release of our product.
Comment 8 Aaron Bockover [MSFT] 2013-10-10 12:58:23 UTC
I've fixed this in Mono master. I'm not sure what release it will make it into however.