Properly catch and throw exceptions on message loop .invoke() calls (#79)

This commit is contained in:
Eugene Wang
2017-04-24 23:19:13 -04:00
parent 143e36e996
commit 3180e6bcf4
3 changed files with 44 additions and 3 deletions

View File

@@ -22,7 +22,14 @@ namespace Sample
// just an amusing example to do twain in console without UI
ThreadPool.QueueUserWorkItem(o =>
{
DoTwainWork();
try
{
DoTwainWork();
}
catch (Exception ex)
{
Console.WriteLine("ERROR: " + ex.ToString());
}
});
Console.WriteLine("Test started, press Enter to exit.");
Console.ReadLine();