X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2Fcorlib%2FSystem.Runtime.CompilerServices%2FTaskAwaiter_T.cs;h=b59a0ef005e3736eed23103ee90f822c9dd2f6b7;hb=99b5aad5ee74b270b33e3779cf14cf18d847db50;hp=bd1b0d4401f8e31fccf8a27c791a618f97e02e68;hpb=56d9663bb2bef253fbbcaed814bbc69a51a7f9d5;p=mono.git diff --git a/mcs/class/corlib/System.Runtime.CompilerServices/TaskAwaiter_T.cs b/mcs/class/corlib/System.Runtime.CompilerServices/TaskAwaiter_T.cs index bd1b0d4401f..b59a0ef005e 100644 --- a/mcs/class/corlib/System.Runtime.CompilerServices/TaskAwaiter_T.cs +++ b/mcs/class/corlib/System.Runtime.CompilerServices/TaskAwaiter_T.cs @@ -29,6 +29,7 @@ #if NET_4_5 +using System.Threading; using System.Threading.Tasks; using System.Runtime.ExceptionServices; @@ -51,6 +52,9 @@ namespace System.Runtime.CompilerServices public TResult GetResult () { + if (!task.IsCompleted) + task.WaitCore (Timeout.Infinite, CancellationToken.None, true); + if (task.Status != TaskStatus.RanToCompletion) ExceptionDispatchInfo.Capture (TaskAwaiter.HandleUnexpectedTaskResult (task)).Throw ();