CallSite MethodName 始终呈现为 MoveNext

CallSite MethodName allways renders as MoveNext

使用 CallSite 渲染器记录时,方法名称的结果始终为 MoveNext。这是一个错误,还是我做错了什么?

NLog版本:4.6.0

平台:.NET Core 2

当前的 NLog 配置(xml 或 C#,如果相关)

<target xsi:type="File" name="ownFile-trace" fileName="logs${machinename}-trace.log"
        layout="${longdate}|${aspnet-request-ip}|${aspnet-User-Identity}|${pad:padding=-5:${uppercase:${level}}}|${assembly-version}|${pad:padding=-3:${threadid}}|${aspnet-mvc-controller}|${callsite:className=True:includeNamespace=False:fileName=False:includeSourcePath=False:methodName=True}|${message}|${exception}"
        maxArchiveFiles="14"
        archiveFileName="logs\archive${machinename}-trace.{#}.zip"
        archiveNumbering="Date"
        archiveEvery="Saturday"
        archiveDateFormat="yyyyMMdd"
        enableArchiveFileCompression ="true"
        />

初始化:

    public class Program
{
    private static readonly Logger Logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger();

    public static void Main(string[] args)
    {

        try
        {
            Logger.Info("init main");

            CreateWebHostBuilder(args).Build().Run();

        }
        catch (Exception e)
        {
            //NLog: catch setup errors
            Logger.Error(e, "Stopped program because of exception");
            throw;
        }
        finally
        {
            // Ensure to flush and stop internal timers/threads before application-exit (Avoid segmentation fault on Linux)
            NLog.LogManager.Shutdown();
        } 

    }

    public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
        WebHost.CreateDefaultBuilder(args)
            .UseStartup<Startup>()
            .ConfigureLogging(logging =>
            {
                logging.ClearProviders();
                logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace);
            })
            .UseNLog() // NLog: setup NLog for Dependency injection
            .ConfigureAppConfiguration(ConfigConfiguration);

...

目前的结果是什么?

2018-08-12 16:44:58.8795|::1||TRACE|8.8.11.0|4  |Home|HomeController.MoveNext|

| 预期结果是什么?

2018-08-12 16:44:58.8795|::1||TRACE|8.8.11.0|4  |Home|HomeController.Index||

你检查过内部日志了吗?没有警告

请post完整的异常详细信息(消息、堆栈跟踪、内部异常:none

有什么解决方法吗?没有

有没有可以运行的版本?不确定

你能帮我们写一个单元测试吗?没有

您是否看过 ${callsite} 布局渲染器的 Wiki 页面:

https://github.com/NLog/NLog/wiki/Callsite-layout-renderer

尝试启用这些选项:

  • cleanNamesOfAnonymousDelegates
  • cleanNamesOfAsyncContinuations

例如

${callsite:className=True:includeNamespace=False:fileName=False:includeSourcePath=False:methodName=True:cleanNamesOfAnonymousDelegates=True:cleanNamesOfAsyncContinuations=True}

NLog ver. 有待处理的任务。 5.0 默认启用这些:https://github.com/NLog/NLog/issues/1798(次要破坏性更改)