Merge pull request dotnet/corert#4719 from dotnet/nmirror
authorJan Kotas <jkotas@microsoft.com>
Fri, 13 Oct 2017 20:25:47 +0000 (13:25 -0700)
committerJan Kotas <jkotas@microsoft.com>
Sat, 14 Oct 2017 00:14:36 +0000 (17:14 -0700)
Merge nmirror to master

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

index 6a18fda..acf5987 100644 (file)
@@ -13,7 +13,10 @@ namespace System.Reflection
             if (type == null)
                 throw new ArgumentNullException(nameof(type));
 
-            return ((IReflectableType)type).GetTypeInfo();  // Unguarded cast is unbecoming but kept for compatibility.
+            if (type is IReflectableType reflectableType)
+                return reflectableType.GetTypeInfo();
+
+            return new TypeDelegator(type);
         }
     }
 }