[Mono-devel-list] Finalize method

Vadim B. Guzev vguzev at yandex.ru
Thu Jan 15 14:17:49 EST 2004


Hello, mono-devel-list at lists.ximian.com!


When I compile & run the following program:
8<--------------------------------------------------------------
using System;

public class A {
 public A() {
  Console.WriteLine( "Object a created!" );
 }
 public static void Finalize() {
  Console.WriteLine( "Object a finalized!" );
 }
}

public class B {
 public static void Main( string[] args ) {
  A a = new A();
  A.Finalize();
 }
}
8<--------------------------------------------------------------

the NullReferenceException is thrown:

8<--------------------------------------------------------------
bash$ mcs FinalizeTest.cs
Compilation succeeded
bash$ mono FinalizeTest.exe
Object a created!

Unhandled Exception: System.NullReferenceException: A null value was found
where an object instance was required
in (unmanaged) .A:Finalize ()
in <0x00034> .B:Main (string[])
8<--------------------------------------------------------------

Is it a bug?
I'm using Mono 0.28.


Best regards,
Vadim B. Guzev




More information about the Mono-devel-list mailing list