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)

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


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 for Bug 1254 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

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