0
Fixed

Null reference during logging

Matthew Clark 7 years ago • updated by anonymous 4 years ago 3

I am receiving an alert on the home page on my local build when it is browsed to.

If no other log writers are configured, any issues may be missed. The exception details are as follows:
System.NullReferenceException: Object reference not set to an instance of an object.
at Unify.Framework.Logging.ExceptionLogEntry.get_LogEntryModule() in c:\workspaces\DEV\FrameworkCore\Source\Logging\Unify.Framework.Logging\ExceptionLogEntry.cs:line 71
at Unify.Framework.Logging.CsvLogWriter.WriteLogEntryBase(ILogEntry logEntry, String filePath) in c:\workspaces\DEV\FrameworkCore\Source\Logging\Unify.Framework.Logging.Writer\CsvLogWriter.cs:line 61
at Unify.Framework.Logging.CsvLogReaderWriter.<>n__FabricatedMethod1b(ILogEntry , String )
at Unify.Framework.Logging.CsvLogReaderWriter.<>c_DisplayClass19.b_16() in c:\workspaces\DEV\FrameworkCore\Source\Logging\Unify.Framework.Logging.Writer\CsvLogReaderWriter.cs:line 455
at Unify.Framework.ExtensionMethods.WaitOnMutex(Mutex mutex, Action work) in c:\workspaces\DEV\FrameworkCore\Source\Scheduling\Unify.Framework.Scheduling.Job\JobExtensionMethods.cs:line 21
at Unify.Framework.Logging.CsvLogReaderWriter.WriteLogEntryBase(ILogEntry logEntry, String filePath) in c:\workspaces\DEV\FrameworkCore\Source\Logging\Unify.Framework.Logging.Writer\CsvLogReaderWriter.cs:line 459
at Unify.Framework.Logging.FileLogWriterBase.<>c_DisplayClass5.b_4() in c:\workspaces\DEV\FrameworkCore\Source\Logging\Unify.Framework.Logging.Writer\FileLogWriterBase.cs:line 298
at Unify.Framework.ExtensionMethods.WaitOnMutex(Mutex mutex, Action work) in c:\workspaces\DEV\FrameworkCore\Source\Scheduling\Unify.Framework.Scheduling.Job\JobExtensionMethods.cs:line 21
at Unify.Framework.Logging.FileLogWriterBase.InternalWriteLogEntry(ILogEntry logEntry, String filePath) in c:\workspaces\DEV\FrameworkCore\Source\Logging\Unify.Framework.Logging.Writer\FileLogWriterBase.cs:line 299
at Unify.Framework.Logging.FileLogWriterBase.WriteLogEntryBase(IBrandedLogEntry logEntry) in c:\workspaces\DEV\FrameworkCore\Source\Logging\Unify.Framework.Logging.Writer\FileLogWriterBase.cs:line 127
at Unify.Framework.Logging.LogWriterBase.WriteLogEntry(IBrandedLogEntry logEntry) in c:\workspaces\DEV\FrameworkCore\Source\Logging\Unify.Framework.Logging.WinEventLogWriter\LogWriterBase.cs:line 46

Affected Versions:
Fixed by Version:

See what you can do for Alpha

There were a few issues here:

  • ExceptionLogEntry would use the TargetSite property of the exception to write the string module. The exception being used was not thrown, hence it didn't have a TargetSite (or stack trace or source) - this now has an override and if absolutely no information is provided it will just use string.Empty
  • AdapterEngine.GenerateAdapter and GenerateCompositeAdapter was constructing an exception just for the purposes of logging a message - this now just logs a message

You could reproduce this by enabling an adapter and removing a base connector. Issue resolved, please confirm if appropriate.

Locally confirmed complete.