[Mono-bugs] [Bug 405277] New: XML Serializer fails on nullable typed enums

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Jul 1 04:36:22 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=405277


           Summary: XML Serializer fails on nullable typed enums
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: frozen at frozen-solid.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


If a class contains a nullable typed enum variable, XML Serializer will fail
with a null reference exception.  In VS 2008 .net 3.5 it will output the null
variable with no problems.

Code example:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml.Serialization;
using System.IO;

namespace TestXMLSerial
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            TestXML tester = new TestXML();
            XmlSerializer serializer = new XmlSerializer(typeof(TestXML));
            using (StreamWriter serialWriter = new
StreamWriter("C:\\test.xml"))
            {
                serializer.Serialize(serialWriter, tester);
                serialWriter.Close();
            }
        }
    }

    public class TestXML
    {
        private DialogResult? result;

        public DialogResult? Result
        {
            get { return result; }
            set { result = value; }
        }
    }
}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list