相关疑难解决方法(0)

检查内部异常的最佳方法是什么?

我知道有时innerException是null

因此以下可能会失败:

 repEvent.InnerException = ex.InnerException.Message; 
Run Code Online (Sandbox Code Playgroud)

有没有快速的三元方法来检查innerException是否为null?

.net c# exception-handling exception

56
推荐指数
10
解决办法
8万
查看次数

找到最内层异常的正确方法?

我正在使用一些类,这些类在抛出时具有相对较深的InnerException树.我想记录并采取最内部的异常,这是具有问题真正原因的异常.

我目前正在使用类似的东西

public static Exception getInnermostException(Exception e) {
    while (e.InnerException != null) {
        e = e.InnerException;
    }
    return e;
}
Run Code Online (Sandbox Code Playgroud)

这是处理异常树的正确方法吗?

c# exception-handling exception

10
推荐指数
1
解决办法
2679
查看次数

The ADO.Net provider with Invariant name 'System.Data.SQLite.EF6' is not registered in the machine or application config file

So I've been struggling to try and get this resolved for a week or so now. When I attempt to run my application on another computer other than my development machine, I get the following error:

Schema specified is not valid. Errors: EntityFramework.RemManagerDBModel.ssdl(2,79): error 0175: The ADO.Net provider with invariant name 'System.Data.SQLite.EF6' is either not registered in the machine or application config file, or could not be loaded. See the inner exception for details.

I attempted to retrieve the inner …

.net c# sqlite winforms entity-framework-6

5
推荐指数
1
解决办法
3965
查看次数