Yesterday I met a thing that seems as a .NET bug.
IPAddress addr = IPAddress.Parse("fe80::1111:2222:abc%11"); // ScopeId is 11
string s1 = addr.ToString(); // I obviously see fe80::1111:2222:abc%11
addr.ScopeId = 0; // ScopeId is zero from now
string s2 = addr.ToString(); // I expect to see fe80::1111:2222:abc
Why s1
is the same content as s2
even after the ScopeId
is changed? In debugger Watch window I see that scope value is really changed. But internal string field has no impact.
For sure, I tried this with various IPv6 addresses and different scope IDs - behavior is the same. What have I missed?