Log message pump error.

This commit is contained in:
Eugene Wang
2025-12-25 23:14:44 -05:00
parent 39c0373d3c
commit e9733a6b54

View File

@@ -104,13 +104,13 @@ namespace NTwain
void RunMessagePump() void RunMessagePump()
{ {
_twain?.Logger.LogDebug("Starting TWAIN message pump thread."); _twain?.Logger.LogDebug("Starting TWAIN message pump thread.");
Application.ThreadException += Application_ThreadException;
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
_dummyForm = new DummyForm(); _dummyForm = new DummyForm();
_dummyForm.FormClosed += (s, e) => _dummyForm.FormClosed += (s, e) =>
{ {
_dummyForm = null; _dummyForm = null;
}; };
Application.ThreadException += Application_ThreadException;
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
Application.Run(_dummyForm); Application.Run(_dummyForm);
_twain?.Logger.LogDebug("TWAIN message pump thread exiting."); _twain?.Logger.LogDebug("TWAIN message pump thread exiting.");
} }