You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get this exception when I try to clone the object 'NLog.LogManager.Configuration' of type NLog.Config.LoggingConfiguration.
I use the nuget version 2.2.2 in a .NET Core 3.1 project (Console App).
Stack Trace:
at System.Linq.Expressions.Expression.GetUserDefinedCoercionOrThrow(ExpressionType coercionType, Expression expression, Type convertToType)
at System.Linq.Expressions.Expression.Convert(Expression expression, Type type, MethodInfo method)
at System.Linq.Expressions.Expression.Convert(Expression expression, Type type)
at ObjectCloner.Internal.DeepCloneExpressionBuilder.CreateRecursiveCallExpression(Expression objectToCopy)
at ObjectCloner.Internal.DeepCloneExpressionBuilder.<CreateFieldCopyExpressions>d__19.MoveNext()
at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
at System.Collections.Generic.List`1.AddRange(IEnumerable`1 collection)
at ObjectCloner.Internal.DeepCloneExpressionBuilder.Build()
at ObjectCloner.Internal.DeepCloneInternal.<>c__DisplayClass1_0.<GetDeepCloner>b__0(Type t)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at ObjectCloner.Internal.DeepCloneInternal.GetDeepCloner(Type type)
at ObjectCloner.ObjectCloner.DeepClone[T](T original)
The text was updated successfully, but these errors were encountered:
@marcelltoth Hi, no, I don't have a public repo in this case. But I thought it will not be 'wild guessing', because I mentioned clearly which object I try to clone.
Simply use the following code, after installing the nuget package for NLog:
var config = new NLog.Config.LoggingConfiguration();
// Targets where to log to: File and Console
var logfile = new NLog.Targets.FileTarget("logfile") { FileName = "file.txt" };
var logconsole = new NLog.Targets.ConsoleTarget("logconsole");
// Rules for mapping loggers to targets
config.AddRule(LogLevel.Info, LogLevel.Fatal, logconsole);
config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile);
// Apply config
NLog.LogManager.Configuration = config;
Hi.
I get this exception when I try to clone the object 'NLog.LogManager.Configuration' of type NLog.Config.LoggingConfiguration.
I use the nuget version 2.2.2 in a .NET Core 3.1 project (Console App).
Stack Trace:
The text was updated successfully, but these errors were encountered: