Dispose problem in destructor

Posted by gdb390 on 09-May-2011 07:41

Hello,

Problem with dispose in destructor ... (10.2B SP 4)

This is the situation :

* base form : base.cls,  has a components area

* custom specific form, inherits fomr base form) : has its own components area

In the destructor of both forms, there is following generated code :

        if valid-object(components) then do:
             cast(components, System.IDisposable):Dispose().
        end.

When I debug, I first go in the destructor of the custom specific form, no problems here ...

Following, I go into the destructor of the base ... I get an error on the end statement (thus not on the dispose method) :

System.ObjectDisposedException: Cannot access a disposed object.

However, the components was a valid object ...

Anyone an idea where to look for.

I tried to reproduce the error in a small test form, and was not able to reproduce it there ...

I compared the destructors, initializecomponent of each form, but I could'n t see a possible mistake

All Replies

Posted by jquerijero on 24-May-2011 14:15

This is hard to reproduce since the .NET side disposal is non-deterministic, but I have also encountered the problem.

This is related to how the .NET side object is getting disposed and the AVM still think it can use the disposed object.

This thread is closed