很难理解Stack Trace

时间:2011-05-05 00:50:46

标签: c# .net asp.net-mvc

我很难重新制作场景或者读取我今天在日志上遇到的以下错误..通常堆栈跟踪会指向文件和行号等但是如下所示它只会说nullreference没有给我具体位置的例外情况..如果你能帮助我阅读这个并找出正在发生的事情,我将不胜感激。

System.Web.HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerWrapper'. ---> System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object.
  at ASP.views_reservation_checkout_aspx.__RenderContent2(HtmlTextWriter __w, Control parameterContainer)
  at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
  at ASP.content_kismetvacation_views_shared_site_master.__RenderBodyContent(HtmlTextWriter __w, Control parameterContainer)
  at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
  at ASP.content_kismetvacation_views_shared_site_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer)
  at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
  at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
  at System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer)
  at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  at System.Web.UI.Page.HandleError(Exception e)
  at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  at System.Web.UI.Page.ProcessRequest()
  at System.Web.UI.Page.ProcessRequest(HttpContext context)
  at System.Web.Mvc.ViewPage.ProcessRequest(HttpContext context)
  at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.<>c__DisplayClass4.<Wrap>b__3()
  at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap[TResult](Func`1 func)
  at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)
  at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)
  at System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage)
  at System.Web.HttpServerUtilityWrapper.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm)
  at System.Web.Mvc.ViewPage.RenderView(ViewContext viewContext)
  at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
  at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass14.<InvokeActionResultWithFilters>b__11()
  at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation)
  at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult)
  at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName)
  at System.Web.Mvc.Controller.ExecuteCore()
  at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__4()
  at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass1.<MakeVoidDelegate>b__0()
  at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
  at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object.
  at ASP.views_reservation_checkout_aspx.__RenderContent2(HtmlTextWriter __w, Control parameterContainer)
  at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
  at ASP.content_kismetvacation_views_shared_site_master.__RenderBodyContent(HtmlTextWriter __w, Control parameterContainer)
  at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
  at ASP.content_kismetvacation_views_shared_site_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer)
  at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
  at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
  at System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer)
  at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  at System.Web.UI.Page.HandleError(Exception e)
  at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  at System.Web.UI.Page.ProcessRequest()
  at System.Web.UI.Page.ProcessRequest(HttpContext context)
  at System.Web.Mvc.ViewPage.ProcessRequest(HttpContext context)
  at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.<>c__DisplayClass4.<Wrap>b__3()
  at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap[TResult](Func`1 func)
  at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)

2 个答案:

答案 0 :(得分:3)

堆栈跟踪的顶行是从最深处(发生错误的位置)开始,以及随后的回显堆栈的后续行。

我删除了System。*条目(它放入.NET Framework中),剩下的是你的页面和类,大部分都是。它使它更具可读性,可能更易于管理......

System.Web.HttpException (0x80004005): Error executing child request for handler 'System.Web.Mvc.HttpHandlerUtil+ServerExecuteHttpHandlerWrapper'. ---> System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object.
  at ASP.views_reservation_checkout_aspx.__RenderContent2(HtmlTextWriter __w, Control parameterContainer)
  at ASP.content_kismetvacation_views_shared_site_master.__RenderBodyContent(HtmlTextWriter __w, Control parameterContainer)
  at ASP.content_kismetvacation_views_shared_site_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer)

System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NullReferenceException: Object reference not set to an instance of an object.
  at ASP.views_reservation_checkout_aspx.__RenderContent2(HtmlTextWriter __w, Control parameterContainer)
  at ASP.content_kismetvacation_views_shared_site_master.__RenderBodyContent(HtmlTextWriter __w, Control parameterContainer)
  at ASP.content_kismetvacation_views_shared_site_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer)

我在那里看到你的内容页面:* views_reservation_checkout_aspx *
和视图:* content_kismetvacation_views_shared_site_master *

最深点显示名为ASP.views_reservation_checkout_aspx的网页(ASP / views / reservation / checkout.aspx?),因此您应该将调试工作集中在那里的对象和控件上。

在该页面中尝试的事情:

  • 在Visual Studio中设置断点
    • 逐行遍历您的代码,
    • 一路检查null
    • 的事物实例
    • 在空的实例上查找成员调用(例如方法或属性)。
  • 修复并重复

答案 1 :(得分:0)

是的,null引用异常可能有点棘手。看起来它正在“预订结账”视图中发生。