void SetTimedOut() => _taskSource.TrySetException(new TimeoutException($"Timed out after expecting event of type {_eventType} for {_timeout.TimeSpan}"));
public static bool TrySetFromTask <T>(this TaskSource <T> target, Task <T> source, CancellationToken candidateToken) => source.IsCanceled ? target.TrySetCanceled(candidateToken.IsCancellationRequested ? candidateToken : CancellationToken.None) : source.Exception != null ? target.TrySetException(source.Exception) : target.TrySetResult(source.Result);