Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 2 commits into from
Jul 30, 2020

Conversation

layomia
Copy link
Contributor

@layomia layomia commented Jul 29, 2020

Contributes to #38033.

@layomia layomia added the NO-REVIEW Experimental/testing PR, do NOT review it label Jul 29, 2020
@layomia layomia changed the title Linker warning suppressions Enable verbose linker output and bulk-suppress warnings Jul 30, 2020
@layomia layomia self-assigned this Jul 30, 2020
@layomia layomia added this to the 5.0.0 milestone Jul 30, 2020
@layomia layomia marked this pull request as ready for review July 30, 2020 12:04
@layomia layomia removed the NO-REVIEW Experimental/testing PR, do NOT review it label Jul 30, 2020
@layomia layomia requested review from eerhardt and mateoatr July 30, 2020 12:05
@@ -18,6 +18,7 @@
<Platforms>x64;x86;arm;arm64</Platforms>

<ILLinkTrimAssembly>true</ILLinkTrimAssembly>
<ILLinkTrimAssemblyVerbose>false</ILLinkTrimAssemblyVerbose>
Copy link
Member

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.

Copy link
Member

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:

  1. (this PR) Suppress the ILLinker reflection warnings in bulk.
  2. mono/linker makes the change to enable warnings by default (it only warns on --verbose today)
  3. 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

  1. 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

  1. We start working down the baseline file assembly-by-assembly by fixing the ILLinker warnings for real.

Copy link
Member

@eerhardt eerhardt left a 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

@layomia layomia changed the title Enable verbose linker output and bulk-suppress warnings Bulk-suppress linker warnings during library builds Jul 30, 2020
@layomia layomia merged commit a87ee38 into dotnet:master Jul 30, 2020
@layomia layomia deleted the baselines_test branch July 30, 2020 18:43
Comment on lines +219 to +228
<!-- 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.
Copy link
Contributor

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

Copy link
Member

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.

Jacksondr5 pushed a commit to Jacksondr5/runtime that referenced this pull request Aug 10, 2020
* 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]>
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
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.

7 participants