[System] Throw PlatformNotSupportedException if NetworkInformation.NetworkChange...
authorRolf Bjarne Kvinge <rolf@xamarin.com>
Wed, 18 May 2016 12:21:23 +0000 (14:21 +0200)
committerZoltan Varga <vargaz@gmail.com>
Wed, 18 May 2016 12:21:23 +0000 (08:21 -0400)
NetworkInformation.NetworkChange requires the SystemConfiguration framework,
which isn't available on watchOS.

mcs/class/System/System.Net.NetworkInformation/NetworkChange.cs

index 357217659964fea2aabcd59beb116fe8b5866d08..50e9009741a2f5d028818a16e4aa7ddc0354d6a8 100644 (file)
@@ -101,6 +101,9 @@ namespace System.Net.NetworkInformation {
 
                static void MaybeCreate ()
                {
+#if MONOTOUCH_WATCH
+                       throw new PlatformNotSupportedException ("NetworkInformation.NetworkChange is not supported on the current platform.");
+#else
                        if (networkChange != null)
                                return;
 
@@ -111,6 +114,7 @@ namespace System.Net.NetworkInformation {
                                networkChange = new LinuxNetworkChange ();
 #endif
                        }
+#endif // MONOTOUCH_WATCH
                }
 
                static void MaybeDispose ()
@@ -122,6 +126,7 @@ namespace System.Net.NetworkInformation {
                }
        }
 
+#if !MONOTOUCH_WATCH
        internal sealed class MacNetworkChange : INetworkChange
        {
                const string DL_LIB = "/usr/lib/libSystem.dylib";
@@ -317,6 +322,7 @@ namespace System.Net.NetworkInformation {
                                availabilityChanged (null, new NetworkAvailabilityEventArgs (instance.IsAvailable));
                }
        }
+#endif // !MONOTOUCH_WATCH
 
 #if !NETWORK_CHANGE_STANDALONE && !MONOTOUCH