First thing: This is a compact framework 3.5 application.
I have a very weird problem. In a Dispose-Method the application disposes items in a collection and after that clears the list. So far nothing special and it works like a charm when Dispose is called by my application. But as soon as the Garbage Collector calls the Finalizer, which calls the same Dispose-Method the system throws a NotSupported-Exception on the Clear-Method of the generic collection.
Here is the body of the Dispose-Method:
public override void Dispose()
{
if (items != null)
{
foreach (Shape item in items)
{
item.Dispose();
}
items.Clear();
items = null;
}
base.Dispose();
}
I'm totally stuck here. Maybe someone can explain this to me, or had a similar problem and solved it.