Triage for dotnet/runtime#117114.
Repo filter: All networking issues.
MihuBot version: 0c3d2c.
Ping MihaZupan for any issues.
This is a test triage report generated by AI, aimed at helping the triage team quickly identify past issues/PRs that may be related.
Take any conclusions with a large grain of salt.
dotnet/runtime#117114: `System.Net.IPNetwork` not behave as `Microsoft.AspNetCore.HttpOverrides.IPNetwork` by WeihanLi
[Tool] Searching for System.Net.IPNetwork TryParse CIDR, Microsoft.AspNetCore.HttpOverrides.IPNetwork TryParse, System.Net.IPNetwork vs Microsoft.AspNetCore.HttpOverrides.IPNetwork, IPNetwork.TryParse 127.0.0.1/8, System.Net.IPNetwork parsing differences (IncludeOpen=True, IncludeClosed=True, IncludeIssues=True, IncludePullRequests=True, Repository=dotnet/runtime)
[Tool] Obtained 5 comments for issue #95321: System.Net.IPNetwork - not working
[Tool] Found 34 issues, 185 comments, 34 returned results (11738 ms)
Here are the most relevant related issues and discussions for triaging issue #117114 ("System.Net.IPNetwork not behave as Microsoft.AspNetCore.HttpOverrides.IPNetwork"):
1. Issue #95321 (Nov 2023) - "System.Net.IPNetwork - not working"
- Summary: Reports that
System.Net.IPNetwork.Parse("192.168.1.1/24") throws a FormatException, while Microsoft.AspNetCore.HttpOverrides.IPNetwork.Parse("192.168.1.1/24") works.
- Key Discussion:
- MihaZupan (team): Explains that
System.Net.IPNetwork requires the base address to have all host bits zeroed (i.e., must be the network address, not any address in the subnet). So, "192.168.1.0/24" is valid, but "192.168.1.1/24" is not.
- Further comments: Users express that this makes
System.Net.IPNetwork less useful for common scenarios, as CIDR strings often use a host address with a prefix.
- Conclusion: This is by design for
System.Net.IPNetwork to ensure unambiguous representation, but it is a breaking difference from the ASP.NET Core implementation.
2. Issue #95865 (Dec 2023) - "System.Net.IPNetwork parse CIDR issue"
- Summary: User confused why
IPNetwork.TryParse("2001:0db8::1/64", out var _) fails, but IPNetwork.TryParse("2001:0db8::/64", out var _) works.
- Key Discussion:
- antonfirsov (team): Reiterates that the base address must have all bits after the prefix set to zero. The input must be the network address, not an arbitrary address in the subnet.
- User acknowledges: The mistake was using a host address instead of the network address.
- Conclusion: Documentation and behavior are consistent with the design.
3. Issue #79946 (Dec 2022–Jul 2023) - "[API Proposal]: Add a type to represent IP networks based on CIDR notation"
- Summary: This is the original API proposal and design discussion for adding
System.Net.IPNetwork.
- Key Discussion:
- The design intentionally disallows arbitrary IP/prefix pairs; the base address must be the network address (host bits zero).
- This is different from the ASP.NET Core
IPNetwork, which is more permissive.
- The rationale is to ensure unambiguous representation and simplify equality and other operations.
- There is explicit discussion about the difference from the ASP.NET Core implementation and the need to clarify/document this.
- Conclusion: The difference is intentional and by design.
4. Issue #64033 (Jan–Feb 2022) - "API Proposal: IPNetwork to support CIDR notation"
- Summary: Early proposal to move the ASP.NET Core
IPNetwork to System.Net.
- Key Discussion:
- Triage at the time was that demand was not high enough, but this changed with #79946.
- Notes that the ASP.NET Core version is more permissive.
5. Issue #86584 (May 2023) - "[API Proposal]: Move IPNetwork to System.Net and add a string constructor"
- Summary: Suggests moving the ASP.NET Core
IPNetwork to System.Net and making it more generally available.
- Key Discussion:
- Team responds that
System.Net.IPNetwork is being added in .NET 8, but with stricter parsing rules than the ASP.NET Core version.
6. Issue #36428 (May–Jun 2020) - "Add CIDR Block logic to System.Net"
- Summary: Proposal for richer CIDR/subnet support in the BCL.
- Key Discussion:
- Triage at the time was that this was too niche, but later demand led to the addition of
System.Net.IPNetwork.
7. Issue #96356 (Dec 2023) - "IpAddress subnetwork support"
- Summary: User asks about subnet mask verification.
- Key Discussion:
- Team points to
System.Net.IPNetwork as the solution, but with the caveat of its stricter requirements.
8. Issue #104591 (Jul 2024) - "[API Proposal]: IpNetwork does not allow to check if another network is subnet of current network"
- Summary: User requests additional features for
System.Net.IPNetwork, such as checking if one network contains another, and calculating broadcast/network addresses.
- Key Discussion:
- No team response yet, but highlights ongoing interest in richer subnet/CIDR support.
9. Issue #98427 (Feb–Jun 2024) - "IPNetwork.Contains for IPv4 networks should match IPv4-Mapped IPv6 Addresses"
- Summary: Discusses behavior of
Contains for IPv4-mapped IPv6 addresses, not directly about parsing, but relevant for completeness.
10. Issue #93022 (Sep–Oct 2023) - "The type 'IPNetwork' exists in both 'System.Net.IPNetwork' and 'System.Net.Primitives'"
- Summary: Reports a type name conflict when using the
IPNetwork2 NuGet package and .NET 8+.
Key Takeaways for Triaging
- The behavior difference between
System.Net.IPNetwork and Microsoft.AspNetCore.HttpOverrides.IPNetwork is intentional and by design.
System.Net.IPNetwork requires the base address to be the network address (all host bits zero), not just any address in the subnet. This is stricter than the ASP.NET Core version.
- This design is documented and was discussed at length in the API proposal (#79946).
- Users who want the more permissive behavior of the ASP.NET Core version will need to zero the host bits themselves before using
System.Net.IPNetwork.
- There is ongoing interest in richer subnet/CIDR support, but the current behavior is not considered a bug.
Most Directly Related Issues
- #95321: User confusion about why
System.Net.IPNetwork fails to parse non-network addresses; team explains the design.
- #79946: API proposal and design rationale, including explicit discussion of the stricter parsing rules.
- #95865: Another example of user confusion, with team reiterating the design.
- #86584: Team clarifies the difference between the new BCL type and the ASP.NET Core version.
If you need to reference a canonical answer for this triage, point to the remarks in the documentation and the explanations in #95321 and #79946. The difference is not a regression or bug, but a deliberate design choice for the BCL type.
Triage for dotnet/runtime#117114.
Repo filter: All networking issues.
MihuBot version:
0c3d2c.Ping MihaZupan for any issues.
This is a test triage report generated by AI, aimed at helping the triage team quickly identify past issues/PRs that may be related.
Take any conclusions with a large grain of salt.
Here are the most relevant related issues and discussions for triaging issue #117114 ("
System.Net.IPNetworknot behave asMicrosoft.AspNetCore.HttpOverrides.IPNetwork"):1. Issue #95321 (Nov 2023) - "System.Net.IPNetwork - not working"
System.Net.IPNetwork.Parse("192.168.1.1/24")throws aFormatException, whileMicrosoft.AspNetCore.HttpOverrides.IPNetwork.Parse("192.168.1.1/24")works.System.Net.IPNetworkrequires the base address to have all host bits zeroed (i.e., must be the network address, not any address in the subnet). So,"192.168.1.0/24"is valid, but"192.168.1.1/24"is not.System.Net.IPNetworkless useful for common scenarios, as CIDR strings often use a host address with a prefix.System.Net.IPNetworkto ensure unambiguous representation, but it is a breaking difference from the ASP.NET Core implementation.2. Issue #95865 (Dec 2023) - "System.Net.IPNetwork parse CIDR issue"
IPNetwork.TryParse("2001:0db8::1/64", out var _)fails, butIPNetwork.TryParse("2001:0db8::/64", out var _)works.3. Issue #79946 (Dec 2022–Jul 2023) - "[API Proposal]: Add a type to represent IP networks based on CIDR notation"
System.Net.IPNetwork.IPNetwork, which is more permissive.4. Issue #64033 (Jan–Feb 2022) - "API Proposal: IPNetwork to support CIDR notation"
IPNetworktoSystem.Net.5. Issue #86584 (May 2023) - "[API Proposal]: Move IPNetwork to System.Net and add a string constructor"
IPNetworktoSystem.Netand making it more generally available.System.Net.IPNetworkis being added in .NET 8, but with stricter parsing rules than the ASP.NET Core version.6. Issue #36428 (May–Jun 2020) - "Add CIDR Block logic to System.Net"
System.Net.IPNetwork.7. Issue #96356 (Dec 2023) - "IpAddress subnetwork support"
System.Net.IPNetworkas the solution, but with the caveat of its stricter requirements.8. Issue #104591 (Jul 2024) - "[API Proposal]:
IpNetworkdoes not allow to check if another network is subnet of current network"System.Net.IPNetwork, such as checking if one network contains another, and calculating broadcast/network addresses.9. Issue #98427 (Feb–Jun 2024) - "IPNetwork.Contains for IPv4 networks should match IPv4-Mapped IPv6 Addresses"
Containsfor IPv4-mapped IPv6 addresses, not directly about parsing, but relevant for completeness.10. Issue #93022 (Sep–Oct 2023) - "The type 'IPNetwork' exists in both 'System.Net.IPNetwork' and 'System.Net.Primitives'"
IPNetwork2NuGet package and .NET 8+.Key Takeaways for Triaging
System.Net.IPNetworkandMicrosoft.AspNetCore.HttpOverrides.IPNetworkis intentional and by design.System.Net.IPNetworkrequires the base address to be the network address (all host bits zero), not just any address in the subnet. This is stricter than the ASP.NET Core version.System.Net.IPNetwork.Most Directly Related Issues
System.Net.IPNetworkfails to parse non-network addresses; team explains the design.If you need to reference a canonical answer for this triage, point to the remarks in the documentation and the explanations in #95321 and #79946. The difference is not a regression or bug, but a deliberate design choice for the BCL type.