Bug 1254 - NetworkInformation.Win32IPInterfaceProperties2.UnicastAddresses throws NullReferenceException
Summary: NetworkInformation.Win32IPInterfaceProperties2.UnicastAddresses throws NullRe...
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: 2.10.x
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-10-05 08:32 UTC by Alexey Yakovlev
Modified: 2012-03-23 13:13 UTC (History)
3 users (show)

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


Attachments
Lists ip addresses on all network interfaces. (4.40 KB, text/plain)
2011-10-05 08:32 UTC, Alexey Yakovlev
Details

Description Alexey Yakovlev 2011-10-05 08:32:26 UTC
Created attachment 595 [details]
Lists ip addresses on all network interfaces.

Getting list of available network interfaces doesn't work on Windows.
See the attachment (works on .NET and Mono/Linux, crashes on Mono/Windows).
Here is a stack trace:

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
  at System.String.memcpy1 (System.Byte* dest, System.Byte* src, Int32 size) [0x00005] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.5\mcs\class\corlib\System\String.cs:2904
  at System.String.memcpy (System.Byte* dest, System.Byte* src, Int32 size) [0x00070] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.5\mcs\class\corlib\System\String.cs:2946
  at (wrapper unknown) System.Net.NetworkInformation.Win32_IP_ADAPTER_UNICAST_ADDRESS:PtrToStructure (intptr,object)
  at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:PtrToStructure (intptr,System.Type)
  at System.Net.NetworkInformation.UnicastIPAddressInformationImplCollection.Win32FromUnicast (Int32 ifIndex, IntPtr ptr) [0x0000e] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.5\mcs\class\System\System.Net.NetworkInformation\UnicastIPAddressInformationCollection.cs:120
  at System.Net.NetworkInformation.Win32IPInterfaceProperties2.get_UnicastAddresses () [0x00014] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.5\mcs\class\System\System.Net.NetworkInformation\IPInterfaceProperties.cs:362
  at Test.Main () [0x00018] in D:\Experiments\GetHostName\test.cs:14
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
  at System.String.memcpy1 (System.Byte* dest, System.Byte* src, Int32 size) [0x00005] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.5\mcs\class\corlib\System\String.cs:2904
  at System.String.memcpy (System.Byte* dest, System.Byte* src, Int32 size) [0x00070] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.5\mcs\class\corlib\System\String.cs:2946
  at (wrapper unknown) System.Net.NetworkInformation.Win32_IP_ADAPTER_UNICAST_ADDRESS:PtrToStructure (intptr,object)
  at (wrapper managed-to-native) System.Runtime.InteropServices.Marshal:PtrToStructure (intptr,System.Type)
  at System.Net.NetworkInformation.UnicastIPAddressInformationImplCollection.Win32FromUnicast (Int32 ifIndex, IntPtr ptr) [0x0000e] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.5\mcs\class\System\System.Net.NetworkInformation\UnicastIPAddressInformationCollection.cs:120
  at System.Net.NetworkInformation.Win32IPInterfaceProperties2.get_UnicastAddresses () [0x00014] in C:\cygwin\tmp\monobuild\build\BUILD\mono-2.10.5\mcs\class\System\System.Net.NetworkInformation\IPInterfaceProperties.cs:362
  at Test.Main () [0x00018] in D:\Experiments\GetHostName\test.cs:14

Note You need to log in before you can comment on or make changes to this bug.