I'm using Caliburn.Micro and added my own ErrorHandler using log4net
. That's how it looks like:
protected internal void Handle<T>(T exception)
{
try
{
MessageBox.Show((exception as Exception)?.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
Logger.Error((exception as Exception)?.Message, exception as Exception);
}
catch (Exception ex)
{
Logger.Error($"ErrorHandler (Handle<T>) throws exception {ex.Message}");
Logger.Error("$^", ex);
MessageBox.Show(ex.Message);
}
}
And at some other place:
try
{
...
}
catch (Exception ex)
{
ErrorHandler.Handle(ex);
}
Now that some exception's thrown, ErrorHandler.Handle(ex)
comes into play. However, it throws out this error:
An exception of type 'System.NullReferenceException' occurred in SampleProject.exe but was not handled in user code
Additional information: Object reference not set to an instance of an object.
TBH, I don't know where to start the investigation at this point...?