Suspected VS bug/issue - Can't step into method when called on worker thread [modified]
-
Platform details: Windows Form app, written in C# under VS 2005, compiling for 64-bit, running on XP-64. Scenario: Form needs to call a method asynchronously, then catch an event when the task is complete, and update its UI. Here's the general flow: a) Form (thread 1) registers for event (+=) on a custom object. b) Form calls method on the custom object to initiate task request. c) Custom object queues request on a separate thread (thread 2) d) Once request completed (thread 2), pooled thread (thread 3) is used to raise event. e) Form handles the event (or rather, the handler within the Form object is invoked) f) Form's event handler calls a subroutine (in a separate class) to handle the messy details of whether its on the UI thread or not (it isn't in this case, we're on thread 3) g) Subroutine calls InvokeRequired, which returns true, so it provides a delegate and calls Invoke to make sure that it is executed on the main UI thread. h) Callback/delegate is invoked on UI thread (Thread 1), delegate code executes, UI is safely updated, everyone is happy. Here's the problem: If I try to step into the sub-routine in step g), VS bails out, and doesn't execute the function, it just skips it and unwinds to the calling routine, which executes flawlessly. No exceptions, no crashes, no other recognizable problems. It just doesn't execute the method. If I don't step in, everything works fine. If I run outside the debugger, everything works fine. If I don't pass a reference to the form as a parameter to the subroutine (can't call InvokeRequired without it), then I can step through the subroutine. Seems like VS is doing something with that parameter that it shouldn't in that context, which is hosing the stack. NOTE: I also see a little help balloon telling me that Visual Studio is busy, and to contact MS if I see if frequently. This leads me to suspect that its a VS issue. Anybody encountered anything like this? Thanks -- modified at 10:15 Thursday 13th July, 2006