MVC5 Razor NullReferenceException in Model

后端 未结 1 1013
情话喂你
情话喂你 2020-12-17 08:58

For some reason I\'m getting a NullReferenceException whenever I try to access my model.

Here is the code from my controller:

public async Task

        
相关标签:
1条回答
  • 2020-12-17 09:45

    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.

    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.

    0 讨论(0)
提交回复
热议问题