且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MVC5剃刀的NullReferenceException在型号

更新时间:2023-02-24 20:12:45

有些时候,编译器上具有特定类型的错误,在剃刀观点可能是准确的线不能点,因为它不能保持堆栈跟踪或其他地方的行号。我发现这种情况下,与空引用异常,当空的Url.Content传递。

Some times compiler could not point on exact lines having specific kind of errors in razor view may be because it could not keep their line number in stack trace or somewhere. I have found this case with Null Reference Exception and when null is passed in Url.Content.

所以它有助于检查剃刀查看下一个C#语句时,你没有得到通过堆栈跟踪显示线路上的任何错误。

So it helps to check the next C# statement in razor view when you did not get any error on the line shown by stack trace.