Skip to content

feat/v4-nullable#383

Merged
lduchosal merged 16 commits intomasterfrom
feat/v4-nullable
Mar 7, 2026
Merged

feat/v4-nullable#383
lduchosal merged 16 commits intomasterfrom
feat/v4-nullable

Conversation

@lduchosal
Copy link
Owner

No description provided.

lduchosal and others added 8 commits March 7, 2026 13:19
Rename parameter `sanitanize` to `sanitize` in Parse and TryParse methods.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
BREAKING CHANGE: netstandard2.0 is no longer supported.
Remove System.Memory package references (no longer needed).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove [Obsolete] from static methods (Subnet, TrySubnet, Supernet,
TrySupernet, Print, Contains, Overlap, IsIANAReserved) and FilterEnum.
Remove static ListIPAddress(IPNetwork2) which is no longer needed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Enable <Nullable>enable</Nullable> with TreatWarningsAsErrors.
Add [NotNullWhen(true)] to all TryParse, TrySubnet, TrySupernet,
TrySubtract, TryWideSubnet, TryParseRange, and TryToNetmask methods.
Add nullable annotations to all public API parameters and return types.
Refactor Parse methods to use if(!InternalParse) pattern for proper
null flow analysis, eliminating most null-forgiving (!) operators.

BREAKING CHANGE: nullable annotations change API surface for consumers
using nullable reference types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Enable <Nullable>enable</Nullable> with TreatWarningsAsErrors.
Add [NotNullWhen(true)] to all TryParse, TrySubnet, TrySupernet,
TrySubtract, TryWideSubnet, TryParseRange, and TryToNetmask methods.
Add nullable annotations to all public API parameters and return types.
Refactor Parse methods to use if(!InternalParse) pattern for proper
null flow analysis, eliminating most null-forgiving (!) operators.

BREAKING CHANGE: nullable annotations change API surface for consumers
using nullable reference types.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
TryParseCidr now has [NotNullWhen(true)], so (byte)cidr is sufficient.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ArgumentException constructors expect (message, paramName) but
nameof(param) was being passed as the message argument. Add descriptive
messages and pass parameter names in the correct position.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coveralls
Copy link

coveralls commented Mar 7, 2026

Pull Request Test Coverage Report for Build 881

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 55 unchanged lines in 12 files lost coverage.
  • Overall coverage decreased (-1.0%) to 92.371%

Files with Coverage Reduction New Missed Lines %
/src/System.Net.IPNetwork/CidrClassFull.cs 1 92.31%
/src/System.Net.IPNetwork/IPNetwork2InternalParse.cs 1 98.43%
/src/System.Net.IPNetwork/IPNetwork2Operators.cs 1 97.06%
/src/System.Net.IPNetwork/IPNetwork2SupernetArray.cs 2 97.8%
/src/System.Net.IPNetwork/IPNetwork2ToNetmask.cs 2 93.33%
/src/System.Net.IPNetwork/IPNetwork2TryParse.cs 2 87.5%
/src/System.Net.IPNetwork/IPNetwork2ParseRange.cs 4 96.77%
/src/System.Net.IPNetwork/IPNetwork2Subnet.cs 4 91.11%
/src/System.Net.IPNetwork/IPNetwork2Supernet.cs 4 94.44%
/src/System.Net.IPNetwork/IPNetwork2Substract.cs 6 86.44%
Totals Coverage Status
Change from base Build 876: -1.0%
Covered Lines: 1901
Relevant Lines: 2058

💛 - Coveralls

lduchosal and others added 8 commits March 7, 2026 17:30
- IDE0041: use pattern matching `is null` instead of `ReferenceEquals`
- IDE0056: use index-from-end operator `[^1]` instead of `[.Length - 1]`

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move setup code (variable declarations, Parse calls) outside
Assert.ThrowsExactly lambdas, keeping only the throwing statement
inside. Also remove obsolete #pragma warning disable/restore 0618.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use SHA256.HashData() on .NET 5+ targets, fallback to
SHA256.Create().ComputeHash() on netstandard2.1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add assertions to 11 test methods that had no Assert calls:
examples, static method tests, and serialization benchmarks.
Also remove obsolete #pragma warning disable/restore 0618.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- CA1510: use ArgumentNullException.ThrowIfNull on .NET 5+
- CA1512: use ArgumentOutOfRangeException.ThrowIfGreaterThanOrEqual on .NET 5+
- CA1847: use string.Contains(char) instead of string.Contains(string)
- SA1507: remove multiple consecutive blank lines

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Revert ThrowIfNull/ThrowIfGreaterThanOrEqual conditional blocks
back to simple if/throw to fix code coverage on new code.
Keep #if only for SHA256.HashData (real API difference).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 7, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
74.4% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@lduchosal
Copy link
Owner Author

mergeing version 4.0.0

@lduchosal lduchosal merged commit 63025f9 into master Mar 7, 2026
9 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants