File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
mcs/class/System/System.Net.NetworkInformation Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,8 @@ static void MaybeCreate ()
107107 if ( networkChange != null )
108108 return ;
109109
110+ if ( IsWindows )
111+ throw new PlatformNotSupportedException ( "NetworkInformation.NetworkChange is not supported on the current platform." ) ;
110112 try {
111113 networkChange = new MacNetworkChange ( ) ;
112114 } catch {
@@ -117,6 +119,21 @@ static void MaybeCreate ()
117119#endif // MONOTOUCH_WATCH
118120 }
119121
122+ static bool IsWindows
123+ {
124+ get
125+ {
126+ PlatformID platform = Environment . OSVersion . Platform ;
127+ if ( platform == PlatformID . Win32S ||
128+ platform == PlatformID . Win32Windows ||
129+ platform == PlatformID . Win32NT ||
130+ platform == PlatformID . WinCE ) {
131+ return true ;
132+ }
133+ return false ;
134+ }
135+ }
136+
120137 static void MaybeDispose ( )
121138 {
122139 if ( networkChange != null && networkChange . HasRegisteredEvents ) {
You can’t perform that action at this time.
0 commit comments