Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ELMAH is not logging offending code line number

I am using ELMAH's default configuration that was setup by NuGet pacakge manager. However, ELMAH does not provide any information about the line number of the offending code in my project. Instead, it provides stack trace of all the DotNet Framework assembly that is not written by me. This is not helpful at all. Here is a message that was generated by ELMAH. I remember that previous version of ELMAH provides the offending line number. Am I not setting it up correctly? If yes, how to configure it so that it log more about my code instead of DotNetFramework assembly code. Thanks.

    System.NullReferenceException: Object reference not set to an instance of an object.
Generated: Wed, 01 May 2013 17:02:01 GMT

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 CMT.Layout_Minimal.Page_Load(Object sender, EventArgs e)
   at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Control.LoadRecursive()
   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 ASP.views_home_index_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\cmt\ac6025a2\ff8bb1d1\App_Web_3rkpnltk.1.cs:line 0
   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__DisplayClass1a.<InvokeActionResultWithFilters>b__17()
   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.Async.AsyncControllerActionInvoker.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
   at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
   at System.Web.Mvc.MvcHandler.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Server Variables 
Name    Value
ALL_HTTP    HTTP_CONNECTION:Keep-Alive HTTP_ACCEPT:application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* HTTP_ACCEPT_ENCODING:gzip, deflate HTTP_ACCEPT_LANGUAGE:en-US HTTP_AUTHORIZATION:Negotiate TlRMTVNTUAADAAAAGAAYAJIAAABsAWwBqgAAAAoACgBYAAAAGAAYAGIAAAAYABgAegAAABAAEAAWAgAAFYKI4gYBsR0AAAAPBgj6Q45dj8Kyb2sqnLxvylYASABBADIAMABWAEgAQQBQAE8AUgBZAEEATgBHAEoAMgBQAE8AUgAtAFcAUwAxADEAMwAyADQANgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC7nNsl/caJIJPkzgxg5U+NAQEAAAAAAACGkJOYjUbOAeFZUa2rwexmAAAAAAIABgBSADAAMQABABYAUgAwADEAUABPAFIAVwBFAEIAMAA1AAQAHAByADAAMQAuAG0AZQBkAC4AdgBhAC4AZwBvAHYAAwA0AFIAMAAxAFAATwBSAFcARQBCADAANQAuAHIAMAAxAC4AbQBlAGQALgB2AGEALgBnAG8AdgAFAAwAdgBhAC4AZwBvAHYABwAIAIaQk5iNRs4BBgAEAAIAAAAIADAAMAAAAAAAAAABAAAAACAAABkcBXJIYj/+piQK47PXZvDBf1Ob0I9TzBXq717N16HQCgAQAAAAAAAAAAAAAAAAAAAAAAAJAEgASABUAFQAUAAvAHMAdABhAGcAaQBuAGcALgBjAGwAaQBuAGEAcABwAHMALgB2ADIAMAAuAG0AZQBkAC4AdgBhAC4AZwBvAHYAAAAAAAAAAAAAAAAAg170Qmrhcms8BZfrbsdJiA== HTTP_COOKIE:ASP.NET_SessionId=4jxcuwvdata3hsccv1awzqw1; ASP.NET_SessionId=na1xooefe0ha1m54qctikdpv HTTP_HOST:xxxxxxx HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; MS-RTC LM 8; .NET4.0C; .NET4.0E) 
ALL_RAW Connection: Keep-Alive Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* Accept-Encoding: gzip, deflate Accept-Language: en-US Authorization: Negotiate TlRMTVNTUAADAAAAGAAYAJIAAABsAWwBqgAAAAoACgBYAAAAGAAYAGIAAAAYABgAegAAABAAEAAWAgAAFYKI4gYBsR0AAAAPBgj6Q45dj8Kyb2sqnLxvylYASABBADIAMABWAEgAQQBQAE8AUgBZAEEATgBHAEoAMgBQAE8AUgAtAFcAUwAxADEAMwAyADQANgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC7nNsl/caJIJPkzgxg5U+NAQEAAAAAAACGkJOYjUbOAeFZUa2rwexmAAAAAAIABgBSADAAMQABABYAUgAwADEAUABPAFIAVwBFAEIAMAA1AAQAHAByADAAMQAuAG0AZQBkAC4AdgBhAC4AZwBvAHYAAwA0AFIAMAAxAFAATwBSAFcARQBCADAANQAuAHIAMAAxAC4AbQBlAGQALgB2AGEALgBnAG8AdgAFAAwAdgBhAC4AZwBvAHYABwAIAIaQk5iNRs4BBgAEAAIAAAAIADAAMAAAAAAAAAABAAAAACAAABkcBXJIYj/+piQK47PXZvDBf1Ob0I9TzBXq717N16HQCgAQAAAAAAAAAAAAAAAAAAAAAAAJAEgASABUAFQAUAAvAHMAdABhAGcAaQBuAGcALgBjAGwAaQBuAGEAcABwAHMALgB2ADIAMAAuAG0AZQBkAC4AdgBhAC4AZwBvAHYAAAAAAAAAAAAAAAAAg170Qmrhcms8BZfrbsdJiA== Cookie: ASP.NET_SessionId=4jxcuwvdata3hsccv1awzqw1; ASP.NET_SessionId=na1xooefe0ha1m54qctikdpv Host: xxxxxxx User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; MS-RTC LM 8; .NET4.0C; .NET4.0E) 
APPL_MD_PATH    /LM/W3SVC/3/ROOT/CMT
APPL_PHYSICAL_PATH  E:\xxxxx\CMT\
AUTH_TYPE   Negotiate
AUTH_USER   xxxxxxx
AUTH_PASSWORD   *****
LOGON_USER  xxxxxxx
REMOTE_USER xxxxxxx
CERT_COOKIE  
CERT_FLAGS   
CERT_ISSUER  
CERT_KEYSIZE     
CERT_SECRETKEYSIZE   
CERT_SERIALNUMBER    
CERT_SERVER_ISSUER   
CERT_SERVER_SUBJECT  
CERT_SUBJECT     
CONTENT_LENGTH  0
CONTENT_TYPE     
GATEWAY_INTERFACE   CGI/1.1
HTTPS   off
HTTPS_KEYSIZE    
HTTPS_SECRETKEYSIZE  
HTTPS_SERVER_ISSUER  
HTTPS_SERVER_SUBJECT     
INSTANCE_ID 3
INSTANCE_META_PATH  /LM/W3SVC/3
LOCAL_ADDR  10.165.50.180
PATH_INFO   /cmt/
PATH_TRANSLATED E:\xxxxxxx\
QUERY_STRING     
REMOTE_ADDR 10.165.57.90
REMOTE_HOST 10.165.57.90
REMOTE_PORT 30998
REQUEST_METHOD  GET
SCRIPT_NAME /cmt/
SERVER_NAME xxxxxxx
SERVER_PORT 80
SERVER_PORT_SECURE  0
SERVER_PROTOCOL HTTP/1.1
SERVER_SOFTWARE Microsoft-IIS/7.5
URL /cmt/
HTTP_CONNECTION Keep-Alive
HTTP_ACCEPT application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
HTTP_ACCEPT_ENCODING    gzip, deflate
HTTP_ACCEPT_LANGUAGE    en-US
HTTP_AUTHORIZATION  Negotiate TlRMTVNTUAADAAAAGAAYAJIAAABsAWwBqgAAAAoACgBYAAAAGAAYAGIAAAAYABgAegAAABAAEAAWAgAAFYKI4gYBsR0AAAAPBgj6Q45dj8Kyb2sqnLxvylYASABBADIAMABWAEgAQQBQAE8AUgBZAEEATgBHAEoAMgBQAE8AUgAtAFcAUwAxADEAMwAyADQANgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC7nNsl/caJIJPkzgxg5U+NAQEAAAAAAACGkJOYjUbOAeFZUa2rwexmAAAAAAIABgBSADAAMQABABYAUgAwADEAUABPAFIAVwBFAEIAMAA1AAQAHAByADAAMQAuAG0AZQBkAC4AdgBhAC4AZwBvAHYAAwA0AFIAMAAxAFAATwBSAFcARQBCADAANQAuAHIAMAAxAC4AbQBlAGQALgB2AGEALgBnAG8AdgAFAAwAdgBhAC4AZwBvAHYABwAIAIaQk5iNRs4BBgAEAAIAAAAIADAAMAAAAAAAAAABAAAAACAAABkcBXJIYj/+piQK47PXZvDBf1Ob0I9TzBXq717N16HQCgAQAAAAAAAAAAAAAAAAAAAAAAAJAEgASABUAFQAUAAvAHMAdABhAGcAaQBuAGcALgBjAGwAaQBuAGEAcABwAHMALgB2ADIAMAAuAG0AZQBkAC4AdgBhAC4AZwBvAHYAAAAAAAAAAAAAAAAAg170Qmrhcms8BZfrbsdJiA==
HTTP_COOKIE ASP.NET_SessionId=4jxcuwvdata3hsccv1awzqw1; ASP.NET_SessionId=na1xooefe0ha1m54qctikdpv
HTTP_HOST   xxxxxxx
HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; MS-RTC LM 8; .NET4.0C; .NET4.0E)
Powered by ELMAH, version 1.2.14706.955. Copyright (c) 2004, Atif Aziz. All rights reserved. Licensed under Apache License, Version 2.0. 
like image 369
user266909 Avatar asked May 01 '13 20:05

user266909


3 Answers

I was having the same problem. It turns out that my Package/Publish Web settings in Properties had Exclude generated debug symbols checked for Release configuration

Properties

More details on this here

like image 68
JustMaier Avatar answered Nov 17 '22 18:11

JustMaier


Looks like you need to include the debug symbols in your output. Also you can make sure the .pdb files are with the ELMAH dlls

You can set your project to use the debug symbols on the project properties

ProjectProperties

like image 45
stuisme Avatar answered Nov 17 '22 17:11

stuisme


I had this as well, turning off pre-compilation made the line numbers appear

like image 1
Bigwave Avatar answered Nov 17 '22 17:11

Bigwave