Join GitHub today
"Go to disassembly" in VS aborts debugging session #18602
On checked CoreCLR build, it hits "IsNeutered" assert at this callstack - it is where things begin to go wrong:
@jkotas thanks for finding this! Interestingly this appears to be a pre-existing bug in 2.1.0 RTM but #18322 increased its exposure. In my attempt to repro it did not crash msvsmon, but in both 2.1.0 and current daily builds the debugger is effectively doing an invalid type cast that treats the block of memory for a Module* as if it was an ILCodeVersionNode*. Later use of this invalid pointer in the code path that #18322 changed presumably gave you the crash.
Not all ILCodeVersions are backed by an explicit ILCodeVersionNode. The code would be correct if ILCodeVersion::AsNode had C# style semantics where non-Node versions return NULL, but that isn't what ILCodeVersion::AsNode does (it is, confusingly, what NativeCodeVersion::AsNode does)
The other usage of AsNode() does it safely:
Because the bug is dereferencing the wrong memory there is some limited non-determinism at play, but in the example I had under the debugger for 2.1.0 the failure proceeds like this:
After the change in #18322 this failure throws exceptions at step (3) due to different usage of the bad VMPTR_ILCodeVersionNode pointer.