【问题标题】:.NET ETW - unintended keywords - SessionN.NET ETC - 预期关键字 - 会话
【发布时间】:2015-12-10 08:10:40
【问题描述】:

在 .NET 4.5 上使用 Microsoft.Diagnostics.Tracing.* ETW 最终结果以某种方式为所有日志创建了额外的关键字:Session0、Session1、Session2、Session3

这甚至发生在 ETW 库示例代码中

已知问题?

【问题讨论】:

  • 如何捕捉事件?
  • 没有捕获器/监听器,只有事件发布器。与库示例代码几乎相同
  • 我不明白你的意思。我通过 Perfview 或 WPR 捕获事件。
  • 我只需要事件显示在事件查看器中,所以我不需要其他工具来捕获

标签: .net-4.5 etw


【解决方案1】:

source

它是由CreateManifestAndDescriptors()eventsource.cs 中创建的(参见第3346 行)

// Use reflection to look at the attributes of a class, and generate a manifest for it (as UTF8) and
// return the UTF8 bytes.  It also sets up the code:EventData structures needed to dispatch events
// at run time.  'source' is the event source to place the descriptors.  If it is null,
// then the descriptors are not creaed, and just the manifest is generated.  
private static byte[] CreateManifestAndDescriptors(Type eventSourceType, string eventSourceDllName, EventSource source,
    EventManifestOptions flags = EventManifestOptions.None)
{
    ///...
    // ensure we have keywords for the session-filtering reserved bits
    // 
    {
        manifest.AddKeyword("Session3", (long)0x1000 << 32);
        manifest.AddKeyword("Session2", (long)0x2000 << 32);
        manifest.AddKeyword("Session1", (long)0x4000 << 32);
        manifest.AddKeyword("Session0", (long)0x8000 << 32);
    }
//...
}

【讨论】:

    【解决方案2】:

    http://www.shujaat.net/2013/09/net-45-eventsource-windows-event-log.html?showComment=1410351588387#c5917443851300280552

    看起来像一个已知问题

    我确实可以在清单文件中找到这些有趣的关键字。

    【讨论】:

      猜你喜欢
      • 2021-12-01
      • 2023-03-17
      • 1970-01-01
      • 1970-01-01
      • 2020-11-18
      • 2017-07-13
      • 1970-01-01
      • 2015-03-23
      • 2013-07-19
      相关资源
      最近更新 更多