We've a WCF / ASP.NET hosted web service. The data types in the service contract use XSD.exe generated types, and hence are decorated with XmlSerialization
attributes. We created a client for it using SvcUtil, including using the /ser:XmlSerializer
parameter. Been working for many years.
We just upgraded our build scripts to use VS 2012, and the v 8.0A Windows/.NET SDK NETFX 4.0 Tools version of SvcUtil.exe (v 4.0.30319.17929).
We are now seeing a strange error message when our client (built w/ VS 2012 and the new 8.0A SvcUtil) attempts to call the WCF service:
Type 'System.Threading.Tasks.Task1[MyNamespace.MyClient.MyDataStructure]' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. If the type is a collection, consider marking it with the CollectionDataContractAttribute. See the Microsoft .NET Framework documentation for other supported types.
This error prevents our application from being able to call the WCF service, and we're stuck.
I note that we are not passing a parameter to SvcUtil for /async
. I also note that the SvcUtil help for .NET SDK 8.0A (v 4.0.30319.17929) indicates that the default is to generate synchronous and task-based asynchronous method signatures.
Is there some built-in disconnect between System.Threading.Task
and XmlSerializer
?
Suggestions for how we can prevent the runtime from somehow thinking we're using DataContractSerialization
when we intend XmlSerialization
?
Have an answer from Microsoft, posted here.
Short is that /syncOnly
will be needed if you intend to build with .NET 4.5 SvcUtil
but target the .NET 4 runtime.