[Mono-bugs] [Bug 433908] Problem with Npsql and pooling

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Oct 9 10:51:37 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=433908

User informatique.internet at fiducial.fr added comment
https://bugzilla.novell.com/show_bug.cgi?id=433908#c2





--- Comment #2 from Hubert FONGARNAND <informatique.internet at fiducial.fr>  2008-10-09 08:51:37 MDT ---
In fact, this is not a problem with Npgsql it comes from mono :

if a class inherits for another class with a destructor, this destructor (of
the parent class) will never be called if the final class hasn't a destructor

small test case :

public static void Main(string[] args)
        {
                 TestFinalizer() ;
        }

        class ParentClass
        {
                ~ParentClass()
                {
                        Console.WriteLine("Destuctor of parent called");
                }
                public ParentClass()
                {
                }
        }

        class ChildClass : ParentClass
        {
                public ChildClass()
                {
                }
        }

        private static void TestFinalizer()
        {
                for (int i=0;i<100;i++){
                        ChildClass cnx=new ChildClass();
                        cnx=null;
                        GC.Collect();
                        Console.ReadLine();
                }
        }



If you run it on mono 2-0 it display nothing when you press enter

If you run it on mono 1.9 it displays :
Destuctor of parent called

Destuctor of parent called

Destuctor of parent called


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list