Suppose I have a TaskCompletionSource where I explicitly set its exception via SetException(Exception). Am I still required to access the Exception property of its task to avoid the
"A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread."
message?
Specific example:
try
{
ThreadEnd();
_disposeCompletionSource.SetResult(42);
}
catch (Exception e)
{
Log.FatalFormat("Caught unexpected exception while shutting down thread {0}:\n{1}", _thread.Name, e);
_disposeCompletionSource.SetException(e);
}
Do I need to Continue() the task to avoid rethrowing the exception on the finalizer thread or am I good?