Skip to content

Fix global type names in ILAssembler custom attributes - #137786

Merged
jkoritzinsky merged 1 commit into
dotnet:mainfrom
jkoritzinsky:dev/jkoritzinsky/ilassembler-mangled-proxy-encoding
Nov 18, 2026
Merged

jkoritzinsky merged 1 commit into
dotnet:mainfrom
jkoritzinsky:dev/jkoritzinsky/ilassembler-mangled-proxy-encoding

Conversation

@jkoritzinsky

Copy link
Copy Markdown
Member

Managed ILAssembler writes a leading dot when serializing global-namespace types in typed custom attributes. This causes Roslyn's C# and VB debugger proxy tests to fail with TypeLoadException for .<>Mangled.

Only add a namespace separator when the namespace is nonempty for type definitions and references. Add regression coverage for global, namespaced, nested, and external types. The fixed net472 package emits the same proxy type blob as native ilasm.

Validation

  • ./.dotnet/dotnet.exe test src/tools/ilasm/ilasm.slnx --logger 'trx;LogFilePrefix=after' - passed: 11,253 tests, 3 skipped.
  • ./.dotnet/dotnet.exe test src/tools/ilasm/tests/ILAssembler.Tests --filter 'FullyQualifiedName~CustomAttribute_DebuggerTypeProxy_EmitsReflectionTypeName|FullyQualifiedName~CustomAttribute_VerbalTypeArgumentFromUnversionedAssemblyReference' - passed 10 tests each on net10.0 and net12.0. Six failed before the fix on net10.0.
  • Packed the net472, net10.0 and net12.0 library; a net472 consumer confirmed the original fixture loads with the locally fixed package. The Roslyn session reports both previously failing tests pass with that package.

Note

This description was generated with GitHub Copilot.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
11 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@jkoritzinsky
jkoritzinsky requested a review from jkotas November 17, 2026 23:29
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @dotnet/jit-contrib
See info in area-owners.md if you want to be subscribed.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The global-namespace type-name serialization fix has no active review issues.

No open issues 🎉

What changed in this PR

Fixes managed ILAssembler’s serialization of global-namespace type names in custom attributes, preventing erroneous leading dots that cause debugger proxy type-loading failures.

Changes:

  • Adds namespace separators only for nonempty namespaces in type definitions and references.
  • Adds regression coverage for global, namespaced, and nested types.
  • Extends external-type coverage across assembly public-key formats.
File Description
src/​tools/​ilasm/​tests/​ILAssembler.Tests/​CustomAttributeTests.cs Tests reflection type names and external assembly-qualified names.
src/​tools/​ilasm/​src/​ILAssembler/​EntityRegistry.cs Omits namespace separators when the namespace is empty.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are recorded for the global-namespace type-name serialization fix.

No open issues 🎉

Review effort: Balanced

@jkoritzinsky
jkoritzinsky enabled auto-merge (squash) November 18, 2026 02:18
@jkoritzinsky
jkoritzinsky merged commit 2db0a1f into dotnet:main Nov 18, 2026
59 of 61 checks passed
@github-project-automation github-project-automation Bot moved this to Done in AppModel Nov 18, 2026
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants