So basically, what I'm trying do is I want the parallel.foreach to repeat the log if an error is caught to the specific thread.
Parallel.ForEach(concurrentLogs, parallelOptions, log => try{ //Do work Console.WriteLine(log); } catch(Exception ex) { concurrentLogs.Enqueue(log); //repeat this log } }); Because when I'm debugging it, if a thread catches an error (ex. io exception) it won't repeat the same log anymore.
What could be a possible approach to this?
concurrentLogsIf it is a BlockingCollection you need to useGetConsumingEnumerable()