Log4net
  1. Log4net
  2. LOG4NET-36

System.Diagnostics.Trace may throw exception if AppDomain does not have config file

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.9
    • Fix Version/s: 1.2.10
    • Component/s: Core
    • Labels:
      None

      Description

      System.Diagnostics.Trace may throw exception if AppDomain does not have config file.

      If the AppDomain has been created programmatically it is possible that it does not have a config file set. It has been reported that an exception can be generated on certain platforms in this situation.

      The exception is:

      System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. --->
      System.TypeInitializationException: The type initializer for "D2L.Mail.MailService" threw an exception. --->
      System.TypeInitializationException: The type initializer for "log4net.Core.LoggerManager" threw an exception. --->
      System.TypeInitializationException: The type initializer for "log4net.Util.LogLog" threw an exception. --->
      System.NullReferenceException: Object reference not set to an instance of an object.

      at System.Configuration.ConfigurationSettings.GetConfig(String sectionName)
      at System.Diagnostics.DiagnosticsConfiguration.GetConfigTable()
      at System.Diagnostics.DiagnosticsConfiguration.Initialize()
      at System.Diagnostics.DiagnosticsConfiguration.get_IndentSize()
      at System.Diagnostics.TraceInternal.InitializeSettings()
      at System.Diagnostics.TraceInternal.get_Listeners()
      at System.Diagnostics.TraceInternal.WriteLine(String message)
      at System.Diagnostics.Trace.WriteLine(String message)
      at log4net.Util.LogLog.Error(String message, Exception exception)
      at log4net.Util.LogLog..cctor()

      — End of inner exception stack trace —

      at log4net.Util.LogLog.Debug(String message)
      at log4net.Core.LoggerManager..cctor()

      — End of inner exception stack trace —

      at log4net.Core.LoggerManager.GetLogger(Assembly
      repositoryAssembly, String name)
      at log4net.LogManager.GetLogger(Type type)
      at D2L.Mail.MailService..cctor()

      — End of inner exception stack trace —

      — End of inner exception stack trace —

        Activity

          People

          • Assignee:
            Nicko Cadell
            Reporter:
            Nicko Cadell
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development