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

Add a test for #2260 #2263

Merged
merged 2 commits into from
Sep 8, 2021
Merged

Conversation

vitek-karas
Copy link
Member

This uncovers a null ref in sweepstep.
The test is order dependent:

  • Assembly (librarywithnonemtpy) has a virtual method which referes to type from second library (library). This processes the type reference.
  • The type is removed from library
  • The virtual method is re-processed again -> hits a type def which does not belong to any assembly/scope

For this to happen the virtual method must be processed after the type has been removed.
This also requires the method to be meant for removal later on (the body will be rewritten to throw), since otherwise the type would have been marked.
This also requires the library with the removed type to be kept (so something else in it must be kept).

This uncovers a null ref in sweepstep.
The test is order dependent:
- Assembly (librarywithnonemtpy) has a virtual method which referes to type from second library (library). This processes the type reference.
- The type is removed from library
- The virtual method is re-processed again -> hits a type def which does not belong to any assembly/scope

For this to happen the virtual method must be processed after the type has been removed.
This also requires the method to be meant for removal later on (the body will be rewritten to throw), since otherwise the type would have been marked.
This also requires the library with the removed type to be kept (so something else in it must be kept).
@vitek-karas vitek-karas added this to the .NET 7.0 milestone Sep 7, 2021
@vitek-karas vitek-karas requested a review from sbomer September 7, 2021 09:30
@vitek-karas vitek-karas self-assigned this Sep 7, 2021

namespace Mono.Linker.Tests.Cases.Inheritance.AbstractClasses.NoKeptCtor.OverrideRemoval.Dependencies
{
public class OverrideOfAbstractIsKeptNonEmptyLibraryWithNonEmpty :
Copy link
Member

Choose a reason for hiding this comment

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

nit: I'm not sure what the "non-empty" in NonEmptyLibrary or WithNonEmpty refer to - maybe the names could be simplified?

Copy link
Member Author

Choose a reason for hiding this comment

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

The idea was to keep the names starting with the name of the test - so that it's easy to tell which dependencies belong to which test.

@vitek-karas vitek-karas merged commit 43fb979 into dotnet:main Sep 8, 2021
@vitek-karas vitek-karas deleted the TestForSweepNullRef branch September 8, 2021 08:35
agocke pushed a commit to dotnet/runtime that referenced this pull request Nov 16, 2022
This uncovers a null ref in sweepstep.
The test is order dependent:
- Assembly (librarywithnonemtpy) has a virtual method which referes to type from second library (library). This processes the type reference.
- The type is removed from library
- The virtual method is re-processed again -> hits a type def which does not belong to any assembly/scope

For this to happen the virtual method must be processed after the type has been removed.
This also requires the method to be meant for removal later on (the body will be rewritten to throw), since otherwise the type would have been marked.
This also requires the library with the removed type to be kept (so something else in it must be kept).

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

Successfully merging this pull request may close these issues.

3 participants