Repository navigation
Fix CS0436 on Release builds: host wrapper attributes in Reactor.Wrappers.Abstractions - #602
Merged
Alexandre Zollinger Chohfi (azchohfi) merged 2 commits intoJun 17, 2026
Conversation
…ions The wrapper generator emitted its authoring marker attributes into every compilation via RegisterPostInitializationOutput. Because src/Reactor runs the generator, the internal copies landed in Reactor.dll and leaked through InternalsVisibleTo into Reactor.AppTests.Host (which also runs the generator), where the locally generated copy collided with the imported one (CS0436). This was a harmless warning in Debug but failed ADO Release builds, which pass -p:TreatWarningsAsErrors=true. Move the 13 authoring attributes into a dedicated assembly, src/Reactor.Wrappers.Abstractions (public types, IsPackable=false), referenced by every consumer; the generator no longer emits them and binds them by metadata name. With a single definition there is no duplicate to collide. - Reactor references it PrivateAssets="all" and bundles the DLL into the package lib/ via a BuildOutputInPackage target (no phantom NuGet dependency). - In-repo consumers (AppTests.Host, WctControls, Reactor.Tests) reference it directly, since PrivateAssets blocks transitive flow. - Mark DescriptorOnlyProofControl partial (a latent CsWinRT1028 unmasked once the CS0436 compile failure cleared). - Update spec 058 (the old "IVT collision - NOT A PROBLEM" claim) + add a regression test that the generator no longer emits the attribute. Fixes #601 Co-authored-by: Copilot <[email protected]>
Alexandre Zollinger Chohfi (azchohfi)
requested a review
from Chris Anderson (codemonkeychris)
as a code owner
June 17, 2026 23:10
…eferences The CI Pack step runs `dotnet pack --no-build`. The _BundleWrappersAbstractions target used DependsOnTargets="ResolveReferences", which forced reference resolution at pack time and invoked the Build target on the analyzer project-references under NoBuild -> NETSDK1085. The abstractions DLL is a runtime reference, so the (already completed) build copied it into $(TargetDir); read it directly from there instead. Works under a NoBuild pack and still bundles the DLL into lib/ exactly once (verified). Co-authored-by: Copilot <[email protected]>
Alexandre Zollinger Chohfi (azchohfi)
deleted the
alzollin/wrappers-abstractions-cs0436
branch
June 17, 2026 23:39
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #601.
Problem
ADO Release builds fail with CS0436 in
Reactor.AppTests.Host(the pipelines pass-p:TreatWarningsAsErrors=true). The wrapper generator emitted its authoring marker attributes into every compilation viaRegisterPostInitializationOutput; becausesrc/Reactoralso runs the generator, theinternalcopies landed inReactor.dlland leaked throughInternalsVisibleTointoReactor.AppTests.Host(which also runs the generator), colliding with the locally generated copy. Harmless warning in Debug, fatal under warnings-as-errors.Fix
Host the 13 authoring attributes (
[GenerateReactorWrapper],[WrapControlled], …) in a dedicated assemblysrc/Reactor.Wrappers.Abstractions(public types,IsPackable=false) referenced by every consumer; the generator no longer emits them and binds them by metadata name. One definition → nothing to collide.Reactor.csprojreferences itPrivateAssets="all"and bundles the DLL into the packagelib/via a_BundleWrappersAbstractions(BuildOutputInPackage) target — so no phantom NuGet dependency, and the package stays self-contained (same pattern the repo already uses to bundle its analyzer DLLs into Reactor).AppTests.Host,WctControls,Reactor.Tests) reference the project directly —PrivateAssetsblocks transitive flow (verified: without it,WctControlsfails with 57× CS0246).AttributeSourceconst + post-init registration from the generator.DescriptorOnlyProofControlpartial— a latentCsWinRT1028that the CS0436 compile failure had been masking.Verification
Reactor.AppTests.HostRelease/x64 with-p:TreatWarningsAsErrors=true: 0 warnings, 0 errors (was 13× CS0436).WctControls(non-IVT consumer) Release/warnings-as-errors: clean.Generator_DoesNotEmit_TheAuthoringAttributeand the reflection-basedDescriptorSilentDropGuardTests.dotnet pack src/Reactor:Reactor.Wrappers.Abstractions.dlllands inlib/net10.0-windows10.0.22621/exactly once, and the.nuspechas noReactor.Wrappers.Abstractionsdependency.