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

Remove base type rooting for types in rooted assemblies #92864

Merged
merged 5 commits into from
Oct 5, 2023

Commits on Oct 4, 2023

  1. Remove base type rooting for types in rooted assemblies

    When rooting entire assemblies NativeAOT also roots all base types of all the types in such assembly. Regardless of which assembly the base type comes from. Historically this was necessary to make certain combinations of generic instantiations to work, but that's no longer the case. The compiler has better mechanism of tracking necessary things for generics now.
    
    This rooting behavior brings in more code than necessary. This is specifically problematic when using the assembly rooting as a mechanism to test library trim/AOT compatibility. If the tested library depends on another library which has some incompatible code in it, but it's not used, ideally the compiler should remove the unused code and thus not see the incompatibilities. Rooting entire base types sometimes breaks that behavior and produces unnecessary warnings.
    
    The product change is really just "don't root the base type", all of the rest of the change is tests. Modified existing test to validate more things around rooting behavior across assemblies. And then infrastructure changes to make it possible to use this test from NativeAOT.
    
    This brings the behavior of NativeAOT and trimmer much closer with regard to assembly rooting.
    vitek-karas committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    2579fa3 View commit details
    Browse the repository at this point in the history
  2. Limit the impact only to rooted assemblies

    Rooting from rd.xml is kept as before (rooting a type will also root its base types). Given that rd.xml is already very problematic and tricky and people rely on all kinds of "accidental" behavior, it's not worth the break - there's not much complexity in keeping this behavior there.
    
    Update trimming tests which started to fail after the infra updates. Mostly disable the tests for NativeAOT as they don't make sense on AOT.
    vitek-karas committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    0cd17b3 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f4a78ed View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ed81a8f View commit details
    Browse the repository at this point in the history
  5. Fix one more test

    vitek-karas committed Oct 4, 2023
    Configuration menu
    Copy the full SHA
    b7ebb3b View commit details
    Browse the repository at this point in the history