feat: re-enable netstandard2.0 with Windows/net48 CI gate#412
Merged
Conversation
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>
Coverage Report for CI Build 966Coverage remained the same at 94.053%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - 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>
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 } |
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
netstandard2.0target onSystem.Net.IPNetwork(consumable from .NET Framework 4.6.1+ and other ns2.0 runtimes)NotNullWhenAttributepolyfill,SHA256.ComputeHashfallback widened to allNETSTANDARD,[^1]indexer replaced,Contains(char)replaced withIndexOfTestProjecttonet10.0;net48and add awindows-latestCI job — this is the only path that actually loads the ns2.0 DLL at runtime, gating regressions specific to the ns2.0 buildArchitectureTest,ConsoleUnitTest,ConsoleJsonOutputTest) excluded from the net48 build; they test the CLI (net10.0-only), not the libraryTest plan
dotnet build src/System.Net.IPNetworksucceeds for all 5 TFMs (net8/9/10, ns2.0, ns2.1)dotnet build src/TestProjectsucceeds for net10.0 and net48🤖 Generated with Claude Code