[Mono-bugs] [Bug 670560] New: WCF fails to unify Arrays and Lists in KnownTypeCollection

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Wed Feb 9 06:03:03 EST 2011


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

https://bugzilla.novell.com/show_bug.cgi?id=670560#c0


           Summary: WCF fails to unify Arrays and Lists in
                    KnownTypeCollection
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.8.x
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: WCF
        AssignedTo: atsushi at ximian.com
        ReportedBy: david at dasz.at
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US)
AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.84 Safari/534.13

When building the KnownTypeCollection for the following datacontract:

    [DataContract]
    public class Data
    {
        [DataMember]
        public Data[] DataArray { get; set; }

        [DataMember]
        public List<Data> DataList { get; set; }
    }

it fails with the following exception:

    <?xml version="1.0" encoding="utf-8"?>
    <Fault xmlns="http://schemas.microsoft.com/ws/2005/05/envelope/none">
    <Code>
    <Value
xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:InternalServiceFault</Value></Code>
    <Reason>
    <Text xml:lang="en-GB">Failed to add type
System.Collections.Generic.List`1[DataMemberTest.Data] to known type
collection. There already is a registered type for XML name
http://schemas.datacontract.org/2004/07/DataMemberTest:ArrayOfData:
DataMemberTest.Data[]</Text></Reason>
    <Detail>
    <ExceptionDetail xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.datacontract.org/2004/07/System.ServiceModel">
    <HelpLink i:nil="true" />
    <InnerException i:nil="true" />
    <Message>Failed to add type
System.Collections.Generic.List`1[DataMemberTest.Data] to known type
collection. There already is a registered type for XML name
http://schemas.datacontract.org/2004/07/DataMemberTest:ArrayOfData:
DataMemberTest.Data[]</Message>
    <StackTrace>  at
System.Runtime.Serialization.KnownTypeCollection.RegisterCollection
(System.Type type) [0x0009c] in
/srv/CCNet/mono/src/mono.git/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/KnownTypeCollection.cs:717 
      at System.Runtime.Serialization.KnownTypeCollection.TryRegister
(System.Type type) [0x00061] in
/srv/CCNet/mono/src/mono.git/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/KnownTypeCollection.cs:638 
      at System.Runtime.Serialization.SharedContractMap.GetMembers (System.Type
type, System.Xml.XmlQualifiedName qname, Boolean declared_only) [0x0003d] in
/srv/CCNet/mono/src/mono.git/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.cs:551 
      at System.Runtime.Serialization.SharedContractMap.Initialize () [0x00053]
in
/srv/CCNet/mono/src/mono.git/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.cs:530 
      at System.Runtime.Serialization.KnownTypeCollection.RegisterContract
(System.Type type) [0x0004e] in
/srv/CCNet/mono/src/mono.git/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/KnownTypeCollection.cs:801 
      at System.Runtime.Serialization.KnownTypeCollection.TryRegister
(System.Type type) [0x00045] in
/srv/CCNet/mono/src/mono.git/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/KnownTypeCollection.cs:632 
      at System.Runtime.Serialization.XsdDataContractExporter.ExportCore
(System.Type type, Boolean rejectNonContract) [0x00091] in
/srv/CCNet/mono/src/mono.git/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/XsdDataContractExporter-new.cs:222 
      at System.Runtime.Serialization.XsdDataContractExporter.Export
(System.Type type) [0x00000] in
/srv/CCNet/mono/src/mono.git/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/XsdDataContractExporter-new.cs:199 
      at System.ServiceModel.Description.WsdlExporter.GetSchemaElementForPart
(System.ServiceModel.Description.MessagePartDescription part,
System.Xml.Schema.XmlSchema schema) [0x00012] in
/srv/CCNet/mono/src/mono.git/mcs/class/System.ServiceModel/System.ServiceModel.Description/WsdlExporter.cs:529 
      at System.ServiceModel.Description.WsdlExporter.ExportParameters
(System.ServiceModel.Description.MessageBodyDescription msgbody, System.String
name, System.String ns) [0x000da] in
/srv/CCNet/mono/src/mono.git/mcs/class/System.ServiceModel/System.ServiceModel.Description/WsdlExporter.cs:469 
      at
System.ServiceModel.Description.WsdlExporter.ExportMessageBodyDescription
(System.ServiceModel.Description.MessageBodyDescription msgbody, System.String
name, System.String ns) [0x00037] in
/srv/CCNet/mono/src/mono.git/mcs/class/System.ServiceModel/System.ServiceModel.Description/WsdlExporter.cs:415 
      at System.ServiceModel.Description.WsdlExporter.ExportContractInternal
(System.ServiceModel.Description.ContractDescription contract, Boolean
rejectDuplicate) [0x00185] in
/srv/CCNet/mono/src/mono.git/mcs/class/System.ServiceModel/System.ServiceModel.Description/WsdlExporter.cs:130 
      at System.ServiceModel.Description.WsdlExporter.ExportEndpoint
(System.ServiceModel.Description.ServiceEndpoint endpoint, Boolean
rejectDuplicate) [0x00000] in
/srv/CCNet/mono/src/mono.git/mcs/class/System.ServiceModel/System.ServiceModel.Description/WsdlExporter.cs:188 
      at System.ServiceModel.Description.WsdlExporter.ExportEndpoints
(IEnumerable`1 endpoints, System.Xml.XmlQualifiedName name) [0x0005a] in
/srv/CCNet/mono/src/mono.git/mcs/class/System.ServiceModel/System.ServiceModel.Description/WsdlExporter.cs:364 
      at System.ServiceModel.Description.ServiceMetadataExtension.get_Metadata
() [0x00011] in
/srv/CCNet/mono/src/mono.git/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceMetadataExtension.cs:74 
      at System.ServiceModel.Description.HttpGetWsdl.GetMetadata () [0x00012]
in
/srv/CCNet/mono/src/mono.git/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceMetadataExtension.cs:305 
      at System.ServiceModel.Description.HttpGetWsdl.EnsureMetadata ()
[0x0000b] in
/srv/CCNet/mono/src/mono.git/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceMetadataExtension.cs:181 
      at System.ServiceModel.Description.HttpGetWsdl.Get
(System.ServiceModel.Channels.Message req) [0x00000] in
/srv/CCNet/mono/src/mono.git/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceMetadataExtension.cs:188 
      at (wrapper managed-to-native)
System.Reflection.MonoMethod:InternalInvoke
(System.Reflection.MonoMethod*,object,object[],System.Exception&amp;)
      at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags
invokeAttr, System.Reflection.Binder binder, System.Object[] parameters,
System.Globalization.CultureInfo culture) [0x000d5] in
/srv/CCNet/mono/src/mono.git/mcs/class/corlib/System.Reflection/MonoMethod.cs:223
</StackTrace>
     
<Type>System.InvalidOperationException</Type></ExceptionDetail></Detail></Fault>

(i've added the colliding type to the error message in my local mono fork).

As can be seen, the Array gets registered first and the try to register the
List fails due to both being mapped to ArrayOfData.

Please use the attached test solution to demonstrate the problem by trying to
access the service's WSDL.

Reproducible: Always

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