✅ Foreach vs Parallel.ForEach with Async mehtods

I recently changed my code who had foreach to Parallel.Foreach. This foreach has multiples asynchronous methods and when i run with simple foreach ,the methods are called normally but, when i changed foreach to Parallel.Foreach looks like the code not work well , he literally goes crazy, one time runs ok and other time throws exception , why this occurs ? Am i done something wrong ? My project are in .NET CORE 3.1. Follow my code with foreach and Parallel.Foreach.
image.png
image.png
Was this page helpful?