Repository navigation
Match CoreCLR behavior for NativeAOT string and array constructor invocation - #135287
Merged
Merged
Conversation
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 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: @agocke, @dotnet/ilc-contrib |
Co-authored-by: jkotas <[email protected]>
Copilot
AI
changed the title
[WIP] Add support for invoking string and array constructors in NativeAOT
Match CoreCLR behavior for NativeAOT string and array constructor invocation
Oct 6, 2026
This was referenced Oct 6, 2026
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change aligning NativeAOT’s existing-instance pseudo-constructor behavior with CoreCLR.
No open issues 🎉
What changed in this PR
Aligns NativeAOT with CoreCLR when reflection invokes string or array pseudo-constructors on an existing object, addressing #134900.
Changes:
- Rejects existing targets with
NotSupportedExceptionwhile preserving exception wrapping. - Enables the existing regression tests on NativeAOT and retains their Mono exclusions.
| File | Description |
|---|---|
src/libraries/System.Runtime/tests/System.Reflection.Tests/ConstructorInfoTests.cs |
Removes NativeAOT exclusions from both existing-instance constructor tests. |
src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/MethodInfos/CustomMethodInvoker.cs |
Rejects existing string and array targets inside the exception-wrapping block. |
Review effort: Balanced
Member
|
@MichalStrehovsky PTLA |
MichalStrehovsky
approved these changes
Nov 3, 2026
Co-authored-by: jkotas <[email protected]>
MichalStrehovsky
approved these changes
Nov 3, 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.
NativeAOT currently ignores the existing object when invoking string or array pseudo-constructors. CoreCLR instead surfaces
NotSupportedExceptionthroughTargetInvocationException.Note
This description was generated with GitHub Copilot.