Bug 14609 - Data contract name is not correct for a generic type
Summary: Data contract name is not correct for a generic type
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies (show other bugs)
Version: master
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-09-10 12:50 UTC by Jon Goldberger [MSFT]
Modified: 2013-09-28 20:59 UTC (History)
3 users (show)

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


Attachments
test project (468.77 KB, application/zip)
2013-09-10 12:50 UTC, Jon Goldberger [MSFT]
Details

Description Jon Goldberger [MSFT] 2013-09-10 12:50:47 UTC
Created attachment 4826 [details]
test project

I'm having the same problem as described here.

For example: [DataContract] public class SomeGenericClass {...}

.NET will determine the data contract name using the name of T and a hash of the type's namespace name. The hash is important to avoid contract name collisions. The possibility of collisions may sound remote, but in our case we can use types such as ModelA.Customer and ModelB.Customer, and a data contract name formed only from the type name, such as "SomeGenericClassOfCustomer", is insufficient.

Xamarin does not appear to support the hash in the data contract name, either by default or passed with the name parameter. For example, the following will fail with a System.ArgumentException - "localName must be a valid NCName.":

[DataContract(Name="SomeGenericClassOf{0}{#}")]
public class SomeGenericClass<T> {...} 
Granted, complex data contracts like this are not a good idea, but we have a legacy WCF service that supports a number of different clients, and data contract name interoperability is important for us.

Are there any plans to make this work the same as it does in .NET?

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