I've created the contract
[ServiceContract]
public interface ITestService
{
[OperationContract]
[NetDataContract]
void PassGuid(Guid id);
[OperationContract]
[NetDataContract]
void PassInt(int id);
}
Attribute NetDataContractAttribute
described here.
When I'm calling PassGuid
I get an error:
Additional information: The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:id. The InnerException message was 'XML 'Element' 'http://tempuri.org/:id' does not contain expected attribute 'http://schemas.microsoft.com/2003/10/Serialization/:Type'. The deserializer has no knowledge of which type to deserialize. Check that the type being serialized has the same contract as the type being deserialized.'. Please see InnerException for more details.
But PassInt
could be called with no errors.
Full source code here.
Edited: This question is not about efficiency of sending guids, like this one, it is mostly about using NetDataContractSerializer.