I have an IPC communication between service and WinForm app. They intercommunicate with the help of the class, which utilizes the following interface:
public interface IBaseIPC
{
Task<IPCConfig> GetConfig();
Task<IPCInfo> Activate(IPCConfig ipcConfig);
Task<IPCInfo> CancelActivation();
Task<IPCInfo> GetInfo();
Task<IPCInfo> Renew();
Task<string> TestConnection(IPCConfig ipcConfig);
}
When these methods were synchronous, it worked fine. Now when return type switched from being IPCConfig to Task, I'm getting an exception Type 'System.Threading.Tasks.Task`1[[IPCInfo]' in Assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable. I see that it tries to serialize Task and fails. Is there any way around this issue?