[Mono-devel-list] Finalize method

Ben Maurer bmaurer at users.sourceforge.net
Fri Jan 16 00:25:57 EST 2004


Yes, that does look like a bug. Likely, the runtime thinks that you are
making a finalizer. Please file this in bugzilla.

On Thu, 2004-01-15 at 14:17, Vadim B. Guzev wrote:
> 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
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list




More information about the Mono-devel-list mailing list