【发布时间】:2020-12-12 19:24:32
【问题描述】:
我在我的解决方案中对我的 NuGet 包做了一些 consolidation,现在我收到了:
异常信息:
MissingMethodException:找不到方法:'System.IDisposable Serilog.Context.LogContext.Push(Serilog.Core.ILogEventEnricher)'。
异常调用堆栈:
在 Serilog.Extensions.Logging.SerilogLoggerProvider.BeginScope[T](T 状态) 在 Microsoft.Extensions.Logging.Logger.BeginScope[TState](TState 状态)
当我这样打电话时:
using (logger.BeginScope(new Dictionary<string, object>
{
["SomeProperty"] = someVariable,
}))
{
logger.LogInfo("hello world");
}
package.config
<package id="Microsoft.Extensions.Logging" version="2.1.1" targetFramework="net48" />
<package id="Serilog" version="2.10.0" targetFramework="net48" />
<package id="Serilog.Extensions.Logging" version="3.0.1" targetFramework="net48" />
我的 NuGet 引用似乎不正确,但我没有看到它。
我还整理了一个full repro of the problem here。
【问题讨论】:
标签: c# serilog microsoft-extensions-logging