Repository navigation
fix(generator): keep the analyzers loadable in Visual Studio - #2309
Merged
Merged
Conversation
- Drop SourceLink from the Roslyn component projects. It pulls System.IO.Hashing, which floored System.Memory at assembly version 4.0.2.0 for the whole restore graph. - Visual Studio's .NET Framework compiler host binds System.Memory only up to 4.0.1.2, so the generator threw FileNotFoundException on load and the build reported CS8784 with no generated clients. Refit.Analyzers had the same reference, silencing every RF diagnostic there too. - Command-line builds hid it: the .NET compiler host resolves the facade from the shared framework whatever version is asked for. - Add PackagedAnalyzerReferenceTests, which reads each shipped assembly's metadata and fails on a reference the compiler host cannot supply. Fixes #2308
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2309 +/- ##
=======================================
Coverage 99.91% 99.91%
=======================================
Files 192 192
Lines 10027 10027
Branches 1924 1924
=======================================
Hits 10018 10018
Partials 9 9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ChrisPulman
approved these changes
Aug 18, 2026
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.



What kind of change does this PR introduce?
Bug fix.
What is the new behavior?
The shipped generator, analyzers and code fixes load in Visual Studio again.
Microsoft.Build.Tasks.Git->System.IO.Hashing, which floorsSystem.Memoryat 4.6.3 for the whole restore graph. Nothing else in those projects raised it, so removing SourceLink drops the compile-time reference back to assembly version 4.0.1.2 - the version the .NET Framework compiler host binds.PackagedAnalyzerReferenceTestsguards the reference set. It reads each shipped assembly's metadata and fails on anything the compiler host cannot supply: a reference must benetstandard, aMicrosoft.CodeAnalysis*at the versionrefit.propsdeclares, or a listed facade at its exact version.ProjectReferencetoRefit.CodeFixes.Roslyn48, whose output the test project otherwise never produced.AnalyzerPackagingTestsmoved itsRefit.csprojparsing and repository walking into a sharedRefitPackageLayoutrather than duplicate them.What is the current behavior?
The generator fails to load inside Visual Studio and emits no clients.
InterfaceStubGeneratorV2.dllandRefit.Analyzers.dllreferenceSystem.Memory, Version=4.0.2.0. Visual Studio's compiler host runs on .NET Framework and its binding redirects stop at 4.0.1.2, so loading throwsFileNotFoundExceptionand the compiler reports CS8784.Closes #2308
What might this PR break?
None for consumers.
Checklist
mainbranchAdditional information
Verified against a real
dotnet pack -c Releaseartifact, not just the bin folder:InterfaceStubGeneratorV2.dllSystem.Memory, Version=4.0.2.04.0.1.2Refit.Analyzers.dllSystem.Memory, Version=4.0.2.04.0.1.2Refit.CodeFixes.dllPinning
System.Memorywhile keeping SourceLink is not an option:System.IO.Hashing10.0.11 requires>= 4.6.3, so restore fails with NU1605.