Skip to content

fix(deps): bump SourceGenerator.Foundations to 2.0.17 - #436

Merged
Tim-Maes merged 1 commit into
Tim-Maes:masterfrom
JesseKlaasse:fix/sgf-2.0.17
Oct 5, 2026
Merged

Tim-Maes merged 1 commit into
Tim-Maes:masterfrom
JesseKlaasse:fix/sgf-2.0.17

Conversation

@JesseKlaasse

Copy link
Copy Markdown
Contributor

Problem

On a machine that builds more than one solution, [GenerateDtos] can fail to run at all:

warning CS8784: Generator 'GenerateDtosGeneratorHoist' failed to initialize. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'FileNotFoundException' with message 'Could not load file or assembly 'SourceGenerator.Foundations.Contracts, Version=2.0.16.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.'
error CS0246: The type or namespace name 'CreateOrderRequest' could not be found (are you missing a using directive or an assembly reference?)

The trigger is the compiler server (VBCSCompiler), which keeps every analyzer it ever loaded. Once it holds a Facet of 6.6.8 or older (no SourceGenerator.Foundations, e.g. from another solution), the SGF resolver in 6.6.9+ sees the name "Facet" already registered. It matched on simple name only, so it never unpacks Facet's embedded assemblies, including SourceGenerator.Foundations.Contracts.

The failure depends on load order: new Facet first, then old, is clean. It also stays until the compiler server restarts, and CI never sees it because every build starts a fresh process. Projects that don't use [GenerateDtos] only get the warning; projects that do also lose the generated DTOs.

Fix

SourceGenerator.Foundations 2.0.17 resolves embedded assemblies by name and version, and its resource fallback now works (ByronMayne/SourceGenerator.Foundations#74, #76, #77). This PR bumps both SGF packages in one change, so the hoist compiled into Facet.dll and the embedded Contracts always come from the same release. It also adds a changelog entry.

Supersedes #434 and #435: Dependabot's version bumps, one package each.

Verification

Locally, .NET SDK 10.0.300, Release, as in CI:

  • Build: same warning profile as master, no new warnings.
  • Facet.Tests: 985/985.
  • Facet.dll embeds SourceGenerator.Foundations.Contracts, Version=2.0.17.0 and contains the new resolver.

End-to-end, each row uses a dedicated compiler server (-p:SharedCompilationId=…), with a project on Facet 6.6.8 built first and then a project that uses [GenerateDtos]:

Second project Result
Facet 6.6.13 (SGF 2.0.16) CS8784 + CS0246, build fails
Facet built from this branch (SGF 2.0.17) 0 warnings, 0 errors
Same, opposite order 0 warnings, 0 errors

🤖 Generated with Claude Code

SGF up to 2.0.16 registers loaded assemblies by simple name. A compiler
server keeps every analyzer it ever loaded, so once it held a Facet of
6.6.8 or older (no SGF), the name "Facet" was taken: 6.6.9+ never
unpacked its embedded assemblies, GenerateDtosGeneratorHoist failed with
CS8784, and the DTOs were not generated (CS0246 where they are used).

2.0.17 resolves by name and version (SGF#74, Tim-Maes#76, Tim-Maes#77). Both packages
move together: the hoist compiled into Facet.dll and the embedded
Contracts come from the same release.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Tim-Maes
Tim-Maes merged commit 20a0aa3 into Tim-Maes:master Oct 5, 2026
3 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.

2 participants