[Mono-bugs] [Bug 52155][Wis] New - XmlEnum attribute causes XmlSerializer to not identify the enum string.

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 14 Dec 2003 09:25:23 -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 erezl@mainsoft.com.


--- shadow/52155	2003-12-14 09:25:23.000000000 -0500
+++ shadow/52155.tmp.18180	2003-12-14 09:25:23.000000000 -0500
@@ -0,0 +1,95 @@
+Bug#: 52155
+Product: Mono/Class Libraries
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Priority: Wishlist
+Component: System.XML
+AssignedTo: lluis@ximian.com                            
+ReportedBy: erezl@mainsoft.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: XmlEnum attribute causes XmlSerializer to not identify the enum string.
+Please fill in this template when reporting a bug, unless you know what 
+you are doing.
+Description of Problem:
+Adding an '[XmlEnum]' to the definition of an enum value, causes the 
+XmlSerializer to not recognize the string that represents the value as a 
+valid enumeration value.
+Steps to reproduce the problem:
+1. Write a class that has enum type public member such as:
+public class WithEnum
+  public E e;
+and an enum that contains the XmlEnum attribute such as:
+public E
+  [XmlEnum()] E1,
+  [XmlEnum()] E2,
+  [XmlEnum()] E3,
+2. Try to serialize an instance of the WithEnum class using XmlSerializer.
+3. Try to deserialize the following XML data into an instance of WithEnum:
+<?xml version="1.0" encoding="utf-8"?>
+  <e>E1</e>
+Actual Results:
+1). When serializing to Xml, the WithEnum.e member is not serialized.
+2). When deserializing the above XML you will get the following exception:
+Expected Results:
+Unhandled Exception: System.InvalidOperationException: Invalid 
+enumeration value: E1
+in <0x00400> System.Xml.Serialization.EnumMap:GetEnumName (string)
+in <0x00071> 
+in <0x0005f> 
+in <0x00162> 
+lue (System.Xml.Serialization.XmlTypeMapElementInfo)
+in <0x00081> 
+nt (System.Xml.Serialization.XmlTypeMapElementInfo)
+in <0x0231c> 
+in <0x00058> 
+ceMembers (System.Xml.Serialization.XmlTypeMapping,object)
+in <0x0021e> 
+ce (System.Xml.Serialization.XmlTypeMapping,bool,bool)
+in <0x00067> 
+in <0x000a2> 
+System.Xml.Serialization.XmlSerializationReaderInterpreter:ReadObject ()
+in <0x00075> System.Xml.Serialization.XmlSerializer:Deserialize 
+in <0x00068> System.Xml.Serialization.XmlSerializer:Deserialize 
+in <0x0003f> System.Xml.Serialization.XmlSerializer:Deserialize 
+in <0x0008e> .Deserializer:Main (string[])
+How often does this happen? 
+Additional Information: