c# - 调试时如何查看异常?

标签 c# .net debugging exception logging

我正在这样使用 NLog

try
{
    // ... some code
}
catch(AException ex)
{
    logger.ErrorException(ex.Message, ex);
}

但是我想在调试的时候看到异常。所以我尝试了:

#if !DEBUG
    try
    {
#endif
        // ... some code
#if !DEBUG
    }
    catch(AException ex)
    {
        logger.ErrorException(ex.Message, ex);
    }
#endif

有没有更简洁的方法?

最佳答案

打开 First Chance Exceptions:CTRL-ALT-E(为 CLR 异常勾选抛出的列)

enter image description here

关于c# - 调试时如何查看异常?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9584795/

相关文章:

.net - Application.ThreadException : memory leak if not detached?

python - 保护 python 代码免受逆向工程

java - 如何在 Eclipse 远程调试器中找到有问题的线程?

c# - asp.net中如何实现 "Utilize SSL/TLS Session identifier" session 固定的解决方法

c# - 为什么LinqPad返回 The name 'ModelName' does not exist in the current context 错误?

c# - 如何使用 Linq to SQL 检索存储过程架构?

.net - 您如何将 LINQ-to-SQL 映射到您的 BLL 类?

c# - 为什么 System.Transactions TransactionScope 默认 Isolationlevel Serializable

c# - .NET 双重除法无效强制转换异常

c - libusb-1.0 调试信息