
Signature
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
Hmm.. do we have a misunderstanding on our hands? If I understood your
message correctly, you are refering to the threads in my app - whereas
I am refering to visual studio (another process altogether). I realize
that a breakpoint breaks all threads, but if you step through the code
thereafter, all threads become active again (which can lead to funny
"line hopping" in the IDE when you have multiple threads executing the
same method e.g. for a multiuser system). And I'm not complaining
about my own GUI locking up.. Visual Studio locks up and that's
another process altogether and the warning that pops up in the taskbar
even hints that this may be a Visual Studio problem - it says it
shouldn't happen.
I never had any trouble debugging any software using multiple threads
(be it a software without any GUI and just multiple processing threads
or a GUI with background processing threads) - regardless of where I
place a breakpoint, it breaks as expected, and I can step through the
code no problem. I can even debug cross thread calls (e.g place a
breakpoint in the event handler getting feedback from a processing
thread, and another one in the EventHandler executing in the GUI
thread). It's really only when I use control.BeginInvoke together with
anonymous delegates that this problem happens. If I swap out the
anonymous delegate like this:
void run()
{
while(running)
{
// do something
this.BeginInvoke((MethodInvoker)delegate()
{
// processing in the gui thread
});
}
}
with the following
void run()
{
while(running)
{
// do something
this.BeginInvoke(new EventHandler(myEventHandler));
}
}
It works as expected so taht, along with the Visual Studio popup hint
that tells me to tell Microsoft if it keeps happening make me think
this is a Visual Studio issue. If not, do you have any explanation why
from the two examples above, the first locks up Visual Studio,
(regardless of whether the breakpoint is on the line "//do something"
or on "// processing in the gui thread") and the second does not
(again regardless of the placement of breakpoints)? Plus there's the
inconsistent behavior... the first time the breakpoint is hit, Visual
Studio shows the "busy" popup.. and then once the breakpoint finally
hits, if I press F10 to continue, if I'm lucky it does continue, if
I'm not, nothing happens and my software enters running state again.
Then the next time the breakpoint is hit, there's no waiting where my
application has stopped responding (so I presume the breakpoint has
been hit and all threads have been suspended) but where Visual Studio
doesn't yet show the breakpoint as hit and won't let me step through
the code.
Regards
Stephan
On 23 Aug, 16:50, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.com> wrote:
> Stephan,
>
[quoted text clipped - 7 lines]
>
> "StephanSteiner" <stephan.stei...@nextiraone.ch> wrote in message