Why doesn't Visual Studio break this unhandled exception?

When you submit a form in Visual Studio, a yellow death screen appears even in debug mode. The problem I encountered is resolved, this is the missing value of the resource, but I am wondering why I cannot break the exception.

I tried the following but nothing has changed:

  • Code execution.
  • Change Debug -> Exceptions Settings Debug -> Exceptions .
  • Checking Enable .NET Framework source stepping and Enable source server support .

How can one catch such an exception, or why is it impossible to catch it?

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

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

Source Error:

An unhandled exception was thrown during the execution of the current web request. Information about 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 
+4
source share
2 answers

This exception cannot be broken because the publicly available Microsoft Symbol server does not provide source code for everything.

Adding a breakpoint through the dialog to System.ComponentModel.DataAnnotations.ValidationContext.set_DisplayName will be interrupted, but Visual Studio will say that there is no source code.

+1
source

It looks like you have some dataAnnotationAttribute attribute for the model, so asp.net will take care of this - before your request calls a breakpoint in the controller

0
source

Source: https://habr.com/ru/post/1442309/


All Articles