Skip to content

Target .NET 9 / .NET 10 and bump to 16.0.0#431

Merged
jeremydmiller merged 2 commits into
masterfrom
chore/net9-net10-targets-v16
May 29, 2026
Merged

Target .NET 9 / .NET 10 and bump to 16.0.0#431
jeremydmiller merged 2 commits into
masterfrom
chore/net9-net10-targets-v16

Conversation

@jeremydmiller
Copy link
Copy Markdown
Member

@jeremydmiller jeremydmiller commented May 29, 2026

Target .NET 9 / .NET 10 and bump to 16.0.0

Closes #427

What changed

  • Dropped every target framework below .NET 9 across the solution. All multi-targeted projects move from net8.0;net9.0;net10.0 to net9.0;net10.0.
  • Published nugets now target net9.0;net10.0 and are bumped to 16.0.0:
    • Lamar
    • Lamar.Microsoft.DependencyInjection
  • Removed the now-dead net6.0 / net8.0 conditional <ItemGroup> package references in Lamar, Lamar.AspNetCoreTests, and Lamar.AspNetCoreTests.Integration.
  • CI workflows (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 Release0 errors (pre-existing analyzer warnings only), builds on both net9.0 and net10.0.
  • dotnet pack produces Lamar.16.0.0.nupkg and Lamar.Microsoft.DependencyInjection.16.0.0.nupkg, each containing lib/net9.0 and lib/net10.0.

⚠️ Lamar.Diagnostics NOT included — blocked by dependency conflict

Lamar.Diagnostics could not be retargeted/published in this PR. It depends on the legacy Oakton 6.3.0 and JasperFx.CodeGeneration.Commands 3.4.0 packages, whose transitive constraints are mutually incompatible with the .NET 10 stack that Lamar now pulls in via JasperFx 1.10.1:

  • Oakton 6.3.0Microsoft.Extensions.Hosting (>= 6.0.0 && < 10.0.0)
  • LamarJasperFx 1.10.1Microsoft.Extensions.Hosting (>= 10.0.0) ← irreconcilable
  • (and similarly JasperFx.RuntimeCompiler 3.4.0 caps Logging.Abstractions < 9.0.0)

Publishing Lamar.Diagnostics at 16.0.0 requires migrating it off Oakton / JasperFx.CodeGeneration.Commands onto the unified JasperFx 1.x package — a code change that should be done deliberately as a follow-up.

🤖 Generated with Claude Code

jeremydmiller and others added 2 commits May 28, 2026 20:36
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>
@jeremydmiller jeremydmiller force-pushed the chore/net9-net10-targets-v16 branch from 3aa41ea to f86d503 Compare May 29, 2026 02:18
@jeremydmiller jeremydmiller merged commit 1470edb into master May 29, 2026
2 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.

Upgrade to .NET 10

1 participant