Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Catching First Chance Exceptions in Managed Code without being debugged [duplicate]

Tags:

c#

debugging

clr

Is there a way to catch First-Chance exceptions, and log them without running under a debugger?

I suppose another way to ask the question is can I write something that will act like a debugger being attached to my process and see what is going wrong while it happens?

like image 661
halivingston Avatar asked Oct 13 '22 23:10

halivingston


1 Answers

If you are on .NET 4.0, you can use theAppDomain.FirstChanceExceptionevent to get notification of exceptions.

like image 129
Ani Avatar answered Oct 30 '22 04:10

Ani