Bug 51557 - IPAddress.MapToIPv4/MapToIPv6 does not working
Summary: IPAddress.MapToIPv4/MapToIPv6 does not working
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: 4.6.0 (C8)
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-01-16 16:41 UTC by alexvaluyskiy
Modified: 2017-09-01 11:33 UTC (History)
2 users (show)

Tags:
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 for Bug 51557 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 alexvaluyskiy 2017-01-16 16:41:52 UTC
I've tried to run this code on Mono/Linux
> static void Main(string[] args)
> {
>   IPAddress address = IPAddress.Parse("128.50.24.12");
>   var newAddressIPv4 = address.MapToIPv4();
>   var newAddressIPv6 = address.MapToIPv6();
> }

but I've got an error

> Program.cs(15,42): error CS1061: Type `System.Net.IPAddress' does not contain a definition for `MapToIPv4' and no extension method `MapToIPv4' of type `System.Net.IPAddress' could be found. Are you missing an assembly reference? /usr/lib/mono/4.5-api/System.dll (Location of the symbol related to previous error)
> Program.cs(16,42): error CS1061: Type `System.Net.IPAddress' does not contain a definition for `MapToIPv6' and no extension method `MapToIPv6' of type `System.Net.IPAddress' could be found. Are you missing an assembly reference? /usr/lib/mono/4.5-api/System.dll (Location of the symbol related to previous error)

It's weird, because I've found these extensions methods in the source code here
https://github.com/mono/mono/blob/master/mcs/class/referencesource/System/net/System/Net/IPAddress.cs#L753
Comment 1 Marek Safar 2017-01-16 20:58:11 UTC
We are probably missing this API in our 4.5 compatibility files. Targeting .net 4.6 should workaround/fix this problem
Comment 2 alexvaluyskiy 2017-01-17 07:26:46 UTC
I've checked it in 4.6 project and it's works. But these APIs become available since .NET 4.5