Task.Wait Method (TimeSpan)
Waits for the Task to complete execution within a specified time interval.
Assemblies: System.Threading.Tasks (in System.Threading.Tasks.dll)
mscorlib (in mscorlib.dll)
The Task has been disposed.
timeout is a negative number other than -1 milliseconds, which represents an infinite time-out.
timeout is greater than MaxValue.
An exception was thrown during the execution of the task. The AggregateException.InnerExceptions collection contains information about the exception or exceptions.
is a synchronization method that causes the calling thread to wait for the current task instance to complete until one of the following occurs:
The task completes successfully.
The task itself is canceled or throws an exception. In this case, you handle an AggregateException exception. The AggregateException.InnerExceptions property contains details about the exception or exceptions.
The interval defined by timeout elapses. In this case, the current thread resumes execution and the method returns false.