I’m having some serious problems last few days with one part of my application. It’s an medium sized ASP.NET application. There is some code that handles errors (logs them into database and displays error page to user). But recently this code stopped working correctly on some machines (not on all).
I know there is an AccessViolationException from ErrorViewer:
Faulting application name: w3wp.exe, version: 7.5.7601.17514, time stamp: 0x4ce7afa2
Faulting module name: KERNELBASE.dll, version: 6.1.7601.17651, time stamp: 0x4e21213c
Exception code: 0xc0000005
Fault offset: 0x000000000000cacd
Faulting process id: 0x1150
Faulting application start time: 0x01cd1e44675765e2
Faulting application path: c:\windows\system32\inetsrv\w3wp.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report Id: c43403ad-8a37-11e1-b256-005056891270
This error gets logged into Error Viewer each time application tries to display error page. But since the error only occured on applications deployed using msi installer, and dll files are being encrypted, I cannot debug this application. Changing code a little I refactored initial method into simple one-liner:
Public Shared Function HandleException(ByVal exception As System.Exception) As Guid
Return New GUID
End Function
But still entering this method throwed exception with this stack trace (obtained using DebugDiag 1.2)
at (Exception )
at MyApp.Business.Utilities.HandleException(Exception exception)
at ()
at MyApp.BaseUtilities.ErrorSolution()
at (ErrorPage_errorpage , Object , EventArgs )
at MyApp.ErrorPage_errorpage.Page_Load(Object , EventArgs )
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Web.UI.Control.LoadRecursive()
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.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)
at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)
at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr managedHttpContext, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)
Which seemed strange to me. Then I’ve removed this method call and suddenly application started working correctly (but not handling errors as I would like). The thing is – exactly the same code worked for years, it wasn’t changed a bit, and just stopped working on some machines.
What’s even more curious is: how calling as simple method as explained above, which just returns simple GUID, can throw AccessViolation?
Have anyone had similar issues with their applications? Could someone explain to me why something like this is happening?
The error appeared mysteriously, and also mysteriously disappeared after some slight code changes (that did not change what and how the code was doing it by a bit). No one at my team or other developers that I showed them the issue could not believe in what they saw.
Seems like there is still a little bit of magic in the universe…