[Mono-bugs] [Bug 75233][Nor] New - constructor incomplete in System.Runtime.Serialization.Formatter resulting in NullReferenceException when using

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Jun 11 13:48:40 EDT 2005


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 dlacroix at erasme.org.

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

--- shadow/75233	2005-06-11 13:48:40.000000000 -0400
+++ shadow/75233.tmp.13434	2005-06-11 13:48:40.000000000 -0400
@@ -0,0 +1,70 @@
+Bug#: 75233
+Product: Mono: Class Libraries
+Version: 1.1
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: System
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: dlacroix at erasme.org               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: constructor incomplete in System.Runtime.Serialization.Formatter resulting in NullReferenceException when using
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+The constructor of System.Runtime.Serialization.Formatter class is incomplete. 
+
+It is it's job to initialize the following properties of the abstract class:
+
+protected ObjectIDGenerator m_idGenerator;
+protected Queue m_objectQueue;
+
+else, if you use the helper method GetNext and Schedule you will receive an
+exception because of nul value. Of course, you can initialie them in you
+Formatter implementation but I don't think it is the place to do that.
+
+Steps to reproduce the problem:
+1. Write a Formatter which inherit from System.Runtime.Serialization.Formatter
+2. Create new instance of you serializer
+3. Call the virtual Schedule method in your formatter
+
+
+
+Actual Results:
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in <0x00038> System.Runtime.Serialization.Formatter:Schedule (System.Object
+obj)
+
+
+Expected Results:
+no exception
+
+
+How often does this happen? 
+every time
+
+
+Additional Information:
+Here is a proposed patch:
+
+--- ./mcs/class/corlib/System.Runtime.Serialization/Formatter.cs       
+2005-03-30 23:21:42.000000000 +0200
++++ ./mcs/class/corlib/System.Runtime.Serialization/Formatter.cs.new   
+2005-06-11 19:37:20.548182208 +0200
+@@ -43,6 +43,8 @@
+ {
+        protected Formatter ()
+        {
++               m_objectQueue = new Queue ();
++               m_idGenerator = new ObjectIDGenerator ();
+        }
+
+        protected ObjectIDGenerator m_idGenerator;


More information about the mono-bugs mailing list