【问题标题】:EnterpriseLibrary.Logging terminates applicationEnterpriseLibrary.Logging 终止应用程序
【发布时间】:2012-09-05 12:27:07
【问题描述】:

我们使用一些使用 Microsoft.EnterpriseLibrary.Logging 的第三方软件 作为服务运行。

最近该服务多次停止。我们只有来自 Windows 事件日志的数据。 Stacktrace 显示 MS EntLib Logging 引发了 ArgumentNullException。

Event Type: Error Event Source: .NET Runtime Event Category: None Event ID: 1026 Date: 04/09/2012 Time: 19:05:23 User: N/A Computer: XXX Description: Application: XXX.Service.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.ArgumentNullException Stack: at Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry.BuildCategoriesCollection(System.String) at Microsoft.Practices.EnterpriseLibrary.Logging.Tracer.WriteTraceMessage(System.String, System.String, System.Diagnostics.TraceEventType) at Microsoft.Practices.EnterpriseLibrary.Logging.Tracer.WriteTraceEndMessage(System.String) at Microsoft.Practices.EnterpriseLibrary.Logging.Tracer.Dispose(Boolean) at Microsoft.Practices.EnterpriseLibrary.Logging.Tracer.Dispose() at XXX

我已经检查过了,它看起来是由以下原因引起的:

Trace.CorrelationManager.LogicalOperationStack.Peek()

返回空值

谁能帮我解释一下为什么会这样?

【问题讨论】:

  • 你知道使用的是哪个版本的企业库吗?
  • 这个异常是否发生在后台线程上?
  • Steven,是的,这个服务运行多个线程。
  • link 似乎是问题,但它仍然发生在 2.0 及更高版本上。甚至在 Win7 上的 4.0
  • 您是否有权访问第三方代码以了解他们在内部做什么?您是否有办法在不运行完整应用程序的情况下重现问题?您是如何在 .NET 4 中运行 .NET 2.0 程序集的?

标签: c# logging enterprise-library


【解决方案1】:

这个问题在以前的版本中似乎也是 E-Lib 的一个已知错误。

已知为:从多个线程使用日志记录 AB 时出现未处理的异常。

“根本问题是,在 .NET 2.0 RTM 中,父线程的操作堆栈与其子线程共享,如果在创建子线程时存在这样的堆栈。”

在此处阅读更多信息:http://entlib.codeplex.com/workitem/9592

很难为此提出通用解决方案,因为它在很大程度上取决于您应用的架构。

【讨论】:

    猜你喜欢
    • 2015-04-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多