Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

Mark all type forwarders used during string->Type resolution - #2836

Merged
vitek-karas merged 2 commits into
dotnet:mainfrom
vitek-karas:MarkForwardersInTypeResolution
Jun 13, 2022
Merged

vitek-karas merged 2 commits into
dotnet:mainfrom
vitek-karas:MarkForwardersInTypeResolution

Conversation

@vitek-karas

Copy link
Copy Markdown
Member

Previously we only marked the type forwarder for the outer-most type (if any), but the same problem can happen with type names in generic arguments. If they are forwarder we need to mark those type forwarders as well.

This change records all type resolutions during the string->Type resolution and then makes sure that all type forwarders used get marked.

Renamed a method on HandleCallAction to make it more descriptive of what it actually does. Also unifies all string->Type resolution into the ReflectionMarker.

Enabled test which has been already added for the bug and added another variation (CreateInstance).

Improved ResultsChecker to include assembly names in validation messages.

Fixes #1536

Previously we only marked the type forwarder for the outer-most type (if any), but the same problem can happen with type names in generic arguments. If they are forwarder we need to mark those type forwarders as well.

This change records all type resolutions during the string->Type resolution and then makes sure that all type forwarders used get marked.

Renamed a method on HandleCallAction to make it more descriptive of what it actually does. Also unifies all string->Type resolution into the ReflectionMarker.

Enabled test which has been already added for the bug and added another variation (CreateInstance).

Improved ResultsChecker to include assembly names in validation messages.

@sbomer sbomer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thank you!

@jtschuster jtschuster left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thank you!

Comment thread src/linker/Linker/TypeNameResolver.cs Resolved
@vitek-karas
vitek-karas merged commit 27b9dd6 into dotnet:main Jun 13, 2022
@vitek-karas
vitek-karas deleted the MarkForwardersInTypeResolution branch June 13, 2022 21:19
agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
…linker#2836)

Previously we only marked the type forwarder for the outer-most type (if any), but the same problem can happen with type names in generic arguments. If they are forwarder we need to mark those type forwarders as well.

This change records all type resolutions during the string->Type resolution and then makes sure that all type forwarders used get marked.

Renamed a method on HandleCallAction to make it more descriptive of what it actually does. Also unifies all string->Type resolution into the ReflectionMarker.

Enabled test which has been already added for the bug and added another variation (CreateInstance).

Improved ResultsChecker to include assembly names in validation messages.

Commit migrated from dotnet/linker@27b9dd6
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.

DynamicallyAccessedMembers with a string TypeName of a generic type with different assemblies doesn't appear to work

3 participants