I use a pattern including tasks in C# where I do
Task.Factory.StartNew( .something... )
.ContinueWith(t=> {
try{ t.Wait() }
catch(Exception ex) ...
});
if something
forexample includes WCF code or other exception throwing stuff. That way Im sure that the tasks have been waited for I dont get those finalizer exceptions and I can consistently log error messages.
Recently I have seen that t.Wait() throws ObjectDisposed exception. Is my pattern wrong or should I keep the continue with only on TaskContinuationOptions.NotOnRanToCompletion
.