From 3678f40de356b7c79355f1533408b89d24e8ba92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Strehovsk=C3=BD?= Date: Mon, 14 Nov 2022 10:17:41 +0900 Subject: [PATCH] Fix handling generic custom attributes Fixes #78200. --- .../NativeFormat/NativeFormatCustomAttributeData.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/CustomAttributes/NativeFormat/NativeFormatCustomAttributeData.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/CustomAttributes/NativeFormat/NativeFormatCustomAttributeData.cs index 07801d02a50f..a055d0c7882c 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/CustomAttributes/NativeFormat/NativeFormatCustomAttributeData.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/CustomAttributes/NativeFormat/NativeFormatCustomAttributeData.cs @@ -120,7 +120,7 @@ internal sealed override IList GetConstructorArgum { Handle typeHandle = ctorTypeHandles[index]; Exception? exception = null; - RuntimeTypeInfo? argumentType = typeHandle.TryResolve(_reader, new TypeContext(null, null), ref exception); + RuntimeTypeInfo? argumentType = typeHandle.TryResolve(_reader, AttributeType.CastToRuntimeTypeInfo().TypeContext, ref exception); if (argumentType == null) { if (throwIfMissingMetadata) @@ -162,7 +162,7 @@ internal sealed override IList GetNamedArguments(b bool isField = (namedArgument.Flags == NamedArgumentMemberKind.Field); Exception? exception = null; - RuntimeTypeInfo? argumentType = namedArgument.Type.TryResolve(_reader, new TypeContext(null, null), ref exception); + RuntimeTypeInfo? argumentType = namedArgument.Type.TryResolve(_reader, AttributeType.CastToRuntimeTypeInfo().TypeContext, ref exception); if (argumentType == null) { if (throwIfMissingMetadata)