[Mono-bugs] [Bug 52931][Nor] New - Finalize() method and NullPointerException

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 16 Jan 2004 06:19:46 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by vguzev@yandex.ru.

http://bugzilla.ximian.com/show_bug.cgi?id=52931

--- shadow/52931	2004-01-16 06:19:46.000000000 -0500
+++ shadow/52931.tmp.8591	2004-01-16 06:19:46.000000000 -0500
@@ -0,0 +1,71 @@
+Bug#: 52931
+Product: Mono/Runtime
+Version: unspecified
+OS: GNU/Linux [Other]
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: vguzev@yandex.ru               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Finalize() method and NullPointerException
+
+Description of Problem:
+When I declare and use Finalize() method the NullReferenceException is 
+thrown
+
+Steps to reproduce the problem:
+1. Write the following program (A.cs)
+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<--------------------------------------------------------------
+
+2. Compile it
+mcs A.cs
+
+3. Run it
+mono A.exe
+
+Actual Results:
+8<--------------------------------------------------------------
+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<--------------------------------------------------------------
+
+Expected Results:
+8<--------------------------------------------------------------
+Object a created!
+Object a finalized!
+8<--------------------------------------------------------------
+
+How often does this happen? 
+Always
+
+Additional Information:
+It was tested on Mono 0.28