Commit ffcdaeb
authored
Don't mutating the ScopeId on static readonly IPAddress fields (#115456)
The Address field was made readonly in dotnet/corefx#33531. Somehow ScopeId,
the only other mutatable property, was missed. I did not see discussion of
this in that PR or the related issue.
An example program that illistrates the problem:
```csharp
Console.WriteLine(IPAddress.IPv6Loopback);
IPAddress.IPv6Loopback.ScopeId = 1;
Console.WriteLine(IPAddress.IPv6Loopback);
```
This prints:
```txt
::1
::1%1
```
I think the right behavior is to throw when setting the ScopeId (this pr).
Contributes to #278701 parent fb7050d commit ffcdaeb
File tree
2 files changed
+15
-3
lines changed- src/libraries/System.Net.Primitives
- src/System/Net
- tests/FunctionalTests
2 files changed
+15
-3
lines changedLines changed: 11 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
441 | 446 | | |
442 | 447 | | |
443 | 448 | | |
| |||
772 | 777 | | |
773 | 778 | | |
774 | 779 | | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
775 | 783 | | |
776 | 784 | | |
777 | 785 | | |
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
349 | 353 | | |
350 | 354 | | |
351 | 355 | | |
| |||
0 commit comments