https://bugzilla.novell.com/show_bug.cgi?id=640402
https://bugzilla.novell.com/show_bug.cgi?id=640402#c0 Summary: XmlSerialization and GetConstructor not working on generic types Classification: Mono Product: MonoTouch Version: unspecified Platform: Macintosh OS/Version: Mac OS X 10.6 Status: NEW Severity: Major Priority: P5 - None Component: Runtime AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] CC: [email protected] Found By: Customer Blocker: Yes Description of Problem: Steps to reproduce the problem: 1. Create a class that inherits from a generic class that has a [Preserve(AllMembers=true)]. In my case I have the following (simplified): [Preserve(AllMembers=true)] public class BusinessObject { } [XmlType] public partial class Customer : BusinessObject { [XmlAttribute] public string Name {get; set;} } [Preserve(AllMembers=true)] public class BusinessObjects<T> : Collection<T> where T: BusinessObject { public BusinessObjects() { } public BusinessObjects(BusinessObject owner):this() { } } [XmlRoot("Customers")] public partial class Customers : BusinessObjects<Customer> { public Customers(Organization owner):base(owner) // Can remove for testing pruposes { } public Customers():base() { } } 2. Now try and use the the XmlSerializer to serialize the class. 3. Also try and call this extension method I wrote... always returns false. public static bool HasDefaultConstructor(this Type type) { if (type.IsPrimitive) { return true; } if (type.GetConstructor( BindingFlags.Public | BindingFlags.Instance | BindingFlags.CreateInstance, null, new Type[0], null) != null) { return true; } return false; } ----- Test Xml <Customers> <Customer Name="Zim" /> <Customer Name="Zum" /> </Customers> Actual Results: The constructor does not get preserved when using reflection even though [Preserve(AllMembers=true)] on the base class. The XmlSerializer failes with a SIGNEV Expected Results: How often does this happen? if the class is not used directly in the code path from Main()... everytime Additional Information: -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
