diff --git a/Cpp2IL.Core/Utils/AsmResolver/AsmResolverUtils.cs b/Cpp2IL.Core/Utils/AsmResolver/AsmResolverUtils.cs index 6b7c1e4f..ab0aca00 100644 --- a/Cpp2IL.Core/Utils/AsmResolver/AsmResolverUtils.cs +++ b/Cpp2IL.Core/Utils/AsmResolver/AsmResolverUtils.cs @@ -91,7 +91,7 @@ public static TypeSignature GetTypeSignatureFromIl2CppType(ModuleDefinition modu break; case Il2CppTypeEnum.IL2CPP_TYPE_ARRAY: ret = GetTypeSignatureFromIl2CppType(module, il2CppType.GetArrayElementType()) - .MakeArrayType(il2CppType.GetArrayRank()); + .MakeArrayTypeWithLowerBounds(il2CppType.GetArrayRank()); break; case Il2CppTypeEnum.IL2CPP_TYPE_SZARRAY: ret = GetTypeSignatureFromIl2CppType(module, il2CppType.GetEncapsulatedType()) @@ -340,4 +340,13 @@ public static ITypeDefOrRef ImportTypeIfNeeded(this ReferenceImporter importer, public static bool IsManagedMethodWithBody(this MethodDefinition managedMethod) => managedMethod.Managed && !managedMethod.IsAbstract && !managedMethod.IsPInvokeImpl && !managedMethod.IsInternalCall && !managedMethod.IsNative && !managedMethod.IsRuntime; + + internal static ArrayTypeSignature MakeArrayTypeWithLowerBounds(this TypeSignature elementType, int rank) + { + var result = new ArrayTypeSignature(elementType, rank); + for (var i = 0; i < rank; i++) + result.Dimensions[i] = new ArrayDimension(null, 0); + + return result; + } } diff --git a/Cpp2IL.Core/Utils/AsmResolver/ContextToTypeSignature.cs b/Cpp2IL.Core/Utils/AsmResolver/ContextToTypeSignature.cs index 90b98093..8d65d714 100644 --- a/Cpp2IL.Core/Utils/AsmResolver/ContextToTypeSignature.cs +++ b/Cpp2IL.Core/Utils/AsmResolver/ContextToTypeSignature.cs @@ -61,7 +61,7 @@ public static TypeSignature ToTypeSignature(this ByRefTypeAnalysisContext contex public static TypeSignature ToTypeSignature(this ArrayTypeAnalysisContext context, ModuleDefinition parentModule) { - return context.ElementType.ToTypeSignature(parentModule).MakeArrayType(context.Rank); + return context.ElementType.ToTypeSignature(parentModule).MakeArrayTypeWithLowerBounds(context.Rank); } public static TypeSignature ToTypeSignature(this ParameterAnalysisContext context, ModuleDefinition parentModule)