Beispiel #1
0
 /// <summary>
 /// Waits for a task to complete and logs all exceptions except those
 /// that return true from <see cref="IsCriticalException"/>, which are
 /// rethrown, and <see cref="OperationCanceledException"/>, which is always ignored.
 /// </summary>
 public static T WaitAndHandleAllExceptions <T>(
     this Task <T> task,
     IServiceProvider site,
     Type callerType = null,
     [CallerFilePath] string callerFile      = null,
     [CallerLineNumber] int callerLineNumber = 0,
     [CallerMemberName] string callerName    = null,
     bool allowUI = true
     )
 {
     return(task.HandleAllExceptions(site, callerType, callerFile, callerLineNumber, callerName, allowUI)
            .WaitAndUnwrapExceptions());
 }