Bug 313611 (MONO52931) - Finalize() method and NullPointerException
Summary: Finalize() method and NullPointerException
Status: RESOLVED MOVED
Alias: MONO52931
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: unspecified
Hardware: Other Linux
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-16 13:19 UTC by Vadim Guzev
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 18:24:32 UTC


---- Reported by vguzev@yandex.ru 2004-01-16 06:19:46 MST ----

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



---- Additional Comments From lupus@ximian.com 2004-01-16 06:42:04 MST ----

Mcs bug, not in the runtime.

*** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO52933 ***


This bug was marked DUPLICATE in the database it was moved from.
    Changing resolution to "MOVED"