Skip to content

feat: re-enable netstandard2.0 with Windows/net48 CI gate#412

Merged
lduchosal merged 4 commits into
masterfrom
feat/netstandard20
May 17, 2026
Merged

feat: re-enable netstandard2.0 with Windows/net48 CI gate#412
lduchosal merged 4 commits into
masterfrom
feat/netstandard20

Conversation

@lduchosal
Copy link
Copy Markdown
Owner

Summary

  • Re-enable netstandard2.0 target on System.Net.IPNetwork (consumable from .NET Framework 4.6.1+ and other ns2.0 runtimes)
  • Source compat: internal NotNullWhenAttribute polyfill, SHA256.ComputeHash fallback widened to all NETSTANDARD, [^1] indexer replaced, Contains(char) replaced with IndexOf
  • Multi-target TestProject to net10.0;net48 and add a windows-latest CI job — this is the only path that actually loads the ns2.0 DLL at runtime, gating regressions specific to the ns2.0 build
  • CLI-coupled tests (ArchitectureTest, ConsoleUnitTest, ConsoleJsonOutputTest) excluded from the net48 build; they test the CLI (net10.0-only), not the library

Test plan

  • dotnet build src/System.Net.IPNetwork succeeds for all 5 TFMs (net8/9/10, ns2.0, ns2.1)
  • dotnet build src/TestProject succeeds for net10.0 and net48
  • All 1364 tests pass on net10.0 locally
  • Verified the net48 TestProject output links the ns2.0 library DLL (byte-identical)
  • Ubuntu CI green
  • Windows net48 CI green

🤖 Generated with Claude Code

lduchosal and others added 2 commits May 17, 2026 16:29
ns2.0 lets the library be consumed by .NET Framework 4.6.1+ and other
ns2.0-compatible runtimes. Source compat changes:

- Polyfills.cs: internal NotNullWhenAttribute shim under #if NETSTANDARD2_0
- UniqueLocalAddress: SHA256.HashData is .NET 5+; widen the
  ComputeHash fallback from #if NETSTANDARD2_1 to #if NETSTANDARD
- IPNetwork2WideSubnet: replace nnin[^1] with nnin[Length-1]
  (System.Index is ns2.1+)
- CidrNetworkAware: Contains(char) is .NET Core 2.1+; use IndexOf and
  add null-forgive since string.IsNullOrWhiteSpace lacks [NotNullWhen]
  annotation on ns2.0

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Multi-target TestProject to net10.0;net48 so the net48 build links
against the library's ns2.0 output. This is the only CI path that
actually loads the ns2.0 DLL — without it, the new ns2.0 target
ships untested.

- TestProject.csproj: net10.0;net48; ConsoleApplication ref is
  net10.0-only (the CLI only targets net10.0); ArchitectureTest,
  ConsoleUnitTest, ConsoleJsonOutputTest excluded from net48
  (they test the CLI, not the library)
- IPAddressExtensionTests: SHA256.HashData fallback for non-.NET 5+
- dotnet.yml: new windows-net48 job runs TestProject.exe under net48

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread .github/workflows/dotnet.yml Fixed
@coveralls
Copy link
Copy Markdown

coveralls commented May 17, 2026

Coverage Report for CI Build 966

Coverage remained the same at 94.053%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 2438
Covered Lines: 2293
Line Coverage: 94.05%
Coverage Strength: 491933.55 hits per line

💛 - Coveralls

EnableMSTestRunner=true doesn't emit a TestProject.exe on net48,
so the previous invocation path didn't exist. dotnet test handles
both VSTest hosting on .NET Framework and the platform bridge.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread .github/workflows/dotnet.yml Fixed
dotnet test no longer bridges to VSTest under Microsoft.Testing.Platform
on .NET 10 SDK. Easiest path: explicit OutputType=Exe so net48 produces
TestProject.exe (net10.0 still produces TestProject.dll, unaffected).
Workflow runs the exe via the pwsh call operator.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment on lines +44 to +60
name: Test net48 (Windows)
runs-on: windows-latest

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Restore
run: dotnet restore ./src --verbosity m
- name: Build TestProject (net48)
run: dotnet build ./src/TestProject/TestProject.csproj -c Debug -f net48 --no-restore
- name: Run net48 tests against netstandard2.0 build
run: |
& .\src\TestProject\bin\Debug\net48\TestProject.exe
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

@lduchosal lduchosal merged commit 866f724 into master May 17, 2026
13 of 16 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.

3 participants