I have this code:
Dim Tasks As New List(Of Task)
Tasks.Add(Task.Factory.StartNew(Sub()
'Do whatever
End Sub))
Tasks.Add(Task.Factory.StartNew(Sub()
'Do some stuff here
End Sub))
Tasks.Add(Task.Factory.StartNew(Sub()
'Do more code
End Sub))
Task.WaitAll(Tasks.ToArray())
This is being done in an ASP.NET application and is causing problems in production. I want to disable the task threading so that all the anonymous methods execute consecutively, but this means rewriting the code to turn the anonymous methods into actual methods and then calling them. It would really be nice if there were setting that would cause the collection of tasks to not behave in such a threaded manner. Is this possible?
If I understand your question correctly, you want to use the RunSynchronously method of the Task.