I'm currently calling an async method and don't want to await it. I don't need the result for the async method and don't want to block during IO. However, if there is an error thrown in the async method I would like to catch it. So far I have:
public static void main () {
MyAsyncMethod().
ContinueWith(t => Console.WriteLine(t.Exception),
TaskContinuationOptions.OnlyOnFaulted);
//dostuff without waiting for result
}
This is not catching the exception thrown in MyAyncMethod from Main. Is there something I'm doing wrong?