The code below throws an exception:
Unhandled Exception: System.ArgumentNullException: Value cannot be null.
at System.Threading.Monitor.Exit(Object obj)
at Test.foo()
at Test.Main()
Is this correct behavior? I understand why it is happening, but from my
reading of the spec, this behavior is incorrect.
BTW, the commercial implementation behaves the same (although the
Monitor.Exit line is missing from the stack trace, so I guess it inlines
that).
Regards,
Jeroen
//////////////////// start /////////////////////
.assembly extern mscorlib {}
.assembly test {}
.class private auto ansi beforefieldinit Test
extends [mscorlib]System.Object
{
.method public hidebysig newslot virtual
instance void foo() cil managed synchronized
{
ldnull
starg 0
ret
}
.method private hidebysig static void Main() cil managed
{
.entrypoint
newobj instance void Test::.ctor()
callvirt instance void Test::foo()
ret
}
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
}
//////////////////// end /////////////////////