During an unwind operation, another unwind operation may be initiated. This may occur, for example, if a handler that is invoked for the original unwind initiates another unwind, or if an exception is raised in the context of such a handler and a handler invoked for that exception initiates another unwind operation.
An unwind that is initiated while a previous unwind is active is either a nested unwind or a colliding unwind.
A nested unwind is an unwind that is initiated while a previous unwind is active, and whose target invocation in the procedure invocation chain is not a predecessor of the most current active unwind handler. That is, a nested unwind is one that does not terminate any procedure invocation that would have been terminated by the previously active unwind.
When a nested unwind is initiated, no special rules apply. The nested unwind operation proceeds as a normal unwind operation, and when execution resumes at the target location of the nested unwind, the nested unwind is complete and the previous unwind is once again the most current unwind operation.
A colliding unwind is an unwind that is initiated while a previous unwind is active, and whose target invocation in the procedure invocation chain is a predecessor of the most current active unwind handler. That is, a colliding unwind is one that terminates one or more procedure invocations that would have been terminated by the previously active unwind.
A colliding unwind is detected when the most current active unwind handler is terminated. This detection of a colliding unwind is termed a collision.
When a collision occurs, the second (more recent) takes precedence and the prior unwind is abandoned.
The next action is to reinvoke the most current active unwind handler, since its establisher has not been unwound. The EXCEPTION_COLLIDED_UNWIND flag will be set in the exception record to indicate this situation to the handler.