Programs throws Invalid IL code, but is recognized by IL reading software

Viewed 57

I alter my IL code by filling a field with get; set; methods, but during runtime it fails upon assignment. I've found the page as well as precise line that fails. Here it is:

.method public hidebysig specialname instance void set_factionHumanSpawnLocation(valuetype Toolbox.Coord 'value') cil managed
{
    .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor()
    .maxstack 8
    L_0000: ldarg.0 
    L_0001: ldarg.1 
    L_0002: stfld valuetype Toolbox.Coord Targettier.Faction::<factionHumanSpawnLocation>k__BackingField
    L_0007: ldarg.0 
    L_0008: ldstr "factionHumanSpawnLocation"
    L_000d: ldnull 
    L_000e: ldarg.1 
    L_000f: call instance void Targettier.Faction::VariableListener(string, object, object)
    L_0014: ret 
}

It's the call instance that fails. I have made explicit requirements to make sure that this function exists during weaving process. Furthermore software allows me to swap "vision" between IL code and C# code, and when I click VariableListener name, it happily redirects me to where that function is located. That means that the function is found, recognized and valid. But when I press Play on Unity, and assign a value to that field, it throws this:

System.InvalidProgramException: Invalid IL code in [snip]: IL_000f: call 0x06000058

I get the same outcome with both: VariableListener(string, object, object) and VariableListener(string, dynamic, dynamic).

0 Answers
Related