-
Notifications
You must be signed in to change notification settings - Fork 5k
Bulk-suppress linker warnings during library builds #40106
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
Conversation
@@ -18,6 +18,7 @@ | |||
<Platforms>x64;x86;arm;arm64</Platforms> | |||
|
|||
<ILLinkTrimAssembly>true</ILLinkTrimAssembly> | |||
<ILLinkTrimAssemblyVerbose>false</ILLinkTrimAssemblyVerbose> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CoreLib is the largest and most important library that we got. It does not sound right to disable the analysis for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this property, we should get rid of it. Instead, we need to suppress these ILLinker warnings for all projects for now.
Here's the overall plan:
- (this PR) Suppress the ILLinker reflection warnings in bulk.
mono/linker
makes the change to enable warnings by default (it only warns on--verbose
today)- We can then take the new ILLinker in
dotnet/runtime
because the warnings are suppressed
~ The above is needed for .NET 5. The below is optional for .NET 5, or can be done early in .NET 6
- We add a new step in the build that runs the ILLinker on the whole shared framework. This doesn't have any warnings suppressed in bulk. Instead, we suppress individual warnings using a baseline file.
- This stops new warnings from being introduced
~ The below is out of scope for .NET 5 and will be done at a later date
- We start working down the baseline file assembly-by-assembly by fixing the ILLinker warnings for real.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get this in to unblock the linker team
<!-- suppress warnings with the following codes: | ||
IL2006: The generic parameter 'T' from A with dynamically accessed member kinds B is passed into the generic parameter | ||
'T' from 'System.Lazy<T>' which requires dynamically accessed member kinds 'PublicParameterlessConstructor' | ||
IL2008: Could not find type A specified in resource B | ||
IL2009: Could not find method A in type B specified in resource C | ||
IL2012: Could not find field A in type B specified in resource C | ||
IL2025: Duplicate preserve of A in B | ||
IL2026: Calling A which has B can break functionality when trimming application code. The target method might be removed. | ||
IL2035: Unresolved assembly A in DynamicDependencyAttribute on B | ||
IL2041: The DynamicallyAccessedMembersAttribute is only allowed on method parameters, return value or generic parameters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we suppressing all these warnings without any explanation or tracking item? It seems to me that issues like IL2025 should be trivial to fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The plan is to do this to be able to enable warnings in the linker. Once we have the XML based suppressions ready the plan is to remove this and replace it with the generated XML files.
* Enable verbose linker output and bulk-suppress warnings * Suppress ILLinker warnings for now, so ILLinker can enable warnings by default Co-authored-by: Eric Erhardt <[email protected]>
Contributes to #38033.