Reputation: 90465
I'm using NLog like this
try
{
// ... some code
}
catch(AException ex)
{
logger.ErrorException(ex.Message, ex);
}
But I want to see the exception when debugging. So I tried:
#if !DEBUG
try
{
#endif
// ... some code
#if !DEBUG
}
catch(AException ex)
{
logger.ErrorException(ex.Message, ex);
}
#endif
Is there a neater way of doing that?
Upvotes: 5
Views: 126
Reputation: 300489
Turn on First Chance Exceptions: CTRL-ALT-E (tick the thrown column for CLR exceptions)
Upvotes: 6
Reputation: 21855
Don't do it this way. It's better to turn on Exception notification on Debug->Exceptions. This way you will see exceptions when they are created even if they are handled latter on.
Upvotes: 2