Hi,
I have a .NET 4.7.2 Web Applications that uses AspNetCore and NLog.
In this application when we try to access a service via Remoting we get an exception saying some given type is not marked as serializable due to the way NLog saves context info. e.g.:
if NET4_6 || NETSTANDARD
AsyncLocalDictionary.Value = newValue;
#else
if (newValue == null)
System.Runtime.Remoting.Messaging.CallContext.FreeNamedDataSlot(LogicalThreadDictionaryKey);
else
System.Runtime.Remoting.Messaging.CallContext.LogicalSetData(LogicalThreadDictionaryKey, newValue);
#endif
The problem is our application defaults to using the net45 version of the binaries because no net46 or later version is included with the nuget package. Is it possible to include that specific version with the built nuget?
Regards,
Pedro Cardoso
Hi! Thanks for opening your first issue here! Please make sure to follow the issue template - so we could help you better!
What version of NLog and NLog.Extensions.Logging are you using?
Could you give a callstack of the exception that you are getting? Or maybe a reproducible example?
NLog ver. 4.6.4 tries to improve usage of CallContext (Wraps all objects to become serializable). See also #2910
We were using NLog 4.6.4 but I updated to the latest 4.6.7 in all projects that used it and we no longer see those exceptions.
Thanks
Most helpful comment
We were using NLog 4.6.4 but I updated to the latest 4.6.7 in all projects that used it and we no longer see those exceptions.
Thanks