Browsing through the MSDN, I found the following quote (emphasis mine):
OpCodes.Throw
Throws the exception object currently on the evaluation stack.
The stack transitional behavior, in sequential order, is:
An object reference (to an exception) is pushed onto the stack.
The object reference is popped from the stack and the exception thrown.
I cannot find anything about the case where the thrown exception is a stack overflow exception. How is this pushed onto the stack, when the stack is full?
Does the CLR always reserve at least some space for a StackOverflowException
? Is it handled separately from all other exceptions? Are we even talking about the same stack here?
And why does it need to be pushed onto the stack in the first place, if it is immediately popped? Or is step 2 not done by the Throw opcode, but only when the exception is caught?
Is this documented somewhere (I would have expected it on the linked page).