Nログを使用しています。ロガーオブジェクトを次のように初期化しようとすると:
private static Logger _logger = LogManager.GetCurrentClassLogger();
私は得る:
2012-11-22 10:15:33.8479|Error|MyClass(6468:13)|MyNamespace.BaseThreadLoop|Exception processing event in RequestLoop: System.TypeInitializationException: The type initializer for 'MyClass' threw an exception. ---> System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at System.Collections.Generic.List`1.Enumerator.MoveNext()
at NLog.Internal.EnumerableHelpers.<OfType>d__0`1.MoveNext() in c:\NLogBuild\src\NLog\Internal\EnumerableHelpers.cs:line 60
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at NLog.Internal.EnumerableHelpers.ToList[T](IEnumerable`1 enumerable) in c:\NLogBuild\src\NLog\Internal\EnumerableHelpers.cs:line 118
at NLog.Internal.ObjectGraphScanner.ScanProperties[T](List`1 result, Object o, Int32 level, Dictionary`2 visitedObjects) in c:\NLogBuild\src\NLog\Internal\ObjectGraphScanner.cs:line 118
at NLog.Internal.ObjectGraphScanner.ScanProperties[T](List`1 result, Object o, Int32 level, Dictionary`2 visitedObjects) in c:\NLogBuild\src\NLog\Internal\ObjectGraphScanner.cs:line 125
at NLog.Internal.ObjectGraphScanner.ScanProperties[T](List`1 result, Object o, Int32 level, Dictionary`2 visitedObjects) in c:\NLogBuild\src\NLog\Internal\ObjectGraphScanner.cs:line 125
at NLog.Internal.ObjectGraphScanner.ScanProperties[T](List`1 result, Object o, Int32 level, Dictionary`2 visitedObjects) in c:\NLogBuild\src\NLog\Internal\ObjectGraphScanner.cs:line 125
at NLog.Internal.ObjectGraphScanner.FindReachableObjects[T](Object[] rootObjects) in c:\NLogBuild\src\NLog\Internal\ObjectGraphScanner.cs:line 65
at NLog.Internal.TargetWithFilterChain.PrecalculateStackTraceUsage() in c:\NLogBuild\src\NLog\Internal\TargetWithFilterChain.cs:line 95
at NLog.LogFactory.GetTargetsByLevelForLogger(String name, IList`1 rules, TargetWithFilterChain[] targetsByLevel, TargetWithFilterChain[] lastTargetsByLevel) in c:\NLogBuild\src\NLog\LogFactory.cs:
line 587
at NLog.LogFactory.GetTargetsByLevelForLogger(String name, IList`1 rules, TargetWithFilterChain[] targetsByLevel, TargetWithFilterChain[] lastTargetsByLevel) in c:\NLogBuild\src\NLog\LogFactory.cs:
line 574
at NLog.LogFactory.GetConfigurationForLogger(String name, LoggingConfiguration configuration) in c:\NLogBuild\src\NLog\LogFactory.cs:line 599
at NLog.LogFactory.GetLogger(LoggerCacheKey cacheKey) in c:\NLogBuild\src\NLog\LogFactory.cs:line 717
at NLog.LogFactory.GetLogger(String name) in c:\NLogBuild\src\NLog\LogFactory.cs:line 330
at NLog.LogManager.GetCurrentClassLogger() in c:\NLogBuild\src\NLog\LogManager.cs:line 143
at MyNamespace.MyOtherClass..cctor() in C:\....cs:line 25
--- End of inner exception stack trace ---
at MyNamespace.MyClass.get_Instance()
...
http://nlog-forum.1685105.n2.nabble.com/InvalidOperationException-when-accessing-the-configuration-from-multiple-threads-td6723806.htmlの提案に従って、メモリ ターゲットを別のクラスに移動しましたが、まだ問題があります。何か案が?