C#C
C#2y ago
thegu5

Debugging a ReflectionTypeLoadException

I'm using a tool called Cpp2IL to generate types like this in assemblies:
c#
// Cpp2IlInjected.WasmMethod.WasmMethod
using System;

[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public sealed class WasmMethod : Attribute
{
    public int Index;
}

(il:)
.class public auto ansi sealed Cpp2IlInjected.WasmMethod.WasmMethod
    extends [mscorlib]System.Attribute
{
    .custom instance void [mscorlib]System.AttributeUsageAttribute::.ctor(valuetype [mscorlib]System.AttributeTargets) = (
        01 00 40 00 00 00 01 00 54 02 0d 41 6c 6c 6f 77
        4d 75 6c 74 69 70 6c 65 00
    )
    // Fields
    .field public int32 Index

    // Methods
    .method public specialname rtspecialname 
        instance void .cctor () cil managed 
    {
        // Method begins at RVA 0x8d77
        // Header size: 1
        // Code size: 7 (0x7)
        .maxstack 8

        IL_0000: ldarg.0
        IL_0001: call instance void [mscorlib]System.Attribute::.ctor()
        IL_0006: ret
    } // end of method WasmMethod::.cctor

} // end of class Cpp2IlInjected.WasmMethod.WasmMethod

everything looks valid after comparing it to output from https://sharplab.io
  • so, are there any ways I continue debugging this to figure out what went wrong with generation? (/is there anything incorrect that stands out?)
C#/VB/F# compiler playground.
Was this page helpful?