No Symbols error/Stackoverflow error


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I've started getting an error when I go to close down my app. The first thing I see is a "No Symbols" dialog...

When I close this, I receive this error:

After some investigation, I discovered that is a problem with how I'm disposing of a control I subclassed, but I don't know why.

I have a subclassed TreeView control that calls Dispose on a class that implements IDisposable.  The TreeView calls the Dispose of the internal object, that object does it's dispose business, returns to the TreeView, which when it hits end sub, immediately jumps back into the Dispose method of the internal object. My subclassed TreeView is called DataTreeView. It has a data provider, called MyDataProvider, which implements IDisposable. Here is an example of what I'm seeing:

System.ComponentModel.Component.Finalize()
--calls-->DataTreeView.Dispose(False)
--calls--> MyDataProvider.Dispose()
--calls--> MyDataProvider.Dispose(True) 
--back out to--> MyDataProvider.Dispose()
--back out to--> DataTreeView.Dispose(False)
--??--> MyDataProvider.Dispose(True)

To make things weirder, that last step doesn't halt on the first line of code, but on a line with a break point, although I hit F11. 

Now, while debugging this, trying to compose this message, it stopped causing errors, even though it still goes through the above cycle 6-8 times.

Any ideas what's going on? I'm throughly confused  Crazy

Thanks!

Reply
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Technically, you're not supposed to call another classes Dispose() from within your own Dispose(False) (when False is passed as the disposing value).  Mainly because False is passed when the object is being finalized by the GC, meaning that half of it's managed resources might have already been cleaned up.  So, in your DataTreeView.Dispose(ByVal disposing As Boolean), make sure that you don't call the Dispose() on your data provider unless the disposing argument is True.  Only clean up managed resources if the disposing argument is True.  And if you're worried about getting the data provider disposed if you don't call it... don't worry about it.  The GC will still take care of it.

http://msdn.microsoft.com/msdnmag/issues/07/07/CLRInsideOut/

http://www.bluebytesoftware.com/blog/PermaLink.aspx?guid=88e62cdf-5919-4ac7-bc33-20c06ae539ae

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search