Deadlock when combining app domain remoting and tasks
问题 My app needs to load plugins into separate app domains and then execute some code inside of them asynchronously. I've written some code to wrap Task in marshallable types: static class RemoteTask { public static async Task<T> ClientComplete<T>(RemoteTask<T> remoteTask, CancellationToken cancellationToken) { T result; using (cancellationToken.Register(remoteTask.Cancel)) { RemoteTaskCompletionSource<T> tcs = new RemoteTaskCompletionSource<T>(); remoteTask.Complete(tcs); result = await tcs.Task