Repository navigation
Preserve explicit value-type signatures in managed ILAsm - #137095
Merged
jkoritzinsky merged 3 commits intoNov 7, 2026
Merged
jkoritzinsky merged 3 commits into
jkoritzinsky merged 3 commits into
Conversation
Match native ILAsm by retaining explicit valuetype references, including intentionally malformed long-form primitive signatures. Cover native-integer generic returns and all well-known primitive value-type fields. Co-authored-by: Copilot App <[email protected]>
|
Azure Pipelines: Successfully started running 5 pipeline(s). 10 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @dotnet/jit-contrib |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the change preserving explicit value-type signatures in managed ILAsm.
No open issues 🎉
What changed in this PR
This PR aligns managed ILAsm with native ILAsm by preserving explicit valuetype references, allowing compiler tests to assemble deliberately malformed long-form primitive signatures.
Changes:
- Prevents explicit value-type references from being replaced with primitive type codes, while preserving shorthand and existing
String/Objecthandling. - Expands field-signature coverage and adds generic-method tests distinguishing explicit native-integer returns from shorthand encodings.
- Documents the signature-preservation behavior.
| File | Description |
|---|---|
src/tools/ilasm/tests/ILAssembler.Tests/TypeSignatureTests.cs |
Adds explicit versus shorthand native-integer return tests. |
src/tools/ilasm/tests/ILAssembler.Tests/TypeDefinitionTests.cs |
Verifies explicit type references for 16 well-known value types. |
src/tools/ilasm/src/ILAssembler/Actions/GrammarActions.Signatures.Types.cs |
Bypasses primitive-code substitution for explicit value types. |
src/tools/ilasm/MANAGED-ILASM-FIXES.md |
Documents native ILAsm compatibility and shorthand usage. |
Review effort: Balanced
jkotas
reviewed
Nov 6, 2026
jkotas
reviewed
Nov 6, 2026
Rename the normalization helper and explain the Object/String compatibility rule. Remove the documentation entry describing behavior shared with native ILAsm. Co-authored-by: Copilot App <[email protected]>
jkotas
approved these changes
Nov 6, 2026
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.
Preserve explicit
valuetypereferences in managed ILAsm signatures instead of replacing well-known primitive value types with short-form type codes. This matches native ILAsm and allows compiler tests to assemble deliberately malformed long-form signatures. Primitive keywords such asnative intretain their short-form encodings; existingclass System.Stringandclass System.Objecthandling is unchanged.The
AddressOf<T>fixture returningvaluetype [mscorlib]System.IntPtrpreviously emitted10010118101E00. It now emits1001011109101E00, identical to native ILAsm, restoring C# diagnostic CS0570 (ERR_BindToBogus) in a standalone consumer. Regression coverage checks all well-known primitive value-type fields and explicit versus shorthand native-integer generic returns.Validation on Windows x64 at commit
2c5fb98c916:.\build.cmd tools.ilasm -c Release -test— passed, 0 build warnings/errors; 5,801 tests total, 0 failures, 3 platform skips..\.dotnet\dotnet.exe test src\tools\ilasm\tests\ILAssembler.Tests\ILAssembler.Tests.csproj -c Release --no-build --filter 'FullyQualifiedName~WellKnownValueType_PreservesExplicitTypeReference|FullyQualifiedName~NativeIntegerGenericMethod_PreservesReturnTypeEncoding'— passed, 20 tests, 0 skips. Before the fix, 17 of these cases failed.The original Roslyn test suite was not run, and its checkout was not modified.
Note
This pull request description and code changes were generated with GitHub Copilot.