Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Handle all AggregateExceptions when using Task.Whenall() async

Task aggregationTask = null;
try{
  var task1 = DoSomethingAsync();
  var task2 = DoSomethingElseAsync();
  aggregationTask = Task.WhenAll(task1, task2);
  await aggregationTask;
}catch(Exception ex){  
  if(aggregationTask?.Exception?.InnerExceptions != null && aggregationTask.Exception.InnerExceptions.Any())
    foreach (var innerEx in aggregationTask.Exception.InnerExceptions){
      // do your magic here
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: unity variable in editor limit value 
Csharp :: C# if...else if Statement 
Csharp :: entity framework dynamic search 
Csharp :: c# razor @html.actionlink( edit bootstrap 
Csharp :: client = matrice[indexselectedclient] as String[]; 
Csharp :: c# textbox tab column 
Csharp :: grass download for unityh 
Csharp :: hacker typer.com 
Csharp :: process which converts natural sugar into alcohol by yeast 
Csharp :: c# linq get one object 
Csharp :: date format full month name c# selenium 
Csharp :: how to split a string in f# 
Csharp :: Permutation and Combination in C# 
Csharp :: C# Project File Create 
Csharp :: stringbuilder sb = new stringbuilder(reallylongstring); you need to identify whether a string stored in an object named stringtofind is within the stringbuilder sb object. 
Csharp :: c# return default "" if null 
Csharp :: c# hashset 
Csharp :: string methods in c# 
Csharp :: unity pause 
Csharp :: how to delete file in c# 
Csharp :: c# async in wpf 
Csharp :: c# code process to start any exe application 
Csharp :: how to mirror an image in vs forms 
Csharp :: cancellationtoken.linkedtokensource c# example 
Html :: fa fa email 
Html :: how to center text in svg 
Html :: centralize div bootstrap 
Html :: link email anchor to open up users email address 
Html :: html select required 
Html :: bootstrap large modal 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =