Exception : "Stack Empty" in Enterprise Library 3.5.

Topics: General discussion, Logging Application Block
Jun 25, 2008 at 10:31 AM
Edited Jun 25, 2008 at 10:36 AM

I'm using Enterprise Library 3.5., Framework .NET 2.0
This works well, but sometimes I get the following exception message

System.InvalidOperationException: Stack empty. at System.Collections.Stack.Peek()
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(Boolean disposing)
at Microsoft.Practices.EnterpriseLibrary.Logging.Tracer.Dispose()

at DH2.GestionnaireBaseDeDonnees.ExecuteScalar(DbCommand command) in C:\Projects\PLO\DH2 - Branches\v23.1\DH2\DH2Solution\dh2corlib\GestionnaireBaseDeDonnees.cs:line 295 at DH2.Metier.Commun.DateTimeDh2.get_Now() in C:\Projects\PLO\DH2 - Branches\v23.1\DH2\DH2Solution\DH2.Metier.Commun\DateTimeDh2.cs:line 43 at DH2.Metier.Commun.UtilisateurDH2.get_CurrentMembership() in C:\Projects\PLO\DH2 - Branches\v23.1\DH2\DH2Solution\DH2.Metier.Commun\UtilisateurDH2.cs:line 176 at DH2.Metier.Commun.UtilisateurDH2.get_NomComplet() in C:\Projects\PLO\DH2 - Branches\v23.1\DH2\DH2Solution\DH2.Metier.Commun\UtilisateurDH2.cs:line 211 at Experts_AssignationsExperts.ods_Selected(Object sender, ObjectDataSourceStatusEventArgs e) at
...

The application "supports" concurrents calls...

Does anyone have any idea of what could cause this error?

Thanks,
Paul

Jun 25, 2008 at 3:26 PM

Hi Paul,

I think you're facing this issue http://www.codeplex.com/entlib/WorkItem/View.aspx?WorkItemId=9592. It's under investigation to determine if this is fixed in the .net 2.0 SP1:

936233 (http://support.microsoft.com/kb/936233/)FIX: You may not obtain the correct value from the logical operation stack when you use the System.Diagnostics.Trace.CorrelationManager.LogicalOperationStack property in the .NET Framework 2.0


Fernando

 


paullorena wrote:

I'm using Enterprise Library 3.5., Framework .NET 2.0
This works well, but sometimes I get the following exception message

System.InvalidOperationException: Stack empty. at System.Collections.Stack.Peek()
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(Boolean disposing)
at Microsoft.Practices.EnterpriseLibrary.Logging.Tracer.Dispose()

at DH2.GestionnaireBaseDeDonnees.ExecuteScalar(DbCommand command) in C:\Projects\PLO\DH2 - Branches\v23.1\DH2\DH2Solution\dh2corlib\GestionnaireBaseDeDonnees.cs:line 295 at DH2.Metier.Commun.DateTimeDh2.get_Now() in C:\Projects\PLO\DH2 - Branches\v23.1\DH2\DH2Solution\DH2.Metier.Commun\DateTimeDh2.cs:line 43 at DH2.Metier.Commun.UtilisateurDH2.get_CurrentMembership() in C:\Projects\PLO\DH2 - Branches\v23.1\DH2\DH2Solution\DH2.Metier.Commun\UtilisateurDH2.cs:line 176 at DH2.Metier.Commun.UtilisateurDH2.get_NomComplet() in C:\Projects\PLO\DH2 - Branches\v23.1\DH2\DH2Solution\DH2.Metier.Commun\UtilisateurDH2.cs:line 211 at Experts_AssignationsExperts.ods_Selected(Object sender, ObjectDataSourceStatusEventArgs e) at
...

The application "supports" concurrents calls...

Does anyone have any idea of what could cause this error?

Thanks,
Paul




Jun 25, 2008 at 9:52 PM

Hi Paul,

This is indeed caused by a problem in the RTM version of the .NET 2.0 Fx which is fixed by the .NET 2.0 SP1.

If you cannot install SP1, you can work around this issue by avoiding the creation of child threads from threads that already have an operations stack (not always possible) or by suppressing the flow of context to the new thread (also not possible if you don't own the creation of threads, and not always convenient since there's a lot more to the execution context than the operations stack).

Hope this helps,
Fernando

Jun 27, 2008 at 1:55 PM
Edited Jun 27, 2008 at 1:56 PM
Thank you for the info,  now we are using .NET 3.5, do you think the "problem" has been solved?



Thank
Jun 27, 2008 at 2:47 PM
It should be solved, yes. .NET v3.5 includes the .NET v2.0 SP1.

Fernando


paullorena wrote:
Thank you for the info,  now we are using .NET 3.5, do you think the "problem" has been solved?



Thank


Jan 25, 2011 at 3:59 PM

We had this pop up suddenly on an service of ours.  It might be related to .NET 4.0, which we upgraded the service to ~ 4 days before the first noted occurrence.  It also might be related to one of the following patches which were applied to the OS 36 hours before we first saw this occur.

Deployment of 2285068 Microsoft SQL Server 2008 Service Pack 2 (KB2285068)(en) (INX)

Deployment of MS11-002 Security Update for Windows Server 2008 x64 (KB2419640)(ALL) (INX)

Deployment of MS10-100 Security Update for Windows Server 2008 x64 (KB2442962)(ALL) (INX)

Deployment of MS10-098 Security Update for Windows Server 2008 x64 (KB2436673)(ALL) (INX)

Deployment of MS10-096 Security Update for Windows Server 2008 x64 (KB2423089)(ALL) (INX)

Deployment of MS10-092 Security Update for Windows Server 2008 x64 (KB2305420)(ALL) (INX)

Deployment of MS10-091 Security Update for Windows Server 2008 x64 (KB2296199)(ALL) (INX)

Deployment of MS10-090 Cumulative Security Update for Internet Explorer 7 for Windows Server 2008 x64 (KB2416400)(ALL) (INX)

Deployment of MS10-085 Security Update for Windows Server 2008 x64 (KB2207566)(ALL) (INX)

Deployment of MS10-083 Security Update for Windows Server 2008 x64 (KB979687)(ALL) (INX)

Deployment of MS10-083 Security Update for Windows Server 2008 Service Pack 2 x64 (KB979688)(ALL) (INX)

Deployment of MS10-081 Security Update for Windows Server 2008 x64 (KB2296011)(ALL) (INX)

Deployment of MS10-077 2160841 Security Update for .NET Framework 4.0 (All Languages) (64Bit) (INX)

Deployment of MS10-076 Security Update for Windows Server 2008 x64 (KB982132)(ALL) (INX)

Deployment of MS10-074 Security Update for Windows Server 2008 x64 (KB2387149)(ALL) (INX)

Deployment of MS10-070 2418042 2416473 Security Update for .NET Framework 3.5 SP1 (All Languages) (64Bit) (INX)

Deployment of MS10-070 2418042 2416472 Security Update for .NET Framework 4.0 (All Languages) (64Bit) (INX)

Deployment of MS10-070 2418042 2416470 Security Update for .NET Framework 2.0 SP2 and 3.5 SP1 (Vista/2K8 SP2 x64) (All Languages) (INX)

Deployment of MS10-068 Security Update for Windows Server 2008 x64 (KB981550)(ALL) (INX)

Deployment of MS10-065 Security Update for Windows Server 2008 x64 (KB2124261)(ALL) (INX)

Deployment of MS10-063 Security Update for Windows Server 2008 x64 (KB981322)(ALL) (INX)

Deployment of MS10-061 Security Update for Windows Server 2008 x64 (KB2347290)(ALL) (INX)

Deployment of MS10-060 Security Update for .NET Framework 3.5 SP1, Windows Vista SP2, and Windows Server 2008 SP2 for x64 (KB983589)(ALL) (INX)

Deployment of MS10-059 Security Update for Windows Server 2008 x64 (KB982799)(ALL) (INX)

Deployment of MS10-058 Security Update for Windows Server 2008 x64 (KB978886)(ALL) (INX)

Deployment of MS10-054 Security Update for Windows Server 2008 x64 (KB982214)(ALL) (INX)

Deployment of MS10-051 Security Update for Windows Server 2008 x64 (KB2079403)(ALL) (INX)

Deployment of MS10-046 Security Update for Windows Server 2008 x64 (KB2286198)(ALL) (INX)

Deployment of MS10-034 Cumulative Security Update for ActiveX Killbits for Windows Server 2008 x64 Edition (KB980195)(ALL) (INX)

Deployment of MS10-033 Security Update for Windows Server 2008 x64 Edition (KB979482)(ALL) (INX)

Deployment of MS10-030 Security Update for Windows Server 2008 x64 Edition (KB978542)(ALL) (INX)

Deployment of MS09-062 Security Update for the 2007 Microsoft Office System (KB972581)(ALL) (INX)

Jan 26, 2011 at 5:15 AM

I suggest you post this in a .NET forum since this is more of a .NET thing rather than an EntLib issue.

 

Sarah Urmeneta
Global Technologies & Solutions
Avande, Inc.
entlib.support@avanade.com