[Mono-bugs] [Bug 321987] XmlSerializer requires default public constructor on Mono, but not on MS.NET

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Nov 6 13:43:32 EST 2007


https://bugzilla.novell.com/show_bug.cgi?id=321987#c1


Sebastien Pouliot <spouliot at novell.com> changed:

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




--- Comment #1 from Sebastien Pouliot <spouliot at novell.com>  2007-11-06 11:43:32 MST ---
This looks identical to the XML serializer issue fixed for SD.Image and is, as
far as I can test, already fixed.

--------------
Using Mono SVN HEAD.

poupou at pollux:~/src/bugzilla> mcs 321987.cs

poupou at pollux:~/src/bugzilla> mono 321987.exe

Unhandled Exception: System.InvalidOperationException: There was an error
reflecting type 'SomeTest.Test'. ---> System.InvalidOperationException:
SomeTest.Test cannot be serialized because it does not have a default public
constructor
  at System.Xml.Serialization.ReflectionHelper.CheckSerializableType
(System.Type type, Boolean allowPrivateConstructors) [0x00000]
  at System.Xml.Serialization.XmlReflectionImporter.ImportClassMapping
(System.Xml.Serialization.TypeData typeData,
System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace)
[0x00000]
  at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping
(System.Xml.Serialization.TypeData typeData,
System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace)
[0x00000] --- End of inner exception stack trace ---

  at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping
(System.Xml.Serialization.TypeData typeData,
System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace)
[0x00000]
  at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping
(System.Type type, System.Xml.Serialization.XmlRootAttribute root,
System.String defaultNamespace) [0x00000]
  at System.Xml.Serialization.XmlSerializer..ctor (System.Type type,
System.Xml.Serialization.XmlAttributeOverrides overrides, System.Type[]
extraTypes, System.Xml.Serialization.XmlRootAttribute root, System.String
defaultNamespace) [0x00000]
  at System.Xml.Serialization.XmlSerializer..ctor (System.Type type) [0x00000]
  at SomeTest.Test.Main () [0x00000]

poupou at pollux:~/src/bugzilla> gmcs 321987.cs

poupou at pollux:~/src/bugzilla> mono 321987.exe
<?xml version="1.0" encoding="utf-8"?>
<Test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" />


------------------
Windows

c:\temp>csc 321987.cs
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.


c:\temp>321987

Unhandled Exception: System.InvalidOperationException: SomeTest.Test cannot be
s
erialized because it does not have a default public constructor.
   at System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo
sourc
e, Boolean directReference)
   at System.Xml.Serialization.ModelScope.GetTypeModel(Type type, Boolean
direct
Reference)
   at System.Xml.Serialization.XmlSerializer..ctor(Type type, String
defaultName
space)
   at System.Xml.Serialization.XmlSerializer..ctor(Type type)
   at SomeTest.Test.Main()


C:\temp>csc 321987.cs
Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.


C:\temp>321987
<?xml version="1.0" encoding="IBM437"?>
<Test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://ww
w.w3.org/2001/XMLSchema" />
C:\temp>


-- 
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