From b1ecedd61c6f189a43c90ec2c0c1bdfa8c33861d Mon Sep 17 00:00:00 2001 From: Manodasan Wignarajah Date: Thu, 1 Aug 2024 22:48:45 -0700 Subject: [PATCH] Guard against potential null (#1695) --- src/WinRT.Runtime/ComWrappersSupport.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/WinRT.Runtime/ComWrappersSupport.cs b/src/WinRT.Runtime/ComWrappersSupport.cs index 6f78b5f8e..e7d5a721f 100644 --- a/src/WinRT.Runtime/ComWrappersSupport.cs +++ b/src/WinRT.Runtime/ComWrappersSupport.cs @@ -650,7 +650,8 @@ internal static Type GetRuntimeClassForTypeCreation(IInspectable inspectable, Ty // isn't already added. On JIT, we can construct it at runtime. if (!RuntimeFeature.IsDynamicCodeCompiled) { - if (implementationType.IsInterface && + if (implementationType != null && + implementationType.IsInterface && implementationType.IsGenericType && !TypedObjectFactoryCacheForType.ContainsKey(implementationType)) {