From e27237360fd5a967746ad8dde139cf21a184b92a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Mon, 14 Sep 2026 22:50:20 +0200 Subject: [PATCH] Fixed regression for generic handling TypeExtension.FindType Caused by d2c6c9a94870f260ceb1d20a1f49a02a0559e645 --- ScriptCore/Extensions/TypeExtension.cs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/ScriptCore/Extensions/TypeExtension.cs b/ScriptCore/Extensions/TypeExtension.cs index 9ffa0e0..ff58565 100644 --- a/ScriptCore/Extensions/TypeExtension.cs +++ b/ScriptCore/Extensions/TypeExtension.cs @@ -95,21 +95,22 @@ public static class TypeExtension ReadOnlySpan typeName = ReadTypeName(fullName); rest = rest.Slice(typeName.Length); - Type? baseType = GetType(typeName); - - if (baseType == null) - { - return null; - } - - if (rest.IsEmpty) + if (rest.IsEmpty || (rest[0] != '[' && rest[0] != '`')) { // Non generic type, easy! - return baseType; + return GetType(typeName); } if (rest[0] == '[') { + Type? baseType = GetType(typeName); + + if (baseType == null) + { + Log.Error($"Failed to find element type {typeName} of array type {fullName}"); + return null; + } + // Handle array type int rank = 1; bool forceMultiDimensional = false; @@ -154,14 +155,11 @@ public static class TypeExtension Type? genericType = GetType(typeName); - Console.WriteLine($"Generic Type: {genericType}"); - List arguments = new List(); while (true) { Type? argument = FindType(rest, ref rest); - Console.WriteLine($"Argument: {argument}"); Debug.Assert(argument != null);