Catching First Chance Exceptions in Managed Code w

2019-05-03 09:53发布

问题:

This question already has an answer here:

  • Is there a way to log or intercept First Chance Exceptions 3 answers

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?

回答1:

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



标签: c# clr debugging