Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# EnterpriseLibrary Logger错误:从未同步的代码块调用了对象同步方法_C#_Logging_Asynchronous_Unity Container_Enterprise Library - Fatal编程技术网

C# EnterpriseLibrary Logger错误:从未同步的代码块调用了对象同步方法

C# EnterpriseLibrary Logger错误:从未同步的代码块调用了对象同步方法,c#,logging,asynchronous,unity-container,enterprise-library,C#,Logging,Asynchronous,Unity Container,Enterprise Library,我在使用MS Enterprise Library Logger登录时开始出现此错误 日志机制将日志条目排队,然后使用计时器每10秒刷新一次条目 它在一段时间内工作正常,但今天开始出现以下错误: 代码行: Logger.Write(list[i]); 错误消息: Object synchronization method was called from an unsynchronized block of code. 堆栈跟踪: at Microsoft.Practices.Unity.Sy

我在使用MS Enterprise Library Logger登录时开始出现此错误

日志机制将日志条目排队,然后使用计时器每10秒刷新一次条目

它在一段时间内工作正常,但今天开始出现以下错误:

代码行:

Logger.Write(list[i]);
错误消息:

Object synchronization method was called from an unsynchronized block of code.
堆栈跟踪:

at Microsoft.Practices.Unity.SynchronizedLifetimeManager.TryExit()
整个计时器elsapsed事件处理程序:

private void TimerElapsed(object sender, ElapsedEventArgs e)
{
            // Lock and free free the queue quickly - write to an intermediate list.
            var list = new List<LogEntry>();
            lock (LogEntryQueueLock)
            {
                while (true)
                {
                    if (_logEntryQueue.Count <= 0)
                        break;

                    //dequeue the LogEntry that will be written to the log
                    list.Add(_logEntryQueue.Dequeue());
                }
            }

            // Flush the list in to the log
            for (int i = 0; i < list.Count; i++)
            {
                ProcessEntry(list[i]);  // Strip commas from the string
                Logger.Write(list[i]);  //  <<<== ERRORS HERE
            }

}
private void timerecursed(对象发送方,ElapsedEventArgs e)
{
//快速锁定和释放队列-写入中间列表。
var list=新列表();
锁(LogEntryQueueLock)
{
while(true)
{

如果(_logEntryQueue.Count这似乎是一个现有问题:

好消息是,这应该通过版本2.1.505.2来解决,您可以从以下网址获得: