Re: WindowsForm freezes on second launch by bigreddog
bigreddog
Mon Feb 21 07:52:51 CST 2005
Elp,
Thanks for your feedback. I have a couple places in my code where I
catch an Exception and do nothing. I also do a couple of Try Catch
statements where there is no specific Exception caught.
What should I be doing differently with the Exceptions? Send them to
the Event Viewer?
Elp wrote:
> On 18 Feb 2005 05:19:09 -0800, bigreddog wrote:
>
> > I have a WindowsForm application that I developed on my XP
workstation.
> > It is a nulti-threaded socket application that sends and receives
> > messages. On my workstation I can close and restart the application
> > normally with no ill effects.
> >
> > Now when I put the application on a Windows 2000 Server it runs
> > perfectly fine the first time around. However, when I close the
> > application and try to restart it the second time it won't show the
UI,
> > minimizes itself to the taskbar and Task Manager shows it as Not
> > Responding.
>
> The first thing i would do, as it is a multi-threaded application, is
to
> make sure that, each time you are accessing a UI element, you are
doing it
> from the UI thread. You may simply have forgot an Invoke somewhere
where
> you were accessing a UI control from a worker thread.
>
> Also, check your code to make sure that you never swallow exceptions
(ie
> catch an exception and hide it by doing nothing) and that you never
catch
> all exceptions with a catch(Exception ex) statement instead of
catching a
> particular exception type. Doing this kind of things may hide the
reason of
> the problem.