Bug 30444 - Different serialization of class inheriting Dictionary and implementing IXmlSerializable when using WCF
Summary: Different serialization of class inheriting Dictionary and implementing IXmlS...
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies (show other bugs)
Version: 4.0.0
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-05-26 10:01 UTC by Rafał
Modified: 2017-09-06 16:55 UTC (History)
2 users (show)

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

Project for reproduction + sent packets (3.31 KB, application/octet-stream)
2015-05-26 10:02 UTC, Rafał

Description Rafał 2015-05-26 10:01:06 UTC

First: Great job with Mono! Amazing tool.

I work with two applications: client and server, both C# .NET using WCF for communication. Lately I've been porting client application so that it can be deployed on Linux (ubuntu-14.04.2-desktop-amd64). Server remains on Windows. And then comes a problem with communication.

When contract sends an objects similar to:

public class MyData: Dictionary< string, string >, IXmlSerializable

I get different behavior depending on where the app runs:

Windows (both Mono and .Net) produces as XmlWrite dictates: <data><a>b</a><c>d</c></data>

Ubuntu produces as if it serializes dictionary: <data xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"><d4p1:KeyValueOfstringstring><d4p1:Key>a</d4p1:Key><d4p1:Value>b</d4p1:Value></d4p1:KeyValueOfstringstring><d4p1:KeyValueOfstringstring><d4p1:Key>c</d4p1:Key><d4p1:Value>d</d4p1:Value></d4p1:KeyValueOfstringstring></data>

It may be already solved problem that just Windows mono got already submitted and Ubuntu mono is behind, but 'mono --version' says the same version number:
Ubuntu: Mono JIT compiler version 4.0.1 (tarball Tue May 12 15:39:23 UTC 2015)
Windows: Mono JIT compiler version 4.0.1 (Visual Studio built mono)

I'm attaching small project on which I've reproduced an issue.

Currently I'm working around the problem by changing implementation to compose Dictionary instead of inheriting.

Comment 1 Rafał 2015-05-26 10:02:12 UTC
Created attachment 11328 [details]
Project for reproduction + sent packets

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