Windows Server 2003 Exception Handling Error

Topics: Exception Handling Application Block
Jun 8, 2009 at 4:21 AM

I have an application that runs on both clients and server.  My application works fine from the client XP machine but when an error is recieved on the server it ends up generating another error inside the application block.  The error is as follows:

Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionHandlingException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionHandlingConfigurationView.GetExceptionPolicyData(String policyName)
   at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyCustomFactory.CreateObject(IBuilderContext context, String name, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfiguredObjectStrategy.BuildUp(IBuilderContext context, Type t, Object existing, String id)
   at Microsoft.Practices.ObjectBuilder.SingletonStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfigurationNameMappingStrategy.BuildUp(IBuilderContext context, Type t, Object existing, String id)
   at Microsoft.Practices.ObjectBuilder.BuilderBase`1.DoBuildUp(IReadWriteLocator locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[] transientPolicies)
   at Microsoft.Practices.ObjectBuilder.BuilderBase`1.BuildUp(IReadWriteLocator locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[] transientPolicies)
   at Microsoft.Practices.ObjectBuilder.BuilderBase`1.BuildUp[TTypeToBuild](IReadWriteLocator locator, String idToBuild, Object existing, PolicyList[] transientPolicies)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp[T](IReadWriteLocator locator, String id, IConfigurationSource configurationSource)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.LocatorNameTypeFactoryBase`1.Create(String name)
   at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.GetExceptionPolicy(Exception exception, String policyName, ExceptionPolicyFactory factory)
   --- End of inner exception stack trace ---
   at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.GetExceptionPolicy(Exception exception, String policyName, ExceptionPolicyFactory factory)
   at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.HandleException(Exception exceptionToHandle, String policyName)
   at DigaSignMD.e.j(Object A_0, EventArgs A_1)
   at DevComponents.DotNetBar.BaseItem.RaiseClick(eEventSource source)
   at DevComponents.DotNetBar.BaseItem.InternalMouseUp(MouseEventArgs objArg)
   at DevComponents.DotNetBar.PopupItem.InternalMouseUp(MouseEventArgs objArg)
   at DevComponents.DotNetBar.ButtonItem.InternalMouseUp(MouseEventArgs objArg)
   at DevComponents.DotNetBar.BaseItem.InternalMouseUp(MouseEventArgs objArg)
   at DevComponents.DotNetBar.ItemContainer.InternalMouseUp(MouseEventArgs objArg)
   at DevComponents.DotNetBar.ItemControl.OnMouseUp(MouseEventArgs e)
   at DevComponents.DotNetBar.RibbonBar.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at DevComponents.DotNetBar.ItemControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

It has to do with the custom handler.  If I change it to use the Log Policy it will log successfully to the event log.  I am at a loss since the same code works on the XP machine.  Does anyone have any thoughts?

Jun 8, 2009 at 6:49 AM

Hi,

Is your Windows Server 2003 a dev machince? How did you deploy your project? Did you just copy over the files? Can you please verify that the configuration file is deployed with the executable files.

Valiant Dudan
Global Technology & Solutions
Avanade, Inc.
entlib.support@avanade.com

Jun 10, 2009 at 3:32 PM

1) Server is  production

2) Ran setup to copy files

3) Configuration File

<configuration>
  <configSections>
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="DigaSignMD.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
    <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="DigaSignMD.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
    </sectionGroup>
  </configSections>
  <loggingConfiguration name="Logging Application Block" tracingEnabled="true"
    defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
    <listeners>
      <add source="DigaSign" formatter="Text Formatter" log="Application"
        machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        name="Event Log Destination" />
      <add fileName="trace.log" header="----------------------------------------"
        footer="----------------------------------------" formatter=""
        listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        name="Flat File Destination" />
    </listeners>
    <formatters>
      <add template="Timestamp: {timestamp}&#xD;&#xA;Message: {message}&#xD;&#xA;Category: {category}&#xD;&#xA;Priority: {priority}&#xD;&#xA;EventId: {eventid}&#xD;&#xA;Severity: {severity}&#xD;&#xA;Title:{title}&#xD;&#xA;Machine: {machine}&#xD;&#xA;Application Domain: {appDomain}&#xD;&#xA;Process Id: {processId}&#xD;&#xA;Process Name: {processName}&#xD;&#xA;Win32 Thread Id: {win32ThreadId}&#xD;&#xA;Thread Name: {threadName}&#xD;&#xA;Extended Properties: {dictionary({key} - {value}&#xD;&#xA;)}"
        type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        name="Text Formatter" />
    </formatters>
    <categorySources>
      <add switchValue="All" name="General">
        <listeners>
          <add name="Event Log Destination" />
        </listeners>
      </add>
      <add switchValue="All" name="Tracing">
        <listeners>
          <add name="Flat File Destination" />
        </listeners>
      </add>
    </categorySources>
    <specialSources>
      <allEvents switchValue="All" name="All Events" />
      <notProcessed switchValue="All" name="Unprocessed Category" />
      <errors switchValue="All" name="Logging Errors &amp; Warnings">
        <listeners>
          <add name="Event Log Destination" />
        </listeners>
      </errors>
    </specialSources>
  </loggingConfiguration>
  <exceptionHandling>
    <exceptionPolicies>
      <add name="Error File Policy">
        <exceptionTypes>
          <add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            postHandlingAction="NotifyRethrow" name="Exception">
            <exceptionHandlers>
              <add logCategory="Tracing" eventId="100" severity="Error" title="Enterprise Library Exception Handling"
                formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                priority="0" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                name="Logging Handler" />
            </exceptionHandlers>
          </add>
        </exceptionTypes>
      </add>
      <add name="Global Policy">
        <exceptionTypes>
          <add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            postHandlingAction="None" name="Exception">
            <exceptionHandlers>
              <add type="WWN.Shared.Exceptions.MessageExceptionHandler, WWN.Shared, Version=3.0.901.3, Culture=neutral, PublicKeyToken=null"
                name="Custom Handler" />
            </exceptionHandlers>
          </add>
        </exceptionTypes>
      </add>
      <add name="Log Only Policy">
        <exceptionTypes>
          <add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            postHandlingAction="None" name="Exception">
            <exceptionHandlers>
              <add logCategory="General" eventId="100" severity="Error" title="Enterprise Library Exception Handling"
                formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                priority="0" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                name="Logging Handler" />
            </exceptionHandlers>
          </add>
        </exceptionTypes>
      </add>
      <add name="Log Policy">
        <exceptionTypes>
          <add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            postHandlingAction="NotifyRethrow" name="Exception">
            <exceptionHandlers>
              <add logCategory="General" eventId="100" severity="Error" title="Enterprise Library Exception Handling"
                formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                priority="0" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                name="Logging Handler" />
            </exceptionHandlers>
          </add>
        </exceptionTypes>
      </add>
      <add name="Notify Policy">
        <exceptionTypes>
          <add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            postHandlingAction="None" name="Exception">
            <exceptionHandlers>
              <add logCategory="General" eventId="100" severity="Error" title="Enterprise Library Exception Handling"
                formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                priority="0" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                name="Logging Handler" />
              <add type="WWN.Shared.Exceptions.MessageExceptionHandler, WWN.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
                name="Custom Handler" />
            </exceptionHandlers>
          </add>
        </exceptionTypes>
      </add>
    </exceptionPolicies>
  </exceptionHandling>
  <dataConfiguration defaultDatabase="DigaSignMD" />
  <connectionStrings>
    ...
  </connectionStrings>
  <appSettings>
    ...
  </appSettings>
  <system.diagnostics>
    <sources>
      <!-- This section defines the logging configuration for My.Application.Log -->
      <source name="DefaultSource" switchName="DefaultSwitch">
        <listeners>
          <add name="FileLog" />
          <!-- Uncomment the below section to write to the Application Event Log -->
          <!--<add name="EventLog"/>-->
        </listeners>
      </source>
    </sources>
    <switches>
      <add name="DefaultSwitch" value="Information" />
    </switches>
    <sharedListeners>
      <add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter" />
      <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
      <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
    </sharedListeners>
  </system.diagnostics>
  <applicationSettings>
    <DigaSignMD.My.MySettings>
      ...
    </DigaSignMD.My.MySettings>
  </applicationSettings>
  <userSettings>
    <DigaSignMD.My.MySettings>
      ...
    </DigaSignMD.My.MySettings>
  </userSettings>
</configuration>

 

If you need any more information please let me know.


Thanks

Jun 11, 2009 at 6:27 AM

Usually that error occurs when it can't find the configuration file but since it works fine if you change the name of the policy to use, that might not be the case.  Could you post here your custom exceptionhandler or better yet, send it to us?  By the way, where exactly are you changing the name of the policy?

 

Sarah Urmeneta
Global Technology & Solutions
Avande, Inc.
entlib.support@avanade.com

 

Jun 12, 2009 at 3:09 PM

Sarah,

I sent you my custom handler through email.  I am changing the name of the policy in the config file.  Let me know if you have any other questions.

 

Thanks

Jun 15, 2009 at 9:18 AM

Hi jstreit, I didn't receive the custom handler email.  Make sure you sent it to entlib.support@avanade.com or just resend it if you used the correct email address.

 

Sarah Urmeneta
Global Technology & Solutions
Avande, Inc.
entlib.support@avanade.com

Jun 15, 2009 at 3:07 PM

Sarah,

I keep getting the blocked attachment respond from the system administrator. I have tried both just the .vb and the .zip and they both get blocked.  What attachments do you allow?

 

Thanks


Jason

Jun 16, 2009 at 4:54 AM

Maybe they dont allow you to send with attached files. try using other mail.. anyways, if that is only a single class you can just post your code here.

Valiant Dudan
Global Technology & Solutions
Avande, Inc.
entlib.support@avanade.com

Jun 16, 2009 at 1:14 PM

Namespace Exceptions
    <ConfigurationElementType(GetType(CustomHandlerData))> _
    Public Class MessageExceptionHandler
        Implements IExceptionHandler

#Region " Private Methods "
        ''' <summary>
        '''   Get the application name from the configuration file if it exists
        '''   and if not just use the default
        ''' </summary>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Private Function GetApplicationName() As String
            Dim AppName As String = "World Wide Notary Exception Handler"

            If Not ConfigurationManager.AppSettings.Item("Application") Is Nothing Then
                AppName = ConfigurationManager.AppSettings.Item("Application")
            End If

            Return AppName
        End Function
        ''' <summary>
        '''   Show the exception
        ''' </summary>
        ''' <param name="p_Ex"></param>
        ''' <remarks></remarks>
        Private Sub ShowThreadExceptionDialog(ByVal p_Ex As Exception)
            WWN.Shared.Exceptions.General.ShowUnexpectedErrorDialog(p_Ex)
        End Sub
#End Region

#Region " Public Methods "
        ''' <summary>
        '''   Handle exceptions
        ''' </summary>
        ''' <param name="exception"></param>
        ''' <param name="handlingInstanceId"></param>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Function HandleException(ByVal exception As System.Exception, ByVal handlingInstanceId As System.Guid) As System.Exception Implements Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.IExceptionHandler.HandleException
            If TypeOf exception Is WWN.Shared.Exceptions.UserNotLoggedInException Then
                DevComponents.DotNetBar.MessageBoxEx.Show(String.Format("{0} are not currently logged in.  You must restart the application and login.", CType(exception, WWN.Shared.Exceptions.UserNotLoggedInException).UserName), "Not Logged In!", MessageBoxButtons.OK, MessageBoxIcon.Warning)
            ElseIf TypeOf exception Is WWN.Shared.Exceptions.InvalidActivationKeyException Then
                DevComponents.DotNetBar.MessageBoxEx.Show(String.Format("{0} is not the valid key.  Please contact support to obtain the valid key.", CType(exception, WWN.Shared.Exceptions.InvalidActivationKeyException).Key), "Invalid Key!", MessageBoxButtons.OK, MessageBoxIcon.Warning)
            ElseIf TypeOf exception Is WWN.Shared.Exceptions.ExpiredLicenseException Then
                DevComponents.DotNetBar.MessageBoxEx.Show(String.Format("Your license file is either not active or has expired.  Your license is valid between {0} and {1}.  Please contact customer support to obtain a valid license.", CType(exception, WWN.Shared.Exceptions.ExpiredLicenseException).InceptionDate.ToShortDateString, CType(exception, WWN.Shared.Exceptions.ExpiredLicenseException).ExpirationDate.ToShortDateString), "Expired License!", MessageBoxButtons.OK, MessageBoxIcon.Warning)
            Else
                Me.ShowThreadExceptionDialog(exception)
            End If
            Return exception
        End Function
#End Region


#Region " Constructors "
        ''' <summary>
        '''   Default Constructor
        ''' </summary>
        ''' <param name="p_Ignore"></param>
        ''' <remarks></remarks>
        Public Sub New(ByVal p_Ignore As System.Collections.Specialized.NameValueCollection)

        End Sub
#End Region

    End Class
End Namespace

Jun 17, 2009 at 11:29 AM

Going back, I might have misunderstood on what you mean by when you said "when I changed it to use the Log Policy it will log successfully to the event log".  What did you exactly changed?

 

Sarah Urmeneta
Global Technology & Solutions
Avande, Inc.
entlib.support@avanade.com

Jun 17, 2009 at 1:23 PM

I changed the name in the config file.  Here is the original.

 

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="DigaSignMD.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
    <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="DigaSignMD.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
    </sectionGroup>
  </configSections>
  <loggingConfiguration name="Logging Application Block" tracingEnabled="true"
    defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
    <listeners>
      <add source="DigaSign" formatter="Text Formatter" log="Application"
        machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        name="Event Log Destination" />
      <add fileName="trace.log" header="----------------------------------------"
        footer="----------------------------------------" formatter=""
        listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        name="Flat File Destination" />
    </listeners>
    <formatters>
      <add template="Timestamp: {timestamp}&#xD;&#xA;Message: {message}&#xD;&#xA;Category: {category}&#xD;&#xA;Priority: {priority}&#xD;&#xA;EventId: {eventid}&#xD;&#xA;Severity: {severity}&#xD;&#xA;Title:{title}&#xD;&#xA;Machine: {machine}&#xD;&#xA;Application Domain: {appDomain}&#xD;&#xA;Process Id: {processId}&#xD;&#xA;Process Name: {processName}&#xD;&#xA;Win32 Thread Id: {win32ThreadId}&#xD;&#xA;Thread Name: {threadName}&#xD;&#xA;Extended Properties: {dictionary({key} - {value}&#xD;&#xA;)}"
        type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        name="Text Formatter" />
    </formatters>
    <categorySources>
      <add switchValue="All" name="General">
        <listeners>
          <add name="Event Log Destination" />
        </listeners>
      </add>
      <add switchValue="All" name="Tracing">
        <listeners>
          <add name="Flat File Destination" />
        </listeners>
      </add>
    </categorySources>
    <specialSources>
      <allEvents switchValue="All" name="All Events" />
      <notProcessed switchValue="All" name="Unprocessed Category" />
      <errors switchValue="All" name="Logging Errors &amp; Warnings">
        <listeners>
          <add name="Event Log Destination" />
        </listeners>
      </errors>
    </specialSources>
  </loggingConfiguration>
  <exceptionHandling>
    <exceptionPolicies>
      <add name="Global Policy">
        <exceptionTypes>
          <add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            postHandlingAction="None" name="Exception">
            <exceptionHandlers>
              <add type="WWN.Shared.Exceptions.MessageExceptionHandler, WWN.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
                name="Custom Handler" />
            </exceptionHandlers>
          </add>
        </exceptionTypes>
      </add>
      <add name="Log Only Policy">
        <exceptionTypes>
          <add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            postHandlingAction="None" name="Exception">
            <exceptionHandlers>
              <add logCategory="General" eventId="100" severity="Error" title="Enterprise Library Exception Handling"
                formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                priority="0" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                name="Logging Handler" />
            </exceptionHandlers>
          </add>
        </exceptionTypes>
      </add>
      <add name="Log Policy">
        <exceptionTypes>
          <add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            postHandlingAction="NotifyRethrow" name="Exception">
            <exceptionHandlers>
              <add logCategory="General" eventId="100" severity="Error" title="Enterprise Library Exception Handling"
                formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                priority="0" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                name="Logging Handler" />
            </exceptionHandlers>
          </add>
        </exceptionTypes>
      </add>
      <add name="Notify Policy">
        <exceptionTypes>
          <add type="System.Exception, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            postHandlingAction="None" name="Exception">
            <exceptionHandlers>
              <add logCategory="General" eventId="100" severity="Error" title="Enterprise Library Exception Handling"
                formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                priority="0" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                name="Logging Handler" />
              <add type="WWN.Shared.Exceptions.MessageExceptionHandler, WWN.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
                name="Custom Handler" />
            </exceptionHandlers>
          </add>
        </exceptionTypes>
      </add>
    </exceptionPolicies>
  </exceptionHandling>
  <dataConfiguration defaultDatabase="DigaSignMD" />
  <connectionStrings>
    <add name="DigaSignMD" connectionString="Data Source=(local)\SQLEXPRESS;Initial Catalog=DigaSignMD;Persist Security Info=True;User ID=DigaSignMDUser;Password=YudutUDReQAb8uCh"
      providerName="System.Data.SqlClient" />
    <add name="LocalMD" connectionString="Data Source=(local)\SQLEXPRESS;Initial Catalog=DigaSignMD;Integrated Security=True"
      providerName="System.Data.SqlClient" />
  </connectionStrings>
  <appSettings>
    <add key="LicenseFile" value="Kell West Regional Hospital.lic" />
    <add key="LicenseKey" value="KellWestec2d1b0d" />
  </appSettings>
  <system.diagnostics>
    <sources>
      <!-- This section defines the logging configuration for My.Application.Log -->
      <source name="DefaultSource" switchName="DefaultSwitch">
        <listeners>
          <add name="FileLog" />
          <!-- Uncomment the below section to write to the Application Event Log -->
          <!--<add name="EventLog"/>-->
        </listeners>
      </source>
    </sources>
    <switches>
      <add name="DefaultSwitch" value="Information" />
    </switches>
    <sharedListeners>
      <add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter" />
      <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
      <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
    </sharedListeners>
  </system.diagnostics>
  <applicationSettings>
    <DigaSignMD.My.MySettings>
      <setting name="Application" serializeAs="String">
        <value>DigaSignMD Electronic Signature Application</value>
      </setting>
      <setting name="UpdateAssistant" serializeAs="String">
        <value>UpdateAssistant.exe</value>
      </setting>
      <setting name="ManifestFile" serializeAs="String">
        <value>DSManifest.aum</value>
      </setting>
      <setting name="Debug" serializeAs="String">
        <value>False</value>
      </setting>
      <setting name="RequirePIN" serializeAs="String">
        <value>False</value>
      </setting>
      <setting name="RemotingService" serializeAs="String">
        <value>http://localhost/MDRemoteService/DigaSignMDService.rem</value>
      </setting>
      <setting name="RunAtServer" serializeAs="String">
        <value>True</value>
      </setting>
      <setting name="UpdatePath" serializeAs="String">
        <value>C:\Development\WWNotary\DigaSign MD\Redistributables\Server\Versions</value>
      </setting>
    </DigaSignMD.My.MySettings>
  </applicationSettings>
  <userSettings>
    <DigaSignMD.My.MySettings>
      <setting name="MainFormSize" serializeAs="String">
        <value>800, 600</value>
      </setting>
      <setting name="MainFormLocation" serializeAs="String">
        <value>0, 0</value>
      </setting>
      <setting name="PendingDocumentFolder" serializeAs="String">
        <value />
      </setting>
      <setting name="CallUpgrade" serializeAs="String">
        <value>True</value>
      </setting>
      <setting name="DefaultStartPage" serializeAs="String">
        <value>0</value>
      </setting>
      <setting name="ShowToolbarText" serializeAs="String">
        <value>True</value>
      </setting>
      <setting name="ShowToolbars" serializeAs="String">
        <value>True</value>
      </setting>
      <setting name="ToolbarImageSize" serializeAs="String">
        <value>24</value>
      </setting>
      <setting name="AutoLogin" serializeAs="String">
        <value>False</value>
      </setting>
      <setting name="AllowDocumentEdit" serializeAs="String">
        <value>False</value>
      </setting>
    </DigaSignMD.My.MySettings>
  </userSettings>
</configuration>

 

I changed log policy to notify policy and changed notify policy to notify policy old so that I would not have to change the code.


Thanks

Jun 18, 2009 at 9:54 PM

So after that change, you are not encountering the exception right? I suggest you put logging codes in your custom exception handler, right before those lines of codes which might be causes of null reference exceptions. 

 

Sarah Urmeneta
Global Technology & Solutions
Avande, Inc.
entlib.support@avanade.com