Here's pure async example without any workarounds.
private async Task ProcessReport(Report report, ConcurrentDictionary<int, string> reportDictionary)
{
var (reportPath, bindingOrder, reportParameters) = report;
var exportedImage = await _exporter.Export(_reportServerUrl, reportPath, export, reportParameters);
if (exportedImage == null)
{
throw new InvalidOperationException($"Could not render report {reportIdentifier} with binding order {bindingOrder}.");
}
reportDictionary.GetOrAdd(bindingOrder, exportedImage);
}
var reportDictionary = new ConcurrentDictionary<int, string>();
List<Task> tasks = new List<Task>();
foreach (var report in request.Reports)
{
tasks.Add(ProcessReport(report, reportDictionary));
}
await Task.WhenAll(tasks);