[Python.NET] calling Finalize directly

mtraudt mtraudt at quantifisolutions.com
Thu May 12 17:31:22 CEST 2005


It reports an error.  It seems to not understand that your static Finalize()
method is different than the one called by the GC.  I agree that this is a
bug, although you might be better off changing the name to Cleanup() or
something else less likely to confuse compilers (and humans).

Mark Traudt
Quantifi Inc.
20 Commerce Drive
Cranford, NJ 07016
mtraudt at quantifisolutions.com
Phone: (908) 272-7740
Fax: (646) 304-3440
This message is intended solely for the designated recipient(s) named above
and may be legally privileged and/or confidential. If you are not the named
addressee you should not disseminate, distribute or copy this message.

> -----Original Message-----
> From: Brian Lloyd [mailto:brian at zope.com] 
> Sent: Thursday, May 12, 2005 10:55 AM
> To: mtraudt; pythondotnet at python.org
> Subject: RE: [Python.NET] calling Finalize directly
> > I realize that you cannot currently build on mono due to other 
> > limitations, but it seems that mcs also does not like the fact that 
> > you call Finalize() directly in some cases.
> > 
> > The MS compiler does not complain, although on MSDN it says 
> not to do 
> > this, and to use Dispose() instead.  Is there any reason 
> why you call
> > Finalize() directly?
> All of the Finalize methods that are called directly are 
> static methods (e.g., they are *not* destructor aliases and 
> unrelated to the Dispose pattern). They match (also static) 
> Initialize() methods for a few classes in the runtime that 
> can't rely on static constructors (because they need to be 
> run in a specific order).
> So I suspect that mcs is wrong in this case, but I'm not a 
> CLI laywer ;) Does mcs give you an error, or just a warning?
> Brian Lloyd        brian at zope.com
> V.P. Engineering   540.361.1716              
> Zope Corporation   http://www.zope.com 

More information about the PythonDotNet mailing list