From ac2a2835a4ee29dcbdb5c7e60dc3122fd00ade4c Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Fri, 13 Oct 2017 13:25:47 -0700 Subject: Merge pull request dotnet/corert#4719 from dotnet/nmirror Merge nmirror to master Signed-off-by: dotnet-bot --- src/mscorlib/shared/System/Reflection/IntrospectionExtensions.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mscorlib/shared/System/Reflection/IntrospectionExtensions.cs b/src/mscorlib/shared/System/Reflection/IntrospectionExtensions.cs index 6a18fdaa72..acf5987d44 100644 --- a/src/mscorlib/shared/System/Reflection/IntrospectionExtensions.cs +++ b/src/mscorlib/shared/System/Reflection/IntrospectionExtensions.cs @@ -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); } } } -- cgit v1.2.3