Fix MarshalAs IID parameter index parsing#128364
Merged
MichalStrehovsky merged 8 commits intoMay 20, 2026
Merged
Conversation
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/6431b9d0-721f-4422-8e4f-28133f8e4e6a Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/6431b9d0-721f-4422-8e4f-28133f8e4e6a Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/6431b9d0-721f-4422-8e4f-28133f8e4e6a Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/6431b9d0-721f-4422-8e4f-28133f8e4e6a Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/6431b9d0-721f-4422-8e4f-28133f8e4e6a Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/6431b9d0-721f-4422-8e4f-28133f8e4e6a Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dotnet/runtime/sessions/6431b9d0-721f-4422-8e4f-28133f8e4e6a Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
MichalStrehovsky
May 19, 2026 12:29
View session
Contributor
|
Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib |
MichalStrehovsky
approved these changes
May 19, 2026
Member
|
/azp run runtime-nativeaot-outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the TypeSystem marshal descriptor parser to tolerate (and consume) the optional IidParameterIndex payload that can appear for COM-interface native types, and adds TypeSystem regression coverage to ensure these marshal blobs no longer trigger debug assertions due to unread bytes.
Changes:
- Update
EcmaSignatureParser.ParseMarshalAsDescriptor()to consume an optional compressed integer payload forIUnknown,IDispatch, andInterfacenative types. - Add TypeSystem tests that compile methods using
[MarshalAs(..., IidParameterIndex = 0)]and validate the descriptor parses successfully. - Extend the CoreTestAssembly
MarshalAsAttributestub and add new methods that emit the relevant marshal descriptors.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/coreclr/tools/Common/TypeSystem/Ecma/EcmaSignatureParser.cs | Consumes optional IidParameterIndex data for COM interface marshal descriptors to avoid leftover bytes/asserts. |
| src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/MarshalUtilsTests.cs | Adds regression test validating the marshal descriptor type parses for COM interface cases with IidParameterIndex. |
| src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Platform.cs | Updates the CoreTestAssembly MarshalAsAttribute stub to allow IidParameterIndex named argument in test code. |
| src/coreclr/tools/aot/ILCompiler.TypeSystem.Tests/CoreTestAssembly/Marshalling.cs | Adds test methods that use MarshalAs(..., IidParameterIndex = 0) for IUnknown/IDispatch/Interface. |
Member
|
/azp run runtime-nativeaot-outerloop |
|
Azure Pipelines successfully started running 1 pipeline(s). |
3 tasks
This was referenced May 19, 2026
Open
Member
|
@dotnet/ilc-contrib could someone have a look? #128214 broke outerloop builds and we can't test |
jkotas
approved these changes
May 20, 2026
Member
|
/ba-g helix issue |
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 native AOT outerloop runs that are currently broken.
NativeAOT could assert while parsing valid
MarshalAsmetadata emitted for COM interface parameters usingIidParameterIndex, leaving unread bytes in the marshal descriptor blob.Parser
IidParameterIndexpayloads for COM interface native types:IUnknownIDispatchInterfaceRegression coverage
Interface,IUnknown, andIDispatchmarshal descriptors.