Bug 9740 - Deserializing a WCF Web Object on Linux fails because only the local namespace of its parameters is considered.
Summary: Deserializing a WCF Web Object on Linux fails because only the local namespac...
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-01-23 14:08 UTC by ancientblasterv
Modified: 2013-02-02 05:04 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description ancientblasterv 2013-01-23 14:08:03 UTC
On Windows, with .NET. There is no issue serializing or deserializing the following WCF web object:

[DataContract]
public class Payload
{
    public Payload() {}

    public class SubPayloadOne
    {
        public String Name { get; set; }
        public int Count { get; set; }
    }

    public class SubPayloadTwo
    {
        public String Name { get; set; }
        public int Number { get; set; }
    }

    [DataMember]
    public SubPayloadOne P1 { get; set; }
    [DataMember]
    public SubPayloadTwo P2 { get; set; }
}

On Mono (on Ubuntu), attempting to deserialize the web object in the example above will result in the following error: System.InvalidOperationException: Failed to set value of type String[Payload+SubPayloadOne+Name] for property String[Payload+SubPayloadTwo+Name] String ---> System.ArgumentException: failed to convert parameters

Mono is not including the full namespace when deserializing the object. In other words, it is confusing Payload.SubPayloadTwo.Name for Payload.SubPayloadOne.Name, because both objects are "Name" if you do not consider their full namespace.

I resolved this problem by renaming Payload.SubPayloadOne.Name or Payload.SubPayloadTwo.Name to something else, for example, Payload.SubPayloadTwo.NameTwo, to avoid the conflict. 

Mono should take into account the full namespace of each parameter so that conflicts do not occur during deserialization.

(It's possible that this issue affects serialization as well)

Note You need to log in before you can comment on or make changes to this bug.