I upgraded a .NET 2.0 Winform Application build with VS2005 to .NET 3.5 SP1. build by VS 2008
The application had a memory leak in .NET 2.0 caused by a ToolStripControl that was referenced by a UserPreferenceChangedEventHandler.
Upgrading to .NET 3.5 fixed the issue. I still have a problem with DataGridViews.
They are also referenced by a UserPreferenceChangedEventHandler.
Are there some common problems with DataGridViews that prevent forms containing them not being recycled by the garbage collector?
For anything implementing
IDisposableyou should callDispose().DataGridViewis one of those… which in turn ensures that it unregisters the static event handler you mention…