I am using Nlog and recently decided to use Fody/Costura to embed my DLLs in the final executable. I noticed that when launching and creating the Logger using the recommended instance declaration below that I am getting an exception when calling the GetCurrentClassLogger (see exception below). If I uninstall Costura/Fody the exception goes away. Nlog consumes the error but each time I launch my code it breaks on that error and I would like to resolve it.
//recommended logger declaration
private static Logger logger = LogManager.GetCurrentClassLogger();
//exception thrown when calling the instance declaration
Error Error logging version of assembly NLog, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=5120e14c03d0593c. Exception:
System.ArgumentException: The path is not of a legal form.
at System.IO.Path.LegacyNormalizePath(String path, Boolean fullCheck,
Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.GetFullPathInternal(String path)
at System.IO.Path.GetFullPath(String path)
at System.Diagnostics.FileVersionInfo.GetFullPathWithAssert(String
fileName)
at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
at NLog.Common.InternalLogger.LogAssemblyVersion(Assembly assembly)
I have verified that without Fody/Costura installed the error goes away and when Fody/Costura is installed the error returns.
I would like to resolve the error and not have the IDE halt each time I run the code. I also do not want to ignore the specific exception in case it were to occur in other code not related to Nlog. The exception thrown is System.ArgumentException and it could happen in other code.
Created github.com/NLog/NLog/pull/3258 – Rolf Kristensen
So will be fixed in NLog 4.6.1. Release today or tomorrow (depending of timezone ;)
Update: it's released: https://www.nuget.org/packages/NLog/4.6.1