.net - Can I make an exception in Task.Run crash the program? -
i'm not big fan of quietly swallowed exceptions, following code that:
task.run(() => { var obj = dosomethingcpuintensive(); // returns null, due bug obj.domorestuff(); console.writeline("after"); // never here; program continues running }); i've read throwunobservedtaskexceptions configuration value, doesn't help, since never task returned (edit: help, in release builds).
is there way make unhandled exception crash program? using task.run in way i'm not supposed to?
it appears using task.run is, indeed, mistake. think i'm supposed await it, else silly things above happen.
when crash await, debugger rather unhelpful, looking this:

i take mean i'm doing wrong thing task.run here.
a simple fix use old threadpool.queueuserworkitem instead:

that's better! didn't need async/await in code anyway; used task.run because it's less typing.