Found the issue: As soon as I iterate through the models list via AsParallel().ForAll , it might happen (depends on the CPU workload) the task to create has not been yet created but is being accessed by the WhenAll method, and retrieves the exception mentioned above. This happens sometimes, as I said based on the CPU workload. To reproduce the issue easily, I created a unit test that calls to the problematic method up to 50 times, and usually fails before 10 runs. In order to solve the issue, I replaced the AsParallel().ForAll by ForEachand the issue does not happen anymore because the tasks are always created, no matter the CPU workload. Code will be as follows, to solve the issue:
List<Model> ftpModels = _service.CreateFtpModel(rowsFromDB); List<Task> asyncTasks = new List<Task>(); ftpModels.ForEach(p => { asyncTasks.Add(DoStepsAsync(p)); }); // Wait for all the tasks to finish. await Task.WhenAll(asyncTasks.Where(p => p != null)); I hope it helps in the future to other people.