MSIL Verification Notes – 5

This is a short one.

The arglist operation can only work when the method’s signature indicates that it accepts a variable number of arguments. The verification rule also requires a type check for System.RuntimeArgumentHandle.

Below scenario is clear a violation of both conditions.

.method public hidebysig static void Test() cil managed
.maxstack 8
L_0000: arglist
L_0002: call void [mscorlib]System.Console::WriteLine(int32)
L_0007: ret
The peverify result looks like below.
[IL]: Error: [xxx.exe : arglist_negt::Test][mdToken=0x6000001][offset 0x00000000] Allowed only in vararg methods.(Error: 0x8013187A)