Question ShowDialog is Freezing, "almost" randomly

matutano

New member
Joined
Mar 29, 2009
Messages
4
Programming Experience
1-3
Hi there.

I'm kind of a newbie in the vb.net world, and I'm experience a strange problem with the toolstrip and showDialog().

I'm developing a aplication that interact with a .COM device, and when it receives a specific signal, a new window pops up.

It works fine, but the team that was testing it discovered that, if i move the mouse really fast throw the tool strip buttons and the menu buttons (creating the feeling that the buttuns are interacting), the applicantion COULD freeze sometimes. Was a strange behavior, speacially when i discovered that it was freezing when ShowDialog() was being called.... It just freezes, there is an exception being raised, NOTHING!!

Anyone has experienced this kind of problem? I really need to solve this bug.

I'm sorry about my english :S
 
Could you reproduce the behaviour within your IDE?

Technically the program is freezing when ShowDialog() is called, since it's a function returning the Dialog Result. What are you calling with this method?
Also, what has hovering the mouse over MenuItems to do with this? Are you calling something in that Events?

Bobby
 
Could you reproduce the behaviour within your IDE?
Unfortunally yes, it's strange, but i think it's easier to produce this error outside the IDE

Technically the program is freezing when ShowDialog() is called, since it's a function returning the Dialog Result. What are you calling with this method?
I'm calling a simple form that i've created, and once the hole aplication freezes when i call ShowDialog, the returning value of the dialog is meanless (i think...)

Also, what has hovering the mouse over MenuItems to do with this? Are you calling something in that Events?

Bobby
I'm not calling any event... the only think that is being done when i move the mouse over that the menuItems, is the "raise" button effect... that I can't control (at least i don't know how), the only event i've produced, associated with my menuItem it's the click...
 
Sounds like youre doing something with the UI thread that you shouldn't. Use a window inspector to see what windows are open when the app is frozen; is the dialog open, but behind the main screen? Try making it NOT a dialog for a start, and show it in the taskbar so that it can be closed independently. If it works, I'd suggest ensuring that you're not using the UI thread for blocking operations and also perhaps not use wizz bang flashy mouseover effect tool bars
 
Unfortunally yes, it's strange, but i think it's easier to produce this error outside the IDE
At no point is it unfortunately that you could reproduce a problem within the IDE. ;)

cjard is right, the next question would be what you're doing with the form you call, and if it can be done/if the same happen if you call it by Show() instead.

Bobby
 
Sounds like youre doing something with the UI thread that you shouldn't. Use a window inspector to see what windows are open when the app is frozen; is the dialog open, but behind the main screen? Try making it NOT a dialog for a start, and show it in the taskbar so that it can be closed independently. If it works, I'd suggest ensuring that you're not using the UI thread for blocking operations and also perhaps not use wizz bang flashy mouseover effect tool bars

I don't know what you mean about using a window inspector, but i can't see the new window poping up in the task bar, my application just stalls, without blocking cpu or anything like that. The wizz bang flashy moseover efect is being produce automatically (default behavior from windows), and i don't know how to stop it.
I think I have some kind of death lock behavior between threads here, because the thread from the .COM device, is invoking some code from Main Form in order to call the correct window form. i really don't know what to do here.... the wierdest thing is that this just happen when the mouseover efects are invoked quickly, it's like the system can't handle the events quick enough, and one of them is ocurring when the "ShowDialog" call is running =\

Just guessing... :S I'm out of silly ideas to make this work
 
Er.. a background thread that is doing the com communication is used to create and show a UI window? No wonder your app stalls; as soon as that thread dies (and it will if there is nothing keeping it running) it stops serving the message queue it owns and the app becomes unresponsive. I suggest you review your multithreading; it's not windows' fault that your app is hanging because "the system can't handle the events quick enough" - it's the way it has been coded to handle the events.
 
i just want that window to pop up, if my .COM device receive a certain data, so it's the device thread that is calling the new form window, can i switch the threads, so that UI thread handle this? and how is my thread being killed in a "SHOWDIALOG" call????
 
Back
Top