I have a small winform tool with several jobs running in the background. They are triggered in a separate thread by calling StartPgTaskAsync
which was introduced to avoid freezing the UI but it seems to have an adverse effect on the debugger.
I often get this error message: To prevent an unsafe abort when evaluating the function 'System.Windows.Forms.Form.ToString' all threads were allowed to run. This may have changed the state of the process and any breakpoints encountered have been skipped.
var PgTask = PgTaskManager.StartPgTaskAsync(taskName); await ficTask;
public static Task StartPgTaskAsync(string taskName)
{
var task = Task.Run(() => StartPgTask(TaskName));
return task;
}
Is there something wrong doing the above ?