How to forward an exception from Task to the main stream of a WinForms application?
Scenario: There is a button, this button creates a task that performs some code in the background, an unhandled exception occurs in the task, and the main program needs to know about it.
I read MSDN and offered the following there:
1) Set Task.Wait, but in this case my UI will freeze.
2) Check the status of the Task. But where is it better to check and with what periodicity?
I did not find any events for Task.