I have project that uses wcf. Currently it uses NetDataContractSerializer. I want to migrate to protobuf-net. My service has folowing contract:
interface IRemotingServer
{
[OperationContract]
TypeConfig GetTypeConfig(string typename);
[OperationContract]
object ExecuteMethod(InstanceIdentifier instance, string methodName, object[] parameters);
[OperationContract]
object ExecuteGenericMethod(InstanceIdentifier instance, string methodName, object[] parameters, string[] genericTypes, string returnType);
[OperationContract]
object GetRemoteProperty(InstanceIdentifier instance, string propertyName);
[OperationContract]
void SetRemoteProperty(InstanceIdentifier instance, string propertyName, object value);
[OperationContract]
ObjectDataPacket GetObject(InstanceIdentifier instance);
[OperationContract]
bool Connect();
[OperationContract]
bool Disconnect();
}
things goes fine, until i try call GetRemoteProperty method of my contract which return type is object. Using server traces i found, that server blows up with folowing message
There was an error while trying to serialize parameter http://www.mersoft.am/Remoting:GetRemotePropertyResult. The InnerException message was 'Type 'Mersoft.Remoting.InstanceIdentifier[]' with data contract name 'ArrayOfInstanceIdentifier:Mersoft.Remoting' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.'. Please see InnerException for more details.
So, how can i fix it?