Skip to content

fix: keep a component's own internals grants through the merge, and r… - #38

Merged
kieronlanning merged 1 commit into
mainfrom
release/1.0.0
Oct 6, 2026
Merged

kieronlanning merged 1 commit into
mainfrom
release/1.0.0

Conversation

@kieronlanning

Copy link
Copy Markdown
Contributor

…elease 1.0.0

A code-fix component that reads its generator's internal diagnostic identity compiled, passed its in-repo tests, and then threw FieldAccessException in the compiler host. The merge tool's StripInternalsGrants removed every assembly-level InternalsVisibleTo from the merged artifact, so the merged generator the IDE loads no longer granted access to the merged code fix. In-repo tests bind the unmerged bin output, which keeps the grant, so nothing caught it.

Verified on this repository's own ComponentClosureFixture - built for exactly this scenario, with a non-const internal field so the assembly reference survives:

Fixture.Generator.dll (bin, unmerged) 116 grants, including Fixture.Generator.CodeFixers
Fixture.Generator.dll (merged analyzer) 0

The grants are now stripped by provenance. The tool already receives the framework assembly separately, so it strips only framework-authored grants and keeps the ones the component wrote. That preserves the documented intent - a shipped analyzer is not the framework's assembly, and a leftover framework grant would let the framework's own test assemblies reach the internalized framework types - without breaking the supported component-to-component arrangement. End to end on the fixture the merged artifact goes from 0 grants to 24 including Fixture.Generator.CodeFixers, with 0 framework grants.

CollectInternalsGrants reads an assembly's grants, Apply takes them as frameworkInternalsGrants, and omitting the argument strips everything as before, so the existing behaviour and its test are unchanged.

The namespace workarounds this repository needed are gone: Purview.BuildSdk 1.0.3 no longer strips Roslyn component names from RootNamespace, so SourceGeneratorFramework.Analyzers, .Generators, .CodeFixers and .ExampleGenerator.CodeFixers - and their test projects - build clean with no NamespaceRemoveSuffix opt-outs at all. That is what confirms the SDK change was the right fix rather than a workaround moved upstream.

First stable release. Adopts Purview.BuildSdk 1.0.3, up from 1.0.0-prerelease.60.

Tests: 3752 passing, including the closure-fixture build integration tests that previously failed.

…elease 1.0.0

A code-fix component that reads its generator's internal diagnostic identity compiled, passed its
in-repo tests, and then threw FieldAccessException in the compiler host. The merge tool's
StripInternalsGrants removed every assembly-level InternalsVisibleTo from the merged artifact, so the
merged generator the IDE loads no longer granted access to the merged code fix. In-repo tests bind the
unmerged bin output, which keeps the grant, so nothing caught it.

Verified on this repository's own ComponentClosureFixture - built for exactly this scenario, with a
non-const internal field so the assembly reference survives:

  Fixture.Generator.dll (bin, unmerged)      116 grants, including Fixture.Generator.CodeFixers
  Fixture.Generator.dll (merged analyzer)    0

The grants are now stripped by provenance. The tool already receives the framework assembly separately,
so it strips only framework-authored grants and keeps the ones the component wrote. That preserves the
documented intent - a shipped analyzer is not the framework's assembly, and a leftover framework grant
would let the framework's own test assemblies reach the internalized framework types - without breaking
the supported component-to-component arrangement. End to end on the fixture the merged artifact goes
from 0 grants to 24 including Fixture.Generator.CodeFixers, with 0 framework grants.

CollectInternalsGrants reads an assembly's grants, Apply takes them as frameworkInternalsGrants, and
omitting the argument strips everything as before, so the existing behaviour and its test are unchanged.

The namespace workarounds this repository needed are gone: Purview.BuildSdk 1.0.3 no longer strips
Roslyn component names from RootNamespace, so SourceGeneratorFramework.Analyzers, .Generators,
.CodeFixers and .ExampleGenerator.CodeFixers - and their test projects - build clean with no
NamespaceRemoveSuffix opt-outs at all. That is what confirms the SDK change was the right fix rather
than a workaround moved upstream.

First stable release. Adopts Purview.BuildSdk 1.0.3, up from 1.0.0-prerelease.60.

Tests: 3752 passing, including the closure-fixture build integration tests that previously failed.
@kieronlanning
kieronlanning disabled auto-merge October 6, 2026 22:46
@kieronlanning
kieronlanning merged commit 28d5da4 into main Oct 6, 2026
1 check passed
@kieronlanning
kieronlanning deleted the release/1.0.0 branch October 6, 2026 22:46
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.

1 participant