views:

300

answers:

1

I have a WCF service reference (= client proxy) generated by Visual Studio 2008 (.net 3.5 sp1). The generated code contains a data contract with DateTimeOffset properties so naturally VS decorated it with KnowTypeAttribute(System.DateTimeOffset).

Whenever I invoke a WCF operation that returns the above mentioned data contract, I get the following exception:

Type 'System.DateTimeOffset' cannot be added to list of known types since another type 'System.Runtime.Serialization.DateTimeOffsetAdapter' with the same data contract name 'http://schemas.datacontract.org/2004/07/System:DateTimeOffset' is already present

I understand that DateTimeOffsetAdapter is a struct in System.Runtime.Serialization that is used when serializing DateTimeOffset objects. So why does it cause this exception and how can this be fixed or avoided?

A: 

Have you tried manually creating the proxy? Code generation is not required for proxies and in many cases you're much better off coding it by hand.

Terry Donaghe