【发布时间】: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