Thursday, 29 August 2013

Force Disposal of an Inaccessible Static Object

Force Disposal of an Inaccessible Static Object

Is there a way to force an object to be disposed along with any objects
(including static) which it references when that object is in a library /
you do not have access to the source? The library is .Net code - but the
dispose method on the presented object does not completely clean up the
object (presumably because some singleton's persisted in the background /
not available to my code).
The reason I ask is to solve a problem working with the Dynamics AX .Net
Business Connector (BC) [see Dynamics AX 2009 Business Connector Logon.
Essentially this is a connection object, only the class stores information
about the first instance's parameters in some variable which persists for
the process lifetime; thus preventing the use of other instances of the
object from accepting parameters different to those given to the first
instance.
I'm hoping to run some method which will make it look like the process has
ended from the point of view of the BC (but not from the rest of my code
running in the same process), or to call some dispose/finalize method
which is also able to clean up the static information accessible only
internally by the BC.

No comments:

Post a Comment