fix(generator): ship a single Roslyn analyzer slot - #2305
Merged
Conversation
- Drop the Roslyn 5.0 generator, analyzer and code fix projects so the package ships one analyzers/dotnet/roslyn4.8/cs slot. - Only the .NET SDK narrows a multi-slot package to one folder. A legacy non-SDK .csproj never runs ResolvePackageAssets, so it received both slots, ran both generators and failed to build on duplicate types. - Both builds emitted byte-identical source; the only version-specific code was collection expressions standing in for array builders. - Fail the build with REFIT001 when the compiler predates the shipped slot, which NuGet otherwise drops silently, leaving no generated clients and no explanation. - Document the build-time requirements in the README, whose SDK Requirements heading had been empty since v8.0.0. Closes #2304.
- Move all 21 stale pins to their newest release within their own major band. The Roslyn toolchain stays pinned, since its version sets the minimum compiler consumers need. - ReactiveUI.Primitives 7.0.0 -> 7.1.1 raises the runtime dependency the shipped package resolves. - Rewrite a string.Concat as interpolation and hoist a loop variable into its for header, both newly reported by the analyzer bump. - Suppress SST2461 on the DynamicallyAccessedMemberTypes polyfill, which mirrors a BCL enum whose bit 1 has no standalone member. - Disable SST1534, which reverses SST1525 and RCS1111. Braces on switch sections are the house style, and RCS1031 is already off for the same reason.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2305 +/- ##
==========================================
- Coverage 99.91% 99.91% -0.01%
==========================================
Files 192 192
Lines 10029 10027 -2
Branches 1924 1924
==========================================
- Hits 10020 10018 -2
Partials 9 9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
- Replace .editorconfig with the ReactiveUI copy, keeping Refit's file_header_template so source files keep their own licence header. - Keep RS0016 and RS0017 at error. They enforce the PublicAPI baselines under src/*/PublicAPI, which ReactiveUI does not track and the copy would have dropped. - Order documentation tags canonically, which SST1666 now requires. - Order the negative-valued enum fixtures ascending for SST1222. Member order carries no semantics, so the fixtures behave as before.
|
ChrisPulman
approved these changes
Aug 14, 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, plus a dependency update and a build configuration change.
What is the new behavior?
The package ships a single
analyzers/dotnet/roslyn4.8/csslot, so exactly one source generator runs on every project style.System.Collections.Immutableversion the 4.8 leg resolves rather than by any compiler capability.REFIT001, naming the Roslyn version it found and pointing at either upgrading the build tools orDisableRefitSourceGeneratorplusRefit.Reflection.PackageReference. TheSDK Requirementsheading had been empty since v8.0.0, and the minimum moved to Roslyn 4.8 in v12 without a note anywhere.REFIT001floor to each other, so moving one without the other fails rather than shipping a package whose guard disagrees with its contents.All 21 stale non-Roslyn dependencies move to their newest release within their own major band. The Roslyn toolchain stays pinned, since its version is what sets the minimum compiler consumers need.
The repository adopts the shared ReactiveUI
.editorconfig.file_header_templateis kept, so source files keep the ReactiveUI and Contributors licence header rather than the .NET Foundation one.RS0016andRS0017stay aterror. They enforce thePublicAPIbaselines undersrc/*/PublicAPI, which the shared config does not carry because ReactiveUI does not track public API that way.noneand eighteen arrive aterror. Satisfying the new ones reordered documentation tags into their canonical order and reordered four negative-valued enum fixtures into ascending order.What is the current behavior?
Closes #2304.
roslyn4.8androslyn5.0. Only the .NET SDK narrows that to one folder -ResolvePackageAssetspicks the highest slot at or below$(CompilerApiVersion)..csprojnever runs that task, so it receives both slots, runs both generators, and fails to build on duplicate attributes and duplicate members. Upgrading Visual Studio cannot fix it, because no version of MSBuild runs that task for a non-SDK project.refit.targetsused to handle it; the target was dropped during a reformat in refactor: align Refit with rxui coding standards and modernize #2149 and the file removed in feat: generate request construction to avoid reflection pipeline #2150.What might this PR break?
ReactiveUI.Primitivesmoves from 7.0.0 to 7.1.1, raising the runtime dependency version the shipped package resolves. In-major, so no API change.REFIT001. The effective minimum is unchanged - v12 already shipped no slot below 4.8.InterfaceStubGeneratorV3assembly no longer exists in the package. Nothing referenced it by name; the generatedGeneratedCodeAttributenow always readsInterfaceStubGeneratorV2.Checklist
mainbranchAdditional information
Most of the diff is deletions, mechanical repointing, and tool-driven reordering. The hand-written parts worth review are:
src/Refit/targets/refit.props- theREFIT001target. It has to be a target rather than a plain condition, because$(CompilerApiVersion)is set by the Roslyn targets long after this.propsfile is evaluated. Every guard is fail-open: an unset, non-C#, non-Roslyn or malformed value skips the check rather than breaking a build we do not understand.src/tests/Refit.GeneratorTests/AnalyzerPackagingTests.cs- the three packaging invariants.src/Refit/Refit.csproj- the comment on the packaging block explaining why a second slot must not be added back..editorconfig- the preservedfile_header_template, and theRS0016/RS0017entries kept alongside thePASblock.Everything else in the third commit is a documentation-tag reorder produced by a syntax rewriter. No documentation text changed, only tag order.
The second commit carries three code changes that are fallout from the dependency bump, not from the fix: an interpolated string, a loop variable moved into its
forheader, and a suppression on theDynamicallyAccessedMemberTypespolyfill, which mirrors a BCL enum whose bit 1 has no standalone member - naming one would diverge from the type it stands in for.