Question

I have an issue I am unable to replicate in either my local environment or my UAT environment. It only seems to be an issue with production.

I've inherited this project and cannot seek the original developers, so many things about the project I have to figure out myself.

About 95% of all code is surrounded by try/catch blocks to catch errors that seem to happen no matter what goes on. However inside all the catches there is a little bit of logging going on. This is the final bit that happens in the base master page:

Public Property HandelException() As Exception
        Get
            Return _Exception
        End Get
        Set(ByVal value As Exception)
            If value IsNot Nothing Then
                _Exception = value
                Dim _TempExceptionLog As New TempFramework.FMKExceptionLog()
                _TempExceptionLog.WriteException(HandelException)
                _logger.Error(_Exception)
                SetMessage(_Exception.Message)
            End If
        End Set
    End Property

In this case, _logger is declared as:

Private ReadOnly _logger =    LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName)

_TempExceptionLog is writing the log to the database while _logger is using log4net, but there are no configurations in the webconfig for any of my dev platforms.

SetMessage is used to manipulate a label on the page with the appropriate error message.

The stack trace I'm getting every now and then on the server is:

Exception information: 
    Exception type: NullReferenceException 
    Exception message: Object reference not set to an instance of an object. 

 Stack trace:    at TempWebControl.TempWCBase.TempWCMaster.set_HandelException(Exception value)
   at TempWebControl.WCBase.TempWCPage.set_HandelException(Exception value)
   at Reservations_Reservations.FillCarMake() in     C:\BuildMaster\_SVCTMP\_A4\SRC\PublicSite\TempName\Reservations\Reservations.aspx.vb:line 5983
   at Reservations_Reservations.FillInformation() in C:\BuildMaster\_SVCTMP\_A4\SRC\PublicSite\TempName\Reservations\Reservations.aspx.vb:line 5896
   at Reservations_Reservations.Page_Load(Object sender, EventArgs e) in C:\BuildMaster\_SVCTMP\_A4\SRC\PublicSite\TempName\Reservations\Reservations.aspx.vb:line 239
   at System.EventHandler.Invoke(Object sender, EventArgs e)
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

It looks like the Null reference exception is coming from this setter, am I wrong in this assumption? If so what could be going on.

Was it helpful?

Solution

From looking at your code, it's clear that _logger is null.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top