Skip to content

Fix managed ILAsm trailing-dot namespace encoding - #137093

Merged
jkoritzinsky merged 4 commits into
dotnet:mainfrom
jkoritzinsky:dev/jkoritzinsky/ilasm-empty-namespace-compatibility
Nov 10, 2026
Merged

jkoritzinsky merged 4 commits into
dotnet:mainfrom
jkoritzinsky:dev/jkoritzinsky/ilasm-empty-namespace-compatibility

Conversation

@jkoritzinsky

Copy link
Copy Markdown
Member

Preserve native ILAsm's namespace/name encoding for classes declared inside namespaces ending in dots. Managed ILAsm currently emits the entire namespace unchanged; native ILAsm places the final dot at the start of an otherwise unqualified type name. This introduces an extra namespace in the metadata consumed by the C# compiler's EmptyNamespaceNames test.

The fix adjusts type-definition name materialization only, preserving explicitly leading-dot type names. Six compiler public-API regression cases check exact emitted namespace/name pairs, including ., .., ..N, N.M., and N.M...

Validation on Windows:

  • eng\common\dotnet.cmd test src\tools\ilasm\tests\ILAssembler.Tests\ILAssembler.Tests.csproj --filter FullyQualifiedName~Namespace_TrailingDotsArePreservedInTypeName before the fix: 4 failed, 1 passed, demonstrating the regression.
  • eng\common\dotnet.cmd test src\tools\ilasm\tests\ILAssembler.Tests\ILAssembler.Tests.csproj --no-restore after the final fix: 5,792 passed, 3 skipped, 0 failed; rebuilt the assembler and tests.
  • Compared exact metadata namespace/name strings against desktop native ILAsm.
  • git diff --check HEAD~1 HEAD: passed.

The Roslyn suite was not run. A broader build.cmd tools+tools.ilasm invocation was stopped when it began compiling CoreCLR; validation above uses the focused ILAssembler project and its complete unit-test suite.

Note

This pull request description and changes were 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.

@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.

jkoritzinsky and others added 2 commits November 9, 2026 10:16
Compose namespace and class names before applying native-compatible splitting, and correct the leading double-dot corner case. Cover runtime identifiers, Roslyn namespace cases, references, exported types, nested types, and normalized declaration merging.

Co-authored-by: Copilot App <[email protected]>
@jkoritzinsky
jkoritzinsky requested a review from jkotas November 9, 2026 18:47
@jkoritzinsky
jkoritzinsky requested a review from jkotas November 9, 2026 19:43
@jkoritzinsky
jkoritzinsky enabled auto-merge (squash) November 9, 2026 20:11
@jkoritzinsky
jkoritzinsky merged commit 1be34d2 into dotnet:main Nov 10, 2026
61 checks passed
@github-project-automation github-project-automation Bot moved this to Done in AppModel Nov 10, 2026
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 10, 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.

2 participants