EnterpriseLibrary Error

I receive rare and intermittent error messages in our live environment. I was not successful in my attempts to reproduce it, and the mistake itself is a little mystery. Add to that, something seems to be related to the Enterprise Library trace (we are using version 5.0) - overall, a bit of a pain. This happens in Windows Sever 2008, the application is on .Net Framework 4.0 (WPF).

The following error message and stack trace:

ArgumentNullException: Value cannot be null. Parameter name: category <StackTrace> Server stack trace: at Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry.BuildCategoriesCollection(String category) at Microsoft.Practices.EnterpriseLibrary.Logging.Tracer.WriteTraceMessage(String message, String entryTitle, TraceEventType eventType) at Microsoft.Practices.EnterpriseLibrary.Logging.Tracer.WriteTraceEndMessage(String entryTitle) at Microsoft.Practices.EnterpriseLibrary.Logging.Tracer.Dispose() at TestApplication.ViewModelTest.&lt;UpdateUsers&gt;d__1a.MoveNext() Exception rethrown at [0]: at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.&lt;SetException&gt;b__1(Object state) at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() at System.Threading.ThreadPoolWorkQueue.Dispatch() at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback() </StackTrace> 

Can anyone shed light on what might be causing this?

EDIT: I am not modifying LogEntry.BuildCategoriesCollection. The input to the BuildCategoriesCollection (String category) method is null.

The UpdateUsers method is as follows:

 async void UpdateUsers() { Processing = true; using (traceMgr.StartTrace("Trace")) using (var engine = new EngineClient()) { Users = new List<UserMasterDataModel> { _blankUser }; var users = await engine.GetPossibleTagsTask(SelectedOutcomeId, _queue.SystemCd, _queue.QueueCd); Users.AddRange(users); } if (SelectedUser != _blankUser) { // If null user selected then initialize to the case tag, otherwise try to find the previously selected UserName var userNameToFind = SelectedUser == null ? _details.TagTo : SelectedUser.UserName; SelectedUser = Users.FirstOrDefault(user => user.UserName == userNameToFind) ?? _blankUser; OnPropertyChanged("SelectedUser"); } } 
+7
source share
1 answer

This issue seems to be a known bug for E-Lib in previous versions.

Known as: Unhandled exception when using AB log from multiple threads.

"The main problem is that, in RTM.NET 2.0, the parent thread's operation stacks were in conjunction with its children, if such a stack existed by the time the children were created."

More details here: http://entlib.codeplex.com/workitem/9592

It is difficult to propose a general solution for this, since it is very dependent on the architecture of your application.

+1
source