Bulk-suppress linker warnings during library builds (#40106)
authorLayomi Akinrinade <laakinri@microsoft.com>
Thu, 30 Jul 2020 18:42:48 +0000 (11:42 -0700)
committerGitHub <noreply@github.com>
Thu, 30 Jul 2020 18:42:48 +0000 (11:42 -0700)
* 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 <eric.erhardt@microsoft.com>
eng/illink.targets

index 79eb5d4..ddd4936 100644 (file)
       <ILLinkArgs>$(ILLinkArgs) --disable-opt unusedinterfaces</ILLinkArgs>
       <!-- keep DynamicDependencyAttribute unless a project explicitly disables it -->
       <ILLinkArgs Condition="'$(ILLinkKeepDepAttributes)' != 'false'">$(ILLinkArgs) --keep-dep-attributes true</ILLinkArgs>
+      <!-- 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.
+      -->
+      <ILLinkArgs>$(ILLinkArgs) --nowarn IL2006;IL2008;IL2009;IL2012;IL2025;IL2026;IL2035;IL2041</ILLinkArgs>
     </PropertyGroup>
 
     <MakeDir Directories="$(ILLinkTrimInputPath)" />