[Mono-bugs] [Bug 573502] DataContractSerializer incorrectly reporting a bad XML file

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Jan 27 01:25:47 EST 2010


http://bugzilla.novell.com/show_bug.cgi?id=573502

http://bugzilla.novell.com/show_bug.cgi?id=573502#c1


Atsushi Enomoto <aenomoto at novell.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #1 from Atsushi Enomoto <aenomoto at novell.com> 2010-01-27 06:25:46 UTC ---
Not sure if it was broken in 2.6, but the sample above works fine in trunk.
Since the sample is bogus and does not compile, I rewrote it as below to
examine if the bug is valid:

//--------
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;
using System.Xml;


[Serializable]
    public enum DBDriver
    {
        SQLite = 1,
        MySQL = 2,
        Oracle = 3,
        Postgresql = 4,
        SQLServer = 5
    }

[Serializable]
    [DataContract]
    public class DBConnectionInfo //: IComparable<DBConnectionInfo>
    {
        [DataMember]
        public long ConnectionId { get; set; }
        [DataMember]
        public string ConnectionName { get; set; }
        [DataMember]
        public DBDriver Driver { get; set; }
        [DataMember]
        public string Host { get; set; }
        [DataMember]
        public int Port { get; set; }
        [DataMember]
        public string Username { get; set; }
        [DataMember]
        public string Password { get; set; }
        [DataMember]
        public string DatabaseName { get; set; }
        [DataMember]
        public string DBFilePath { get; set; }
//....
    }

[Serializable]
    [DataContract]
    public class Config
    {
        [DataMember]
        public string DefaultConnectionName {get;set;}
        [DataMember]
        public string RepoConnectionName {get;set;}

        public string TempFolder {get;set;}
        public string ConfigFilePath {get;set;}

        private List<DBConnectionInfo> _DBConnections;
        [DataMember]
        public List<DBConnectionInfo> DBConnections
        {
            get
            {
                if (_DBConnections == null)
                    _DBConnections = new List<DBConnectionInfo>();

                return _DBConnections;
            }
            private set { _DBConnections = value; }
        }
    }

public class TESt
{
        public static void Main (string [] args)
        {
                string configFilePath= args [0];
                    DataContractSerializer serz = new
DataContractSerializer(typeof(Config));
                    using (FileStream fs = new FileStream(configFilePath,
FileMode.Open))
                    {
                        using (XmlDictionaryReader xmlReader =
                            XmlDictionaryReader.CreateTextReader(fs, new
XmlDictionaryReaderQuotas()))
                        {
                            serz.ReadObject(xmlReader);
                        }
                    }
        }
}
//-------

-- 
Configure bugmail: http://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