.Net - what is an "unwind"?
Asked Answered
S

4

9

While answering this question I noticed that I got the following dialog while atempting to move the "cursor" while an exception was being handled:

Unable to set the next statement to this location. The attempt to unwind the callstack failed.

Unwinding is not possible in the following scenarios:

  1. Debugging was started via Just-In-Time debugging.
  2. An unwind is in progress
  3. A System.StackOverflowException or System.Threading.ThreadAbortException exception has been thrown.

What exactly is an unwind?

Sixth answered 5/1, 2010 at 11:16 Comment(0)
M
21

It's me!

No, in this context it typically refers to the process of stepping ("backwards"/"upwards") through a stack, removing successive frames until you've come back to the desired level. Typical stacks are (of course) very linear in their structure, frames are stacked end-to-end after each other, so there's not really much literal unwinding going on, but that's what it's called.

This Wikipedia page has more detail.

Molluscoid answered 5/1, 2010 at 11:19 Comment(0)
S
2

Unwinding is just moving back up the stack.

Spinode answered 5/1, 2010 at 11:20 Comment(0)
V
1

This where the CLR is 'unwinding' the stack in order to locate a method with a catch block that can handle the exception i.e. if the current method doesn't handle the exception it then returns to the method that called it to see if it will. This is repeated until it either finds a method to handle the exception or hits application level error handling.

Vanbuskirk answered 5/1, 2010 at 11:27 Comment(0)
P
0

It means there is a faulty thread or probably that is because the stack is full and no stack frame is created, the CLR as opts to UNWIND the current context in this situation.

Pictorial answered 5/1, 2010 at 11:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.