I am trying to passing complex data with event from server to client. DataContractSerializer class in namespace System.Runtime.Serialization is used in both serialization and deserialization. On server side, data are encoded to xml string and then passed with TriggerClientEvent. However, on the client side, it throws exception:
Error verifying System.Runtime.Serialization.DataContract/DataContractCriticalHelper:CreateDataContract (int,System.RuntimeTypeHandle,System.Type): Method System.Type:get_IsSerializable () is not accessible at 0x00c3
when method ReadObject is invoked.
This is how I try to deserialize a List of integers:
DataContractSerializer dcs = new DataContractSerializer(typeof(List<int>));
try {
List<int> deserialized_data = (List<int>)dcs.ReadObject(stream);
}
catch (Exception ex) {
Debug.WriteLine(ex.Message);
}
Is there any solution for data deserialization in client side?