I am using BeginInvoke to start a delegate, but the issue is I cannot debug in the
method invoked through BeginInvoke. When a breakpoint is set inside
the method, the IDE pauses (usually), then once the breakpoint is hit
and a continue is attempted (F10 or F11), the debugger hangs.
I am using BeginInvoke to start a delegate, but the issue is I cannot
Share
The most likely cause for the hang is an implicit property or
.ToStringevaluation which causes a deadlock in the CLR and hence debugger. Try disabling this and repeating the scenarioWhen the debugger implicitly or explicitly evaluates functions it does so on a hijacked thread in the CLR. This thread is not the thread on which you are currently debugging and all other threads are suspended during this operation. Hence if any of the
ToStringor property methods do a thread sensitive operation it can very easily cause a deadlock.The debugger effectively executes methods in the debugger window synchronously from the UI thread and consequently it locks Visual Studio as well.