The following two lines of code look innocent enough, but they create a problem that took us ages to track down. (Well not these exact lines of code but you get the idea).

 

IPAddress address = IPAddress.Parse("");

Console.WriteLine(address.ToString());

 

The problem is on Windows XP (SP 1) this works fine, on Windows 2003 this code throws a FormatException. The reason is although you’re running exactly the same managed code the framework relies on unmanaged code to do most of the work, it p/invokes a method “inet_addr” in “ws2_32.dll” and this must be different between the two platforms.

 

I’ll explain why this caused us such a huge problem in another post. Well maybe.