Re: Help with error message on Application close

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Phil jenson (phil.jenson_at_jenson.co.uk.nospam)
Date: 10/01/04


Date: Fri, 1 Oct 2004 16:13:15 +0100

Jim,

As mentioned before I suspect your problem is related to calling Dispose
from a thread other than the main UI thread. Is it possible to place a break
point on a catch statement within you Dispose method and check the call
stack and also the thread that it is called on? If the application quits
without allowing you to debug then try writing relevant information to a
trace file.

I appreciate you say you never call Dispose, so I assume you have shown the
form with myForm.Show() as this is the main (only?) way Dispose would be
called automatically, when the form is closed. It should be called on the
main message handling thread, in which case the stack trace/thread display
should confirm this.

Alternatively are you doing something on another thread at the point of
closing the form? Are you doing and GDI+ drawing for example or anything
which (indirectly) uses windows handles? Again look at the other threads
active to see (if possible) what they are doing when the exception occurs.

Or do you already no for a fact it is not thread related?

If its easily reproducible and your code is easy to transfer than I would be
willing to have a look if you want to send it. I offer not as an expert on
these issues but because sometimes it helps to have a fresh view on a
problem.

Hope this gives you some ideas.

Phil...

"Jim H" <nospam@jimsaccount.com> wrote in message
news:eBLpZK2pEHA.3524@TK2MSFTNGP15.phx.gbl...
> Yes, I am still having that problem but it's very very intermittent. I'm
> still trying to find a pattern so I can duplicate the problem more
> regularly.
>
> Jim



Relevant Pages

  • RE: Calling Dispose instead of close, clear, ....
    ... Public Sub DisposeObject ... Dispose to __ComObect to do this for us? ... > of checking if an object ref is nothing before calling dispose on them. ... > datareader or sqlconnection, im calling the Dispose. ...
    (microsoft.public.dotnet.framework)
  • Re: FileWatcher
    ... There's nothing for you to "kill" at that point. ... As for the FileSystemWatcher instance itself, it implements IDisposable, so you are required to call Dispose() on it when you're done with it. ... Presumably, if it does in fact start a foreground thread, calling Dispose() will cause the thread to be shut down. ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Calling Dispose instead of close, clear, ....
    ... Dispose without a close is ... If the memory location is hooked to an expensive resource, ... connection, you could have that resource tied up for a bit, especially on a ... > of checking if an object ref is nothing before calling dispose on them. ...
    (microsoft.public.dotnet.framework)
  • Re: Dispose a managed object
    ... Just a fair warning that in some cases not calling Dispose() on unmanaged ... database connections, ... >> does free resources ASAP? ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Object disposal guidance needed
    ... This is discussed here manny times and it mostly indeed ends in a nothing saying thread ... In case you are wondering,, yes i am in the call dispose and set to nothing camp when it actually makes sense to do so, and if you are in doubt just do it, as it also doesn`t hurt while omitting it wil sure hurt your app. ... that says to avoid calling dispose on these objects. ... Luckily the newer Classes don't implement IDisposale anymore so much anymore as in past. ...
    (microsoft.public.dotnet.languages.vb)