Skip to content

Annotate remaining AOT pillar tail in JasperFx (74 → 0 warnings)#260

Merged
jeremydmiller merged 1 commit into
mainfrom
feature/aot-pillar-tail-cleanup
May 13, 2026
Merged

Annotate remaining AOT pillar tail in JasperFx (74 → 0 warnings)#260
jeremydmiller merged 1 commit into
mainfrom
feature/aot-pillar-tail-cleanup

Conversation

@jeremydmiller

Copy link
Copy Markdown
Member

Final AOT-pillar cleanup pass for JasperFx (#213). After PRs #256#259 closed the four largest slices (ServiceContainer, CodeGeneration/Services, Core/IoC, Core/Reflection), 74 warnings per TFM remained across the long tail. This PR brings the JasperFx project to 0 IL warnings with IsAotCompatible=true enabled.

Effect

Before:  JasperFx total per TFM  74 warnings
After:   JasperFx total per TFM   0 warnings

Cumulative since #213 flag-flip:  236 → 0  (all addressed)

Areas annotated

The tail spans the parts of JasperFx that weren't large enough to deserve dedicated per-area issues but still needed annotation work to close out the pillar:

Area Members touched
Core/TypeScanning AssemblyFinder.FindAssemblies (×3), IJasperFxAssemblyLoadContext + impl, AssemblyTypes(Assembly), TypeRepository.ForAssembly, TypeRepository.FindTypes (×3), TypeQuery.Find
Core/IoC AssemblyScanner.Start + assembly-scan APIs; matching IAssemblyScanner.AssembliesFrom* annotations
Hosting + entry JasperFxOptions.HasReferenceToJasperFxTool, DetermineCallingAssembly, establishApplicationAssembly, ReadHostEnvironment; JasperFxServiceCollectionExtensions.AddJasperFx + CritterStackDefaults; EnvironmentCheckExtensions (5 overloads)
CodeGeneration/Snapshots/SnapshotGate Read / Write annotated [RequiresUnreferencedCode] + [RequiresDynamicCode] for STJ usage
CodeGeneration/Frames/MethodCall MethodCall(Type, string) ctor annotated, correctedReturnType / returnsValueTask suppress for well-known Task types
CodeGeneration/GeneratedAssembly + GeneratedType AddType, AttachAssembly, CompiledType property, InheritsFrom<T> / <Type>, Implements<T> / (Type), FindType, ApplySetterValues
CodeGeneration/Model Setter.SetInitialValue, Variable.VariablesForProperties<T>, Variable.DefaultArgName
CodeGeneration/Expressions LambdaDefinition.Compile<TFunc>
CodeGeneration/Services ServiceCollectionServerVariableSource.Matches suppress (IVariableSource contract doesn't carry DAM)
Descriptors OptionsDescription ctor / For() / readProperties; DatabaseDescriptor ctors
CommandLine/Descriptions ISystemPart.WriteToConsole annotated on interface; overrides in ConfigurationPreview, DescribeCommand (×2)
CommandLine CommandFactory.IsJasperFxCommandType DAM, TryRegisterFromGeneratedManifest IL2072 suppress; DescribeCommand.Execute pragma over WriteToConsole async call
Resources ResourcesCommand.ExecuteOnEach suppress IL3050 (Spectre on error-display path)
JasperFxAssemblyAttribute ctor DAM annotation
ServiceContainer CouldResolve(Type) DAM; re-applied IL2067 suppression on findFamily that was lost in the #256 + #257 merge resolution

Note on JasperFx.Events propagation

This PR brings the JasperFx project itself to 0 warnings. The annotations propagate into JasperFx.Events, which now surfaces ~246 warnings per TFM that weren't there before. That deserves its own focused PR + likely an issue under #213 — not included here to keep this review-able.

Verification

  • CoreTests — 407/407 pass on net9.0 + net10.0
  • CommandLineTests — 280/280 pass on net9.0 + net10.0
  • CodegenTests — 366/366 pass on net9.0 + net10.0
  • SmokeTestAot — build clean, exits 0

This (mostly) closes the AOT pillar #213 for JasperFx itself. Events follow-up is queued.

🤖 Generated with Claude Code

Final AOT-pillar cleanup pass for JasperFx (#213). After PRs
#256#259 closed the four largest slices (ServiceContainer,
CodeGeneration/Services, Core/IoC, Core/Reflection), 74 warnings per
TFM remained across the long tail. This PR brings the JasperFx project
to **0 IL warnings** with `IsAotCompatible=true` enabled.

Annotated reflective entry points

  AssemblyFinder.FindAssemblies (3 overloads)   — [RUC]
  IJasperFxAssemblyLoadContext + impl            — [RUC]
  AssemblyTypes(Assembly)                        — [RUC]
  TypeRepository.ForAssembly / FindTypes (3x)    — [RUC]
  TypeQuery.Find(IEnumerable<Assembly>)          — [RUC]
  AssemblyScanner.Start + assembly-scan APIs     — [RUC] (matches
                                                   IAssemblyScanner)
  IAssemblyScanner.AssembliesFrom*               — [RUC] on interface
  CommandLineHostingExtensions.ApplyJasperFx*    — already RUC; cascades
  JasperFxOptions.HasReferenceToJasperFxTool     — [RUC]
  JasperFxOptions.DetermineCallingAssembly       — [RUC]
  JasperFxOptions.establishApplicationAssembly   — [RUC]
  JasperFxOptions.ReadHostEnvironment            — [RUC]
  JasperFxServiceCollectionExtensions.AddJasperFx + CritterStackDefaults
                                                  — [RUC]
  EnvironmentCheckExtensions (5 overloads)       — [RUC]
  SnapshotGate.Read / SnapshotGate.Write         — [RUC] + [RDC]
                                                   (STJ JsonSerializer)
  ISystemPart.WriteToConsole                     — [RUC] on interface
  DescribeCommand.Execute                        — suppress + #pragma
                                                   on async-state-machine
                                                   WriteToConsole call
  CodeGeneration/Frames/MethodCall(Type,string)  — [RUC] + [DAM(PublicMethods)]
  CodeGeneration/Frames/MethodCall.correctedReturnType — suppress IL2067
                                                   (well-known Task types)
  CodeGeneration/Frames/MethodCall.returnsValueTask — suppress IL2072
  CodeGeneration/GeneratedAssembly.AddType       — [DAM(PublicCtors|PublicMethods|NonPublicMethods)]
  CodeGeneration/GeneratedAssembly.AttachAssembly — [RUC]
  CodeGeneration/GeneratedType.CompiledType property — [DAM(PublicCtors)]
  CodeGeneration/GeneratedType.InheritsFrom<T>/<Type> — [DAM(PublicCtors|Methods)]
  CodeGeneration/GeneratedType.Implements<T>/(Type) — [DAM(PublicMethods)]
  CodeGeneration/GeneratedType.FindType + ApplySetterValues — [RUC]/suppress
  CodeGeneration/Model/Setter.SetInitialValue    — [RUC]
  CodeGeneration/Model/Variable.VariablesForProperties<T> — [DAM(PublicProperties)]
  CodeGeneration/Model/Variable.DefaultArgName   — suppress (cosmetic)
  CodeGeneration/Expressions/LambdaDefinition.Compile<TFunc> — [RUC]
  ServiceCollectionServerVariableSource.Matches  — suppress (IVariableSource
                                                   contract doesn't carry DAM)
  CodeGeneration/CodeGenerationExtensions.BuildExportedTypeIndex — suppress
  CodeGeneration/Services findFamily             — re-applied IL2067 suppression
                                                   (was lost in #256 + #257 merge)
  ServiceContainer.CouldResolve(Type)            — [DAM(PublicCtors)]
  ServiceContainer.findFamily                    — re-applied IL2067 suppression
                                                   (was lost in PR #256 + #257
                                                   merge resolution)
  Descriptors/OptionsDescription                 — [RUC] on ctor / For() / readProperties
  Descriptors/DatabaseDescriptor ctors           — [RUC] (inherits OptionsDescription)
  CommandLine/Descriptions/ConfigurationPreview.WriteToConsole — [RUC]
  CommandLine/Descriptions/DescribeCommand.WriteToConsole (×2 overrides) — [RUC]
  CommandLine/CommandFactory.IsJasperFxCommandType — [DAM(Interfaces)]
  CommandLine/CommandFactory.TryRegisterFromGeneratedManifest — IL2072 suppress added
  Resources/ResourcesCommand.ExecuteOnEach        — suppress IL3050
                                                   (Spectre WriteException
                                                   on error-display path)
  JasperFxAssemblyAttribute ctor                 — [DAM(PublicCtors|NonPublicCtors)]

Effect on the punch list

  Before:  JasperFx total per TFM  74 warnings
  After:   JasperFx total per TFM   0 warnings

  Cumulative since #213 flag-flip (PR #247):
    236 (initial fallout) → 0  (all addressed)

Note on JasperFx.Events

  The propagation of new annotations into the JasperFx.Events compilation
  surfaces ~246 warnings per TFM that aren't addressed here. That deserves
  its own focused PR + likely an issue under #213.

Verification

  CoreTests       407/407 pass on net9.0 + net10.0
  CommandLineTests 280/280 pass on net9.0 + net10.0
  CodegenTests    366/366 pass on net9.0 + net10.0
  SmokeTestAot    build clean, exits 0

Closes (most) the AOT pillar #213 for JasperFx itself. Events follow-up
deferred to a separate PR.
@jeremydmiller jeremydmiller merged commit 9c60eeb into main May 13, 2026
1 check passed
thechucklingatom pushed a commit to thechucklingatom/jasperfx that referenced this pull request May 19, 2026
Carries the AOT pillar tail cleanup (JasperFx#213) that landed in JasperFx#260,
closing the remaining 74 IL warnings per TFM in JasperFx itself. With
this release, JasperFx + JasperFx.Events compile clean under
IsAotCompatible=true — downstream consumers (Marten 9, Wolverine 6,
Polecat 4, Weasel 9) can adopt the new alphas and see the propagated
annotations on JasperFx surfaces (TypeScanning, Hosting, Snapshots,
CodeGeneration model + frames, OptionsDescription, etc.).

JasperFx.Events itself didn't get direct changes, but the lockstep bump
ensures consumers picking up alpha.12 also get the matching Events alpha.
Per-area annotation work in JasperFx.Events deserves its own follow-up
PR (~246 cascaded warnings as of JasperFx#260); will be filed as a tracking
issue once this release ships.

NugetPush is SkipDuplicate; other packages (RuntimeCompiler,
SourceGeneration, Events.SourceGenerator) keep their current versions —
nothing changed in those projects this cycle.
thechucklingatom pushed a commit to thechucklingatom/jasperfx that referenced this pull request May 19, 2026
…lice 1/4)

First of four slices that mirror the JasperFx-side cleanup pattern (JasperFx#252-JasperFx#255
+ JasperFx#260) on the JasperFx.Events side, tracked by JasperFx#262.

The aggregator graph (AggregateApplication and friends) reflects TAggregate /
TProjection to discover Create/Apply/ShouldDelete handlers, builds delegates
via Expression.Call + FastExpressionCompiler.CompileFast, and threads event
types via IEvent<T>.MakeGenericType. Both aggregate and event types are
preserved at the registered projection boundary (caller-side generic
parameters that trimming sees). AOT consumers should rely on the
source-generated evolver from JasperFx.Events.SourceGenerator per the AOT
publishing guide.

Apply class-level [UnconditionalSuppressMessage] with justifications:
- Aggregation/AggregateApplication (primary partial — covers Register/
  Creating/Applies/ShouldDelete): IL2026/IL2070/IL2072/IL2075/IL2077/
  IL2087/IL2090/IL3050
- Aggregation/JasperFxAggregationProjectionBase: IL2065/IL2067/IL2070/
  IL2072/IL2075/IL2090
- Aggregation/JasperFxMultiStreamProjectionBase: IL2026/IL2087
- Aggregation/CreateMethodCollection: IL2070/IL2072/IL3050
- Aggregation/ApplyMethodCollection: IL3050
- Aggregation/AggregateVersioning<T> + <T,TQuerySession>: IL2026/IL2090

240 → 130 unique IL warnings (-110) in JasperFx.Events.csproj.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant