In VS 2010 I have a console app. The app references a Common dll that references log4net. This is a long running app that was recently modified to target x64 due to memory issues. Since the x64 change another issue has been introduced.
The app runs fine in debug mode and in release mode with F5. It will not run in release mode with CTRL F5 (i.e. without debugging).
The error is a NullReferenceException from within the common dll
The line attempts to call a static method on the LogManager (log4net).
I am using the latest version of log4net
There is no DEBUG specific code
public static void LogError(Exception ex)
{
_log = LogManager.GetLogger(GetLoggerType()); //Fails on GetLogger
_log.Error(ex);
}
private static Type GetLoggerType()
{
var frame = new StackFrame(2);
var method = frame.GetMethod();
return method.DeclaringType;
}