Target .NET 9 / .NET 10 and bump to 16.0.0#431
Merged
Conversation
MS DI's `IServiceProvider.GetServices(T)` and `T[]` resolution return only non-keyed registrations; keyed registrations are looked up explicitly via `GetKeyedService(T, key)`. Lamar's `ListInstance` / `ArrayInstance` populated their `Elements` straight from `ServiceGraph.FindAll`, which is built from `ServiceFamily.All` — the flat union of keyed and non-keyed instances for a given service type. As a result a keyed registration of `T` ended up as an `IEnumerable<T>` element, deviating from MS DI semantics and, more importantly, causing infinite recursion for code-generating consumers: JasperFx's `EnumerableSingletons.KeyedMirror` registers a keyed Singleton lambda whose factory calls `sp.GetServices(elementType)` to return the shared non-keyed singleton instance. When Lamar inlines the mirror's Singleton via `InjectedServiceField.ToVariableExpression`'s `QuickResolve`, the factory invokes `sp.GetServices(T)`, Lamar resolves the `IEnumerable<T>` family (still including the mirror itself), the generated build frame inlines the mirror again, and so on — ~750-frame stack overflow before any handler runs. Filter `IsKeyedService` out of `createPlan` in both `ListInstance` and `ArrayInstance`, matching MS DI's behaviour and breaking the cycle. Explicit keyed lookups (`GetKeyedService(T, key)`) are unaffected. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop all target frameworks below .NET 9 across the solution and ensure the published nugets (Lamar, Lamar.Microsoft.DependencyInjection) target net9.0;net10.0 at version 16.0.0. Remove dead net6.0/net8.0 conditional package groups and the .NET 8 SDK setup in CI workflows. Closes #427 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
3aa41ea to
f86d503
Compare
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.
Target .NET 9 / .NET 10 and bump to 16.0.0
Closes #427
What changed
net8.0;net9.0;net10.0tonet9.0;net10.0.net9.0;net10.0and are bumped to 16.0.0:LamarLamar.Microsoft.DependencyInjectionnet6.0/net8.0conditional<ItemGroup>package references inLamar,Lamar.AspNetCoreTests, andLamar.AspNetCoreTests.Integration.dotnet.yml,publish_lamar.yml): removed the .NET 8 SDK setup step, leaving 9.0.x + 10.0.x.Verification
dotnet build Lamar.sln -c Release→ 0 errors (pre-existing analyzer warnings only), builds on bothnet9.0andnet10.0.dotnet packproducesLamar.16.0.0.nupkgandLamar.Microsoft.DependencyInjection.16.0.0.nupkg, each containinglib/net9.0andlib/net10.0.Lamar.Diagnosticscould not be retargeted/published in this PR. It depends on the legacyOakton 6.3.0andJasperFx.CodeGeneration.Commands 3.4.0packages, whose transitive constraints are mutually incompatible with the .NET 10 stack that Lamar now pulls in viaJasperFx 1.10.1:Oakton 6.3.0→Microsoft.Extensions.Hosting (>= 6.0.0 && < 10.0.0)Lamar→JasperFx 1.10.1→Microsoft.Extensions.Hosting (>= 10.0.0)← irreconcilableJasperFx.RuntimeCompiler 3.4.0capsLogging.Abstractions < 9.0.0)Publishing
Lamar.Diagnosticsat 16.0.0 requires migrating it offOakton/JasperFx.CodeGeneration.Commandsonto the unifiedJasperFx 1.xpackage — a code change that should be done deliberately as a follow-up.🤖 Generated with Claude Code