Migrate to .NET 10 with modernization pass - #3
Open
iamadamreed wants to merge 7 commits into
Open
Conversation
- TargetFramework net9.0 -> net10.0 across all projects - global.json SDK 9.0.100 -> 10.0.100 - Microsoft.* packages 9.0.0 -> 10.0.0, Test.Sdk 17.14.1, NetAnalyzers 10.0.0 - Drop explicit System.Text.Json reference (framework-provided, NU1510) - Pin Microsoft.OpenApi 2.11.0 (transitive 2.0.0 has GHSA-v5pm-xwqc-g5wc) - Update CI workflow and cross-build Dockerfile to .NET 10
- System.Threading.Lock for the combined-resolver lazy init - Seal internal JsonSerializerContext classes - Collection expressions for empty-list/array returns
- Group endpoints under /api route group - TypedResults with explicit Results<...> signatures for accurate OpenAPI schemas
- Microsoft.NET.Test.Sdk 18.8.1, xunit 2.9.3, coverlet.collector 10.0.1 - Replace placeholder tests with 19 tests: exception hierarchy, UnifiApiResponse semantics, JSON source-gen context round-trips
Target-typed [] on a Task<IEnumerable<T>> materializes as T[], not List<T>, so empty results silently became fixed-size and uncastable to List<T>. Restore new List<T>() on those paths; [] stays where the target is List<T> or byte[]. Also renames a JSON test whose name said camelCase while asserting snake_case [JsonPropertyName] values.
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
net9.0→net10.0, SDK 10.0.100 inglobal.json, Microsoft.* packages to 10.0.0, CI workflow and cross-build Dockerfile updatedSystem.Text.Jsonreference (framework-provided in .NET 10, NU1510); pinnedMicrosoft.OpenApi2.11.0 to resolve GHSA-v5pm-xwqc-g5wc (high severity, transitive viaMicrosoft.AspNetCore.OpenApi)System.Threading.Lock, sealed internalJsonSerializerContextclasses, collection expressions — public API surface unchanged/apiroute group withTypedResultsand explicit typed response signatures for accurate OpenAPI schemasUnifiApiResponse<T>, JSON source-gen context round-trips)Verification
TreatWarningsAsErrorson)dotnet packproducesnet10.0packages for Common + AccessCorrection: Native AOT publish status
An earlier version of this description claimed the Native AOT publish succeeds with zero warnings. That was wrong.
dotnet publish Unifi.NET.Samples -c Release -r osx-arm64fails, because RestSharp 112.1.0 producesIL2104(trim) andIL3053(AOT analysis) warnings that become errors underTreatWarningsAsErrors.This is pre-existing and not introduced by this PR — verified by running the same publish against pre-migration
main(1b4f628), which fails identically, plus an extraSystem.Private.XmlIL3053that .NET 10 no longer emits. The .NET 10 state is strictly better, but still failing. PublishingUnifi.NET.Accessas a library succeeds; only the AOT-compiled sample app fails. Tracked as follow-up work — see review findings below.Review findings addressed
A code review (Grok, via Orca orchestration) raised 5 findings. Fixed in 90c5285:
IEnumerable<T>returns regressed to arrays — target-typed[]onTask<IEnumerable<T>>materializes asT[], notList<T>, so empty results silently became fixed-size and uncastable toList<T>(verified:InvalidCastExceptionon cast,NotSupportedExceptiononAdd). Restorednew List<T>()on those 9 paths;[]retained where the target isList<T>orbyte[].Open follow-ups (not blocking, filed for later):
net10.0TFM floor ships under the sameVersionPrefix3.3.21, sonet9.0consumers hit a restore failure without a SemVer signal — needs a release note or version-scheme decisionUnifi.NET.Commonexception tests are largely constructor tautologies; error-code→exception mapping is untested