How to use Application.ThreadException

0
0

Hi,

I use Application.ThreadException to handle global exception, but not sure how to use it properly:

  1. Register Application.ThreadException += ThreadException_Handler should be called only once or each time  when user opens new browser (a new session)?
  2. Where/when should I call function Application.ThreadException -= ThreadException_Handler  to unregister handler?

Thank you for your help.

Page

  • You must to post comments
0
0

Hi,

when I open multi tab browser (multi session), it calls the function Main multiple time and that means Application.ThreadException += Application_ThreadException is attached more than one?

Page

  • Kevin
    • Kevin
    • Aug 26, 2021 - 9:27 pm
    Exception will be raise only on session throw it.
  • You must to post comments
0
0

Hi

Just add theses line for rise Exception Globaly

static void Main()

{
Application.ThreadException += Application_ThreadException;

}

There is no need to detach any event on Application, it’s all done automatically

Happy coding,

Kevin (ITG)

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.