Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/6.0.2xx] Fix marking of nested type forwarders #2391

Merged
merged 2 commits into from
Jan 6, 2022

Conversation

vitek-karas
Copy link
Member

@vitek-karas vitek-karas commented Nov 22, 2021

Port of #2385

Fixes marking of nested type forwarders.

Part of #2359.

Customer Impact

Trimmer incorrectly removes type forwarders for nested type in some cases, breaking the application. One such impacted assembly is Azure.ResourceManager.dll (from Azure's NuGet package).

Testing

Added targeted test to the infrastructure. Validated that the change fixes the reported problem on a provided sample app.

Risk

Low. Before the change some nested type references were incorrect and Cecil would fail to resolve them effectively ignoring them in the process. After the change the nested type references are correctly created and Cecil can correctly resolve them, leading to including them in the output.

…otnet#2372)

The problematic scenario is if there's a "copy" assembly with a forwarder to a "link" assembly with a forwarder. The forwarder is for a nested class.
Test for dotnet#2359.

Also improved the test infra to print out errors from ilasm if they happen.
When create a type reference for the target of a type forwarder, if the type forwarder is for a nested type, we have to build a whole tree of type references for all of the declaring types and not just the final nested type.

Enabled tests which were already added for this case (and fixed a bug in them)
@vitek-karas vitek-karas added this to the .NET 6.0 milestone Nov 22, 2021
@vitek-karas vitek-karas requested a review from agocke November 22, 2021 14:27
@vitek-karas vitek-karas self-assigned this Nov 22, 2021
Copy link
Member

@agocke agocke left a comment

Choose a reason for hiding this comment

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

LGTM

@agocke
Copy link
Member

agocke commented Jan 6, 2022

Approved in email

@agocke agocke merged commit 4e27b85 into dotnet:release/6.0.2xx Jan 6, 2022
agocke added a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
…ers6

[release/6.0.2xx] Fix marking of nested type forwarders

Commit migrated from dotnet/linker@4e27b85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants