【问题标题】:Filter custom message from Visual Studio 2015 output window从 Visual Studio 2015 输出窗口过滤自定义消息
【发布时间】:2017-08-06 11:10:17
【问题描述】:

在过去几个月的某个时候,有很多类似

的消息
Event 7 was called with 5 argument(s) , but it is defined with 6 paramenter(s).
Event 10 was called with 5 argument(s) , but it is defined with 6 paramenter(s).
Event 10 was called with 5 argument(s) , but it is defined with 6 paramenter(s).

开始向我的 Visual Studio 输出窗口发送垃圾邮件,导致很难找到实际的跟踪和调试消息。这些消息来自哪里,如何禁用它们?

为了尝试解决这个问题,我尝试了几件事。

  • 大部分answers 指向配置输出窗口中的复选框。如果我取消选中“程序输出”,问题消息就会消失,但我想保留的消息也会消失。
  • 我尝试创建自定义TraceListener 并在WriteWriteLine 方法中设置断点,希望调用堆栈会告诉我从哪里生成消息。我发现这些消息并非来自典型的 Diagnotics.DebugDiagnotics.Trace 方法。
  • 我尝试通过Console.SetOut() 将控制台重定向到自定义的TextWriter,我可以在其中设置断点。同样,我找不到任何东西。

任何帮助将不胜感激。

【问题讨论】:

  • 针对哪些项目? Stackify ? Azure ? Rebus ?
  • 我正在使用 Stackify 前缀。很好地抓住那个。我不确定我的搜索如何没有找到它。如果您将其总结为答案,我会将其标记为已接受。谢谢!
  • 您可以删除问题。 “不是你,是Stackify”的答案不太可能对其他人有用。他们很可能也会发现这个问题。
  • 据我所知,您使用什么搜索来查找问题? Google 中的“Event 7 was called with 5 argument(s), but it is defined with 6 parameters)”的变体或“Visual Studio 输出窗口”在前几页没有让我得到那个结果。
  • @erdomke 您是否找到了它的来源和/或如何解决它?

标签: c# visual-studio visual-studio-2015


【解决方案1】:

我找到了这个字符串来自的程序集,但还没有找到如何或从哪里来。

在原始 dll(32 位版本)的 mscorlib.dll 第 54673 行中找到:事件 {0} 是用 {1} 参数调用的,但它是用 {2} 参数定义的

它来自资源名称值对,这个名为EventSource_EventParametersMismatch

这是从 system\diagnostics\eventing\eventsource.cs 使用的 WriteToAllListeners https://referencesource.microsoft.com/#mscorlib/system/diagnostics/eventing/eventsource.cs,7c04b58f26d81951

【讨论】:

    【解决方案2】:

    正如@Sinatr 在他的评论中提到的,这可能是由几种不同的系统配置引起的,我在最初的搜索中没有找到相关信息。具体而言,可以在以下链接中找到更多信息:

    在我的情况下,罪魁祸首似乎是 StackOverflow question linked above 中记录的 Application Insights 和 Stackify 前缀的组合。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-16
      • 1970-01-01
      • 2018-06-15
      相关资源
      最近更新 更多