我习惯于C#和vb.net winforms,通常可以通过设置断点并遍历我的代码来找到所需的所有错误。如何调试mvc4剃须刀视图?
我想知道我做错了什么。
我把一个断点位置:
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'。 –