Skip to content

Say so when a pinned generator loses to a bundled copy and none reaches the compiler (#1138) - #1139

Merged
jeremydmiller merged 1 commit into
mainfrom
generator-runtime-version-1138
Nov 8, 2026
Merged

jeremydmiller merged 1 commit into
mainfrom
generator-runtime-version-1138

Conversation

@jeremydmiller

Copy link
Copy Markdown
Member

What was wrong

It was not the generator. A JasperFx.Events.SourceGenerator at another version than the JasperFx.Events runtime generates normally on its own: 2.100.0 against a 2.100.1 runtime emits the evolver and the marker.

The cause, reproduced with Polecat 5.49.0 and a direct JasperFx.Events.SourceGenerator 2.100.0 (Wolverine's PolecatTests shape):

  1. The SDK drops the pinned copy. Its package file conflict resolution (_HandlePackageFileConflicts) sees two analyzers named JasperFx.Events.SourceGenerator.dll and keeps only the higher assembly version. -v:diag shows it: "Choosing 'Analyzer:polecat/5.49.0/…' because AssemblyVersion '2.100.1.0' is greater than '2.100.0.0'".
  2. A project target removes the bundled copy. Wolverine's DropDuplicateBundledEventSourceGenerator drops the copy under /polecat/. It was written for the equal-version case, where both copies survive to that point.
  3. Nothing reaches the compiler. With the bundled copy gone there is no generator left: no evolvers, no marker, no warning. The first sign is No source-generated dispatcher found at run time.

At equal versions the SDK cannot pick a winner, both copies survive, and the project target or JasperFx's own dedupe (#891) leaves one. That is why pinning everything to 2.100.1 fixed wolverine#5394.

What changed

  • JFXEVT1138, a build-time warning in buildTransitive/JasperFx.Events.targets.
    • When it fires: the SDK dropped a copy of the generator (it is in _ConflictPackageFiles) and no copy reached the compiler.
    • What it names: the dropped copy, and the version of the JasperFx.Events runtime.
    • What it suggests: pin the generator to that version, or remove the target that drops the bundled copy.
    • When it runs: AfterTargets="CoreCompile", so it reads exactly what the compiler was given, whatever order the BeforeTargets hooks ran in.
    • Kept quiet otherwise: a version difference on its own stays silent, because the higher copy runs.
    • Opt-out: JasperFxEventsReportLostSourceGenerator=false.
  • The run-time message for a project with no marker (the "left no trace" one) now names a generator pinned to another version than the runtime as a cause, with the runtime's version and JFXEVT1138.

How it was tested

  • Smoke test: SmokeTestBuildTargets has four new arrangements, 10 in all, and passes. The refused answer is a_generator_at_another_version_never_produces_nothing_without_saying_so. The other three are a dropped lower copy with the higher copy compiled, no generator anywhere, and the opt-out.
  • Unit test: SourceGeneratorMarkerTests.an_unconfirmed_assembly_names_a_generator_pinned_to_another_version_than_the_runtime. All 1,832 EventTests pass.
  • Real packages: checked by hand against Polecat 5.49.0 with generator 2.100.0 or 2.100.1, with and without Wolverine's drop target. JFXEVT1138 appears only in the 2.100.0 + drop case, the one that generated nothing.

Not done

Fixes #1138

🤖 Generated with Claude Code

…es the compiler (#1138)

The .NET SDK's package file conflict resolution keeps only the higher assembly
version of two analyzers with one file name. A JasperFx.Events.SourceGenerator
pinned at 2.100.0 beside Polecat 5.49.0 (bundling 2.100.1) was dropped there,
and a project target that removes the store's bundled copy then removed the only
copy left: nothing generated and the build passed.

JasperFx.Events' buildTransitive targets now warn JFXEVT1138 after CoreCompile
when the SDK dropped a copy of the generator and no copy reached the compiler,
naming the dropped copy and the runtime's version. The run-time "left no trace"
message names the pin as a cause too.

Fixes #1138

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jeremydmiller
jeremydmiller force-pushed the generator-runtime-version-1138 branch from c58062b to 190c3f2 Compare November 8, 2026 16:50
@jeremydmiller
jeremydmiller merged commit f3432a4 into main Nov 8, 2026
1 check 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.

A JasperFx.Events.SourceGenerator pinned to another version than the JasperFx.Events runtime silently generates nothing

1 participant