Skip to content

IPAddress.Parse("4294967296") does not throw FormatException on OS X #18619

@moander

Description

@moander

System.Net.IPAddress.Parse("4294967296") does not throw FormatException on OS X.

$ uname -a
Darwin 15.6.0 Darwin Kernel Version 15.6.0: Mon Aug 29 20:21:34 PDT 2016; root:xnu-3248.60.11~1/RELEASE_X86_64 x86_64 i386 MacBookPro11,5 Darwin

$ dotnet --version
1.0.0-preview2-003121

Steps to reproduce

mkdir foo
cd foo
dotnet new
dotnet restore
sed -i '9i Console.WriteLine(System.Net.IPAddress.Parse("4294967296"));' Program.cs
dotnet run

The sed command writes Console.WriteLine(System.Net.IPAddress.Parse("4294967296")); to line 9 in Program.cs

IPAddress.Parse returns 0.0.0.0 on my Mac when using dotnet run.

$ dotnet run
Project bug (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.
0.0.0.0
Hello World!

On Windows, Ubuntu, Docker on Mac, and Mono on Mac I get the expected FormatException:

$ mono bin/Debug/netcoreapp1.0/bug.dll 

Unhandled Exception:
System.FormatException: An invalid IP address was specified.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions