2012-10-26 52 views
4

提交表单时,即使处于Visual Studio中的调试模式下也会出现黄色死亡屏幕。我遇到的问题已经解决,这是一个缺少资源价值,但我感兴趣的是为什么我无法打破异常。为什么Visual Studio不能处理这个未处理的异常?

我尝试以下,但没有任何改变的情况:

  • 逐步执行代码。
  • 更改Debug -> Exceptions设置。
  • 检查Enable .NET Framework source steppingEnable source server support

这样的例外怎么会被抓到,或者为什么不能抓住它?

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentNullException: Value cannot be null. Parameter name: value

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[ArgumentNullException: Value cannot be null. 
Parameter name: value] 
    System.ComponentModel.DataAnnotations.ValidationContext.set_DisplayName(String value) +52015 
    System.Web.Mvc.<Validate>d__1.MoveNext() +135 
    System.Web.Mvc.<Validate>d__5.MoveNext() +318 
    System.Web.Mvc.DefaultModelBinder.OnModelUpdated(ControllerContext controllerContext, ModelBindingContext bindingContext) +139 
    System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Object model) +66 
    System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +1367 
    System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +449 
    System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +317 
    System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +117 
    System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +343 
    System.Web.Mvc.Controller.ExecuteCore() +116 
    System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +97 
    System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10 
    System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37 
    System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21 
    System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12 
    System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62 
    System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +50 
    System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7 
    System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22 
    System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60 
    System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8970061 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184 
+1

听起来像模型一样,模型中的参数或其他传递回控制器的参数具有空值。 VS并没有打破异常,因为它发生在MVC内核(ModelBinding)内部。 – Tommy

+0

@Tommy我试过的第三件事情是不是让我步入MVC代码? – Stijn

+0

如果您没有在您的机器/项目中加载System.Web.Mvc的.pdb文件,则不需要。调试器必须将这些.pdb文件分步编译为源代码。 – Tommy

回答

1

这是不可能把这个异常突破,因为微软的公共Symbol Server不提供任何东西的源代码。

添加经由对话断点System.ComponentModel.DataAnnotations.ValidationContext.set_DisplayName将打破,但Visual Studio会说,没有可用的源代码。

0

看起来你有一些dataAnnotationAttribute的模型字段,所以asp.net照顾一下吧 - 你的要求火灾断点前在控制器