[Mono-dev] Bug with XML Serialization

Lluis Sanchez lluis at ximian.com
Thu Aug 18 13:09:00 EDT 2005


Can you please file a bug report in bugzilla.ximian.com, and attach a
self contained test application that can be used to reproduce the
problem?

Thanks.

El dj 18 de 08 del 2005 a les 17:43 +0200, en/na knocte va escriure:
> Hello,
> 
> With VS.NET2003 I am able to serialize a class without errors, but with 
> Mono I obtain the following exception:
> 
> System.InvalidOperationException: System.Collections.IList cannot be serialized because it is an interface
> in <0x00142> System.Xml.Serialization.ReflectionHelper:CheckSerializableType (System.Type type, Boolean allowPrivateConstructors)
> in <0x000cd> System.Xml.Serialization.XmlReflectionImporter:ImportListMapping (System.Type type, System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace, System.Xml.Serialization.XmlAttributes atts, Int32 nestingLevel)
> in <0x008e7> System.Xml.Serialization.XmlReflectionImporter:CreateMapMember (System.Type declaringType, System.Xml.Serialization.XmlReflectionMember rmember, System.String defaultNamespace)
> in <0x00290> System.Xml.Serialization.XmlReflectionImporter:ImportClassMapping (System.Type type, System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace)
> in <0x00268> System.Xml.Serialization.XmlReflectionImporter:ImportClassMapping (System.Type type, System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace)
> in <0x00094> System.Xml.Serialization.XmlReflectionImporter:ImportTypeMapping (System.Type type, System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace)
> in <0x000b8> System.Xml.Serialization.XmlSerializer:.ctor (System.Type type, System.Xml.Serialization.XmlAttributeOverrides overrides, System.Type[] extraTypes, System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace)
> in <0x00015> System.Xml.Serialization.XmlSerializer:.ctor (System.Type type)
> in <0x00155> Maverick.View.XmlSerializingView:Go (IViewContext vctx)
> in <0x00050> Maverick.Flow.ViewWithTransforms:Go (IViewContext vctx)
> in <0x00152> Maverick.Flow.CommandBase:RunView (System.String viewName, Maverick.Flow.MaverickContext mctx)
> in <0x00033> Maverick.Flow.CommandBase:Go (Maverick.Flow.MaverickContext mctx)
> in <0x00185> Maverick.Dispatcher:ProcessRequest (System.Web.HttpContext context)
> in <0x00233> System.Web.HttpApplication+ExecuteHandlerState:Execute ()
> in <0x0007c> System.Web.HttpApplication+StateMachine:ExecuteState (IStateHandler state, System.Boolean readysync)
> 
> I am trying to deploy a website using Maverick.NET+Apache+mod_mono.
> 
> The portion of code that may conflict with this is:
> 
>   [XmlInclude(typeof(CAccion3A))]
>   public class Query : ControllerProtected {
>  
>     protected string cuenta;
>     protected string nombreEmpresa;
>     protected string operacion;
>  
>     protected CAccion3A[] actions3A;
>  
>     public IList Actions3A 
>     {
>       get {
>         if (this.actions3A == null)
>               return new ArrayList();
>         return new ArrayList(this.actions3A);
>       }
>     }
> 
> [...]
> 
> The result of the serialization using Microsoft runtime is:
> 
> <?xml version="1.0"?>
> <Query xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>   <Errors />
>   <Actions3A>
>     <anyType xsi:type="CAccion3A">
>       <Codigo>O0010745</Codigo>
>       <CustomerCode>ES30001-A38000332</CustomerCode>
>       <NombreEmpresa>ENTERPRISE SEA -MURCIA SEA 3017-</NombreEmpresa>
> 
>       <Nombre />
>       <Apellido1 />
>       <Apellido2 />
>       <Email />
>       <Direccion>0</Direccion>
>       <Numero />
>       <Piso />
>       <Puerta />
> 
>       <CodigoPostal />
>       <Poblacion />
>       <Pais>ES</Pais>
>       <Provincia>30</Provincia>
>       <Telefono />
>       <Fax />
>       <Eliminado />
>       <Delegacion>MURCIA</Delegacion>
>       <Objetivos />
>     </anyType>
>     <anyType xsi:type="CAccion3A">
> 
>       <Codigo>O0010745</Codigo>
>       <CustomerCode>ES33231-A280041032</CustomerCode>
>       <NombreEmpresa>ENTERPRISE SEA -MURCIA SEA 3017-</NombreEmpresa>
>       <Nombre />
>       <Apellido1 />
>       <Apellido2 />
>       <Email />
> 
>       <Direccion>0</Direccion>
>       <Numero />
>       <Piso />
>       <Puerta />
>       <CodigoPostal />
>       <Poblacion />
>       <Pais>ES</Pais>
>       <Provincia>30</Provincia>
>       <Telefono />
>       <Fax />
>       <Eliminado />
>       <Delegacion>MURCIA</Delegacion>
>       <Objetivos />
>     </anyType>
>   </Actions3A>
>   <Cuenta />
>   <NombreEmpresa>enterprise</NombreEmpresa>
>   <Operacion>busquedaPorEmpresa</Operacion>
> </Query>
> 
> If the IList doesn't contain any members, serialization should fallback 
> to "<Actions3A />".
> 
> Should I file a bug report? (I am using Mono 1.1.8.2.)
> 
> Regards,
> 
>     Andrew
> 




More information about the Mono-devel-list mailing list