Will the following catch an exception that occurs inside of StartNew()? It doesn't seem to.
try
{
Task.Factory.StartNew(() =>
{
//do something
});
}
catch(Exception ex)
{
//log it
}
No. Your try block will exit after the new task is created.
You can catch exceptions though. Please see: Catching Error when using Task.Factory for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With