MSIL Verification Notes – 10


Another one that taking ArgIterator is deemed unverifiable. This time is for making a Type Reference.






.method public hidebysig static vararg void VarArg() cil managed
{
.maxstack 8
.locals init (
[0] valuetype [mscorlib]System.ArgIterator args,
[1] valuetype [mscorlib]System.TypedReference tref)
L_0000: ldloca args
L_0004: arglist
L_0006: call instance void [mscorlib]System.ArgIterator::.ctor(valuetype [mscorlib]System.RuntimeArgumentHandle)
L_000b: ldloca args
L_000f: mkrefany [mscorlib]System.ArgIterator
L_0014: stloc tref
L_0018: ldloca args
L_001c: call instance valuetype [mscorlib]System.TypedReference [mscorlib]System.ArgIterator::GetNextArg()
L_0021: refanyval int64
L_0026: ldind.i8
L_0027: call void [mscorlib]System.Console::WriteLine(int64)
L_002c: ret
}
The PEverify states below
[IL]: Error: [xxx.exe : TestClass::VarArg][mdToken=0x6000001][offset 0x0000000F] Mkrefany on TypedReference, ArgHandle, or ArgIterator.(Error: 0x801318B7)