views:

100

answers:

2

Hi,

I have a graphical control that is multithreaded.

Until now it worked fine, but I just noticed that whenever I'm on my application showing this control the following happens: if I lock and unlock my workstation, it freezes, like if it were in some kind of infinite loop.

Even stranger, this bug occurs only when I'm not launching the app from Visual Studio, and not attached to it.

Does anyone have a clue on what's happening?

For instance, if I attach Visual Studio to the already freezed app, can I see which lines of code my threads are executing?

Any help will be appreciated!

A: 

just attach VS to the frozen app and hit Pause button, VS will show executing code.

Sergey Galich
I already did that, but all the threads are in the main just doing nothing.
leo
+1  A: 

We recently had (for about a year and a half ;) this same problem. It also triggers sometimes when IE flushes caches, when you change colors of you theme. etc.

The problem was that we had a splash screen that had its window created on one thread and then it was shown (ShowDialog()) within other thread. Once we moved the window creation to the same thread that actually shows it, it resumed. There was also some changes with .Dispose():ng the splash window, and they could also have had an effect.

Microsoft has an article about this and they basically suggest to run their Spy++ program and look at your program when it's hung. There is a "Windows" -window, search for your application and look for any windows that should not be there. They possibly have a windows message pump active/attached but it is not pumping. The "change" message does not get handled and all .NET windows stall -> hang.

Pasi Savolainen
Thanks a lot for your answer, I think it will be very useful.
leo
@leo: found the link, hope it helps; this was such an annoying problem.
Pasi Savolainen