diff --git a/Il2CppDumper/Il2CppCSharpDumper.cs b/Il2CppDumper/Il2CppCSharpDumper.cs index ec27f83..c5855b8 100644 --- a/Il2CppDumper/Il2CppCSharpDumper.cs +++ b/Il2CppDumper/Il2CppCSharpDumper.cs @@ -554,11 +554,15 @@ namespace Il2CppInspector sb.Append(prefix + type.GetModifierString()); - var @base = type.ImplementedInterfaces.Select(x => x.GetScopedCSharpName(scope)).ToList(); + // Inheriting from a base class or implementing an interface using a generic type which contains a nested type parameter + // inside the declared class must be referenced from outside the scope of the type being defined + var outerScope = new Scope {Current = scope.Current.DeclaringType, Namespaces = scope.Namespaces}; + + var @base = type.ImplementedInterfaces.Select(x => x.GetScopedCSharpName(outerScope)).ToList(); if (type.BaseType != null && type.BaseType.FullName != "System.Object" && type.BaseType.FullName != "System.ValueType" && !type.IsEnum) - @base.Insert(0, type.BaseType.GetScopedCSharpName(scope)); + @base.Insert(0, type.BaseType.GetScopedCSharpName(outerScope)); if (type.IsEnum && type.GetEnumUnderlyingType().FullName != "System.Int32") // enums derive from int by default - @base.Insert(0, type.GetEnumUnderlyingType().GetScopedCSharpName(scope)); + @base.Insert(0, type.GetEnumUnderlyingType().GetScopedCSharpName(outerScope)); var baseText = @base.Count > 0 ? " : " + string.Join(", ", @base) : string.Empty; sb.Append($"{type.CSharpTypeDeclarationName}{baseText}"); diff --git a/Il2CppInspector/Reflection/TypeInfo.cs b/Il2CppInspector/Reflection/TypeInfo.cs index c5f0f66..dd318fb 100644 --- a/Il2CppInspector/Reflection/TypeInfo.cs +++ b/Il2CppInspector/Reflection/TypeInfo.cs @@ -294,6 +294,10 @@ namespace Il2CppInspector.Reflection { if (usingScope == null) return CSharpName; + // Generic parameters don't have a scope + if (IsGenericParameter) + return CSharpName; + var s = Namespace + "." + base.Name; // Built-in keyword type names do not require a scope