Menu

Strange stack trace...

2012-06-01
2012-06-09
  • Erik Funkenbusch

    I ran into this problem where an exception wasn't being logged, and when I looked at the stack trace found myself somewhat confused... Is this a bug? If not, how should this be dealt with to log such exceptions?

    [HttpRequestValidationException (0x80004005): A potentially dangerous Request.Form value was detected from the client (Password="dfTO5b"<T").]
    System.Web.HttpRequest.ValidateString(String value, String collectionKey, RequestValidationSource requestCollection) +8862660
    Microsoft.Web.Infrastructure.DynamicValidationHelper.<>c__DisplayClass12.<ReplaceCollection>b__d(String value, String key) +79
    Microsoft.Web.Infrastructure.DynamicValidationHelper.LazilyEvaluatedNameObjectEntry.ValidateObject() +89
    Microsoft.Web.Infrastructure.DynamicValidationHelper.LazilyValidatingArrayList.get_Item(Int32 index) +54
    System.Collections.Specialized.NameObjectCollectionBase.BaseGetAllKeys() +61
    System.Collections.Specialized.NameValueCollection.get_AllKeys() +15
    Elfar.Collection..ctor(NameValueCollection nvc) +51
    Elfar.ErrorLog..ctor(String application, ExceptionContext exceptionContext) +559
    Elfar.ErrorLogFilter.OnException(ExceptionContext exceptionContext) +101
    System.Web.Mvc.ControllerActionInvoker.InvokeExceptionFilters(ControllerContext controllerContext, IList`1 filters, Exception exception) +115
    System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +323
    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
    
     
    • Steven Bey

      Steven Bey - 2012-06-06

      Erik, the message of the exception explains what the problem is. Have a look at this blog post for an explanation and solution.

       
  • Erik Funkenbusch

    Steven,

    I was not asking how to solve the problem. It's already taken care of. My problem is that Elfar did not Log the exception, and the reason is unclear to me. The stack trace seems to indicate that when Elfar is trying to log the exception it somehow execute some Infrastructure code and it doesn't end up logging anything.

    I'm asking if this is a bug in Elfar, and if not how can I fix it so that these kinds of exceptions will in fact be logged. It seems like in order to log the exception, it has to validate the input.. which doesn't seem right to me.

     

    Last edit: Erik Funkenbusch 2012-06-06
    • Steven Bey

      Steven Bey - 2012-06-08

      Erik, one of the purposes of Elfar is to record user input, which means extracting information from Request.Form. It is during the process of extracting this information that the infrastructure code is being called. Elfar is not calling it directly and cannot avoid it.

      I have updated the Collection.cs file to handle this scenario but now have another problem. There is now an error, in the details page, when rendering the stack trace, as the format for the validation exception is very different to other exceptions. I am working on fixing this and will inform you when I have updated the nuget package.

       

      Last edit: Steven Bey 2012-06-08
  • Steven Bey

    Steven Bey - 2012-06-09

    Erik, I've fixed the stack trace problem and published the update nuget package.

    Thank you for all of the feedback that you've provided.

     

Log in to post a comment.