Running application GUI disappears

H

hermbagger

I wrote a windows application in C# (using visual studio 2003) which
I
am running as an executable on a Windows Server 2003 machine. The
application runs smoothly for days. Then out of nowhere, the GUI
diappears and there is no way that I can get back to the GUI. If I
look at the Task Manager, i can see the process of my application
running, and I can also view log files that my application has
created
continue to grow, but I cannot access the GUI of my applicaiton
anymore. Does anyone know what is going on and why?

Thanks!!!
herm
 
P

Peter Duniho

I wrote a windows application in C# (using visual studio 2003) which I
am running as an executable on a Windows Server 2003 machine. The
application runs smoothly for days. Then out of nowhere, the GUI
diappears and there is no way that I can get back to the GUI. If I
look at the Task Manager, i can see the process of my application
running, and I can also view log files that my application has created
continue to grow, but I cannot access the GUI of my applicaiton
anymore. Does anyone know what is going on and why?

Nope.

It sort of sounds like your form got closed somehow, but you have other
thread that are not background threads (that is, specifically marked as
background with the IsBackground property). It could be as simple as an
application that doesn't shut things down when the main form gets closed,
and then some user accidently closing the form, or some sort of bug that
causes the form to sponaneously close or be hidden.

I would say the first thing to do is override the OnFormClosed method, and
maybe also the OnVisibleChanged method, and include some sort of logging
or user alert to help you know if and when the form is closed or hidden.
If you can reproduce the issue in a debugger-friendly setting, go so far
as to include a call to Debugger.Break() in those methods, so that the
application just stops and you can take a look at what's closing the form.

If you want to get really fancy, I suppose you could do some tricks with
suspending the thread from a different thread, getting a stack trace, and
then allowing the main thread to continue. That may be overkill though,
depending on what else you can do.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top