[Mono-bugs] [Bug 40161][Wis] New - XmlSerializer doesn't work, throws NullReferenceException

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Sun, 23 Mar 2003 00:34:19 -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 duncan@ximian.com.

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

--- shadow/40161	Sun Mar 23 00:34:19 2003
+++ shadow/40161.tmp.26780	Sun Mar 23 00:34:19 2003
@@ -0,0 +1,71 @@
+Bug#: 40161
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: System.XML
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: duncan@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: XmlSerializer doesn't work, throws NullReferenceException
+
+I'm testing System.Xml.Serialization using a demo I found online. The demo
+goes like this:
+
+a) Write an XML Schema, named wedding.xsd,
+b) Using xsd.exe, create a corresponding C# class, wedding.cs
+c) Write an instance of 'wedding' in XML, call it 'input.xml'.
+c) Write a C# app called client.cs, reads input.xml using an XmlSerializer
+and reads the public fields out the Wedding object built from 'input.xml'.
+
+With only the MS libraries, the expected output is:
+
+C:\duncan>client < input.xml
+Husband is 20 years old.
+Wife is 20 years old.
+
+With Mono's System.Xml, running on Windows, the output is:
+
+<Duncan Mak@FRICATIVE: /cygdrive/c/Documents and Settings/duncan/My
+Documents/Visual Studio
+Projects/serialization/bin/Debug>./serialization.exe < ../../inp
+ut.xml
+Error (type is 'System.Int32)'
+Error (type is 'System.Int32)'
+Husband is 0 years old.
+Wife is 0 years old.
+
+With Mono on Linux:
+
+duncan@affricate:~/src $ mono client.exe < input.xml
+Error (type is 'System.Int32)'
+
+Unhandled Exception: System.NullReferenceException: A null value was found
+where an object instance was required
+in (unmanaged) mono [0x80bfc90]
+in (unmanaged) mono(mono_field_set_value+0x76) [0x80bfe26]
+in (unmanaged) mono [0x80c5179]
+in <0x000ce> 00 System.Reflection.MonoField:SetValue
+(object,object,System.Reflection.BindingFlags,System.Reflection.Binder,System.Globalization.CultureInfo)
+in <0x00806> 00 System.MonoType:InvokeMember
+(string,System.Reflection.BindingFlags,System.Reflection.Binder,object,object[],System.Reflection.ParameterModifier[],System.Globalization.CultureInfo,string[])
+in <0x005aa> 00 System.Xml.Serialization.XmlSerializer:DeserializeField
+(System.Xml.XmlReader,object&,string)
+in <0x000d6> 00 System.Xml.Serialization.XmlSerializer:DeserializeComposite
+(System.Xml.XmlReader,object&)
+in <0x00512> 00 System.Xml.Serialization.XmlSerializer:DeserializeField
+(System.Xml.XmlReader,object&,string)
+in <0x000d6> 00 System.Xml.Serialization.XmlSerializer:DeserializeComposite
+(System.Xml.XmlReader,object&)
+in <0x00061> 00 System.Xml.Serialization.XmlSerializer:Deserialize
+(System.Xml.XmlReader)
+in <0x00041> 00 System.Xml.Serialization.XmlSerializer:Deserialize
+(System.IO.TextReader)
+in <0x0004e> 00 .app:Main ()