Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / April 2006

Tip: Looking for answers? Try searching our database.

ObjectDisposedException... but no object???

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
joelcochran@gmail.com - 21 Apr 2006 16:42 GMT
I'm running VS2005 and it seems that whenever I try to exit a form I
receive the following:

 ObjectDisposedException was unhandled.
 Safe Handle was closed.

The Stacktrace shows this:
  at System.Runtime.InteropServices.SafeHandle.DangerousRelease()
  at System.Threading.RegisteredWaitHandleSafe.Finalize()

I don't even know where to begin since the exception does not indicate
a particular object.

Any help would be most appreciated.

--
Joel
MFP (Most Frustrated Person)
Kevin Westhead - 25 Apr 2006 19:58 GMT
Is that the full stack trace?

It looks like a registered wait handle already has a reference count of zero
when it is finalised, which should never occur for safe handles that have
not been explicitly disposed. Are you making any calls to
SafeHandle.DangerousRelease() that might be unbalancing the reference
counting on the safe handle? If you're not aware that you're using safe
handles, are you using any custom controls or using the thread pool?

Signature

Kevin Westhead

> I'm running VS2005 and it seems that whenever I try to exit a form I
> receive the following:
[quoted text clipped - 14 lines]
> Joel
> MFP (Most Frustrated Person)
joelcochran@gmail.com - 25 Apr 2006 20:53 GMT
I am definitely not explicitly calling SafeHandle.DangerousRelease().
I do have user controls and some threading.
Kevin Westhead - 26 Apr 2006 18:12 GMT
I might have misunderstood your original post, so could you clarify if you
are seeing this when

 a) closing a form at run-time
 b) closing the form designer at design-time in VS 2005.

If it's a), you'll have to provide some more information about how you're
using threading. E.g. one of the ways to create an instance of
RegisteredWaitHandleSafe (an internal class) is to call
ThreadPool.RegisterWaitForSingleObject, but without more details it's
difficult to offer any concrete advice.

If it's b), have you tried debugging VS 2005 with another instance of VS
2005? You also might want to turn on all MDAs when debugging.

Signature

Kevin Westhead

>I am definitely not explicitly calling SafeHandle.DangerousRelease().
> I do have user controls and some threading.
joelcochran@gmail.com - 26 Apr 2006 20:27 GMT
I receive the error when I close a form at run time (executed in VS
using F5).  I have seen this behaviour both in forms that use threading
and forms that do not.

Interesting thought about debugging VS with VS... no idea how I would
go about such a thing.  And what are "MDAs"?

Thanks for your patience,

Joel
Kevin Westhead - 30 Apr 2006 18:09 GMT
I don't think debuggin VS will help you, it's only useful for when you're
debugging design-time issues. MDAs are Managed Debug Assistants, and you can
turn them on/off via the exceptions dialog (under the Debug menu). It's
usually worthwhile turning them all on initially, although some scenarios,
such as XML serialization, can cause them to fire frequently, but you can
always turn them off again.

Is this a modal or a non-modal form that you are displaying? Is it being
disposed of after it is being closed? Can you post some code?

Signature

Kevin Westhead

>I receive the error when I close a form at run time (executed in VS
> using F5).  I have seen this behaviour both in forms that use threading
> and forms that do not.
>
> Interesting thought about debugging VS with VS... no idea how I would
> go about such a thing.  And what are "MDAs"?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.