Hello All, I am implement multithread in one background service ,
but i found some thread task assigned method never finish randomly ,Could you please help me here
var taskArray = selectedInventory.Select(Inventory =>
System.Threading.Tasks.Task.Factory.StartNew(() => {
ProcessData processData = new ProcessData();
processData.SomeCalculationmethod(Inventory);
})).ToList();
System.Threading.Tasks.Task.WaitAll(taskArray.ToArray());
I'm passing Inventory data with 5 record ,once finish all 5 task then it check and pick 5 record for process .
In Some cases randomly few record task is not finishing inner method of SomeCalculationmethod compeltely
Althought i have also used WaitAll to wait all task for complete