Skip to content

Fix TypeMap test to match trimming spec#121937

Merged
MichalStrehovsky merged 2 commits intodotnet:mainfrom
MichalStrehovsky:fix121912
Nov 25, 2025
Merged

Fix TypeMap test to match trimming spec#121937
MichalStrehovsky merged 2 commits intodotnet:mainfrom
MichalStrehovsky:fix121912

Conversation

@MichalStrehovsky
Copy link
Member

Fixes #121912

Copilot AI review requested due to automatic review settings November 24, 2025 21:29
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Nov 24, 2025
@MichalStrehovsky MichalStrehovsky added area-System.Runtime.InteropServices and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Nov 24, 2025
@dotnet-policy-service
Copy link
Contributor

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

Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT left a comment

Choose a reason for hiding this comment

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

Minor request for a doc link. Other than that, looks great!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the TypeMap test to align with trimming specifications by replacing static typeof() calls with runtime .GetType() calls on instances. This change is significant for trimming scenarios where static type references created by typeof() must be preserved by the trimmer, while .GetType() calls on instances allow more flexible handling.

  • Replaces typeof(T) with instance creation followed by .GetType() for most type lookups in proxy type mapping tests
  • Preserves typeof() usage for cases where instantiation is not possible (open generic types and pointer types)
  • Maintains existing typeof() usage in TryGetValue assertions where static type references are required for the test logic

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT left a comment

Choose a reason for hiding this comment

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

Thanks.

@MichalStrehovsky MichalStrehovsky merged commit 72d952a into dotnet:main Nov 25, 2025
74 checks passed
@MichalStrehovsky MichalStrehovsky deleted the fix121912 branch November 25, 2025 06:08
@github-actions github-actions bot locked and limited conversation to collaborators Dec 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate_ProxyTypeMapping test failing with trimming enabled

3 participants