Reflection-block some types in CoreLib (dotnet/corert#5286)
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Wed, 24 Jan 2018 16:00:14 +0000 (17:00 +0100)
committerJan Kotas <jkotas@microsoft.com>
Wed, 24 Jan 2018 20:30:32 +0000 (12:30 -0800)
This saves 50 kB on a hello world app.

This is using the existing ReflectionBlocked attribute to manually block public types that get otherwise blocked by the IL2IL toolchain in Project N. These types are public within the repo, but should be considered private implementation details everywhere else.

Wrote a small tool that would let me identify these: https://gist.github.com/MichalStrehovsky/e2ddec899d3e0db6eba95bf68694b40e. There is more.

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
src/mscorlib/shared/System/Reflection/SignatureTypeExtensions.cs

index 5847944..9247132 100644 (file)
@@ -9,6 +9,7 @@ using System.Diagnostics;
 namespace System.Reflection
 {
 #if CORERT
+    [System.Runtime.CompilerServices.ReflectionBlocked]
     public // Needs to be public so that Reflection.Core can see it.
 #else
     internal