【发布时间】:2013-06-26 07:06:22
【问题描述】:
我习惯了 C# 和 vb.net winforms,通常只需设置断点并单步执行我的代码即可找到我需要的所有错误。
我想知道我做错了什么。
我在这里设置断点:
public ActionResult Index(int id)
{
var cnty = from r in db.Clients
where r.ClientID == id
select r;
if (cnty != null) // breakpoint here
{
return View(cnty); // F11 jumps over this section of code returning me to the error page below.
}
return HttpNotFound();
}
再一次,我不知道它到底在哪里或为什么出错了。我怎样才能找出它抛出的原因或更好的是什么错误?
我正在使用 VS2012 mvc4 c#。
【问题讨论】:
-
不是直接答案,但
cnty永远不会是null。它可能是empty,但不是null。
标签: c# asp.net-mvc debugging razor