Suppress trim analysis warnings inside reflection implementation (#43594)
authorVitek Karas <vitek.karas@microsoft.com>
Fri, 23 Oct 2020 14:52:38 +0000 (07:52 -0700)
committerGitHub <noreply@github.com>
Fri, 23 Oct 2020 14:52:38 +0000 (07:52 -0700)
commit5de326ce23c2a5b41e3f7546611d1a4fd70d5243
tree18a999ed0f48e247a7cb77308bbb026bd87c6c1f
parentec18183ca7c022b21a654fa92f8828ff0f6f2deb
Suppress trim analysis warnings inside reflection implementation (#43594)

See the Justification for each of the added suppressions.

Also annotate GetMethodBody as potentially dangerous with trimming.
Trimming can change IL of a method (can remove branches, remove local variables, change some isntructions, ...) - as such accessing the actual body of a method is potentially dangerous.
12 files changed:
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Associates.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/CustomAttribute.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeConstructorInfo.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeExceptionHandlingClause.cs
src/coreclr/src/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs
src/coreclr/src/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs
src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBase.cs
src/libraries/System.Private.CoreLib/src/System/Reflection/SignatureTypeExtensions.cs
src/libraries/System.Runtime/ref/System.Runtime.cs
src/mono/netcore/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs