diff --git a/Cpp2IL.Core/AssemblyPopulator.cs b/Cpp2IL.Core/AssemblyPopulator.cs index c9db0374..07b9f46c 100644 --- a/Cpp2IL.Core/AssemblyPopulator.cs +++ b/Cpp2IL.Core/AssemblyPopulator.cs @@ -168,6 +168,10 @@ private static void FixupExplicitOverridesInType(TypeDefinition ilTypeDefinition if (gParams.Length > 0) { var parameterRefs = gParams.Select(ResolveGenericParameter).ToArray(); + + if (parameterRefs.Any(gp => gp == null)) + return null; + return ilTypeDefinition.Module.ImportRecursive(type.MakeGenericInstanceType(parameterRefs)); } diff --git a/Cpp2IL.Core/Cpp2IlApi.cs b/Cpp2IL.Core/Cpp2IlApi.cs index 9fec0d7f..d1cca979 100644 --- a/Cpp2IL.Core/Cpp2IlApi.cs +++ b/Cpp2IL.Core/Cpp2IlApi.cs @@ -246,7 +246,7 @@ public static void RunAttributeRestorationForAllAssemblies(BaseKeyFunctionAddres { CheckLibInitialized(); - SharedState.AttributeGeneratorStarts = LibCpp2IlMain.Binary!.AllCustomAttributeGenerators.ToList(); + LibCpp2IlMain.Binary!.AllCustomAttributeGenerators.ToList().ForEach(ptr => SharedState.AttributeGeneratorStarts.Add(ptr)); var enumerable = (IEnumerable) SharedState.AssemblyList; diff --git a/Cpp2IL.Core/SharedState.cs b/Cpp2IL.Core/SharedState.cs index 872deba4..b4f87942 100644 --- a/Cpp2IL.Core/SharedState.cs +++ b/Cpp2IL.Core/SharedState.cs @@ -40,7 +40,7 @@ public static class SharedState internal static readonly List AssemblyList = new List(); internal static readonly Dictionary ManagedToUnmanagedAssemblies = new Dictionary(); - internal static List AttributeGeneratorStarts = new(); + internal static HashSet AttributeGeneratorStarts = new(); internal static void Clear() {