473,383 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Enterprise Library Jan 2006 - custom exception formatter fails unless running debugger

Enterprise Library Jan 2006 with Visual Studio 2005 on Windows 2000
Server sp4.

My custom exception formatter fails with a "Unable to handle exception:
'LoggingExceptionHandler'." exception. When I attached the debugger to
the process and stepped into the code it executed without error. In
both cases I was running a Debug build, the only difference in the case
that works is that I attached the debugger to the same exact binaries.
Note: the error also occurs in a Release build.

*** Start excerpt from web.config ***

<exceptionHandling>
<exceptionPolicies>
<add name="General">
<exceptionTypes>
<add type="System.Exception, mscorlib, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
postHandlingAction="NotifyRethrow" name="Exception">
<exceptionHandlers>
<add logCategory="General" eventId="100" severity="Error"
title="Enterprise Library Exception Handling"
formatterType="Shared.WebTextExceptionFormatter,
Shared, Version=1.0.2213.28731, Culture=neutral, PublicKeyToken=null"
priority="0"
type="Microsoft.Practices.EnterpriseLibrary.Except ionHandling.Logging.LoggingExceptionHandler,
Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling.Logging,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"
name="Logging Handler" />
</exceptionHandlers>
</add>
</exceptionTypes>
</add>
</exceptionPolicies>
</exceptionHandling>

*** End excerpt from web.config ***

*** Start Event Log entry ***

Event Type: Warning
Event Source: ASP.NET 2.0.50727.0
Event Category: Web Event
Event ID: 1309
Date: 1/22/2006
Time: 5:33:36 PM
User: N/A
Computer: abc3
Description:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 1/22/2006 5:33:36 PM
Event time (UTC): 1/23/2006 1:33:36 AM
Event ID: b42e0b6c76d64c2c8a3cd9acdeac7a93
Event sequence: 30
Event occurrence: 1
Event detail code: 0

Application information:
Application domain: /LM/W3SVC/1/Root/Set-3-127824536009911250
Trust level: Full
Application Virtual Path: /Set
Application Path: D:\00-data\Dev\Settlement\www-set-development\
Machine name: abc3

Process information:
Process ID: 3432
Process name: aspnet_wp.exe
Account name: abc3\ASPNET

Exception information:
Exception type: ExceptionHandlingException
Exception message: Unable to handle exception:
'LoggingExceptionHandler'.

Request information:
Request URL: http://localhost/Set/Billing/ParticipantMessages.aspx
Request path: /Set/Billing/ParticipantMessages.aspx
User host address: 127.0.0.1
User: corporate\abc
Is authenticated: True
Authentication Type: NTLM
Thread account name: abc3\ASPNET

Thread information:
Thread ID: 7
Thread account name: abc3\ASPNET
Is impersonating: True
Stack trace: at
Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling.ExceptionPolicyEntry.ExecuteHandlerChain(Exc eption
ex, Guid handlingInstanceID)
at
Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling.ExceptionPolicyEntry.Handle(Exception
exceptionToHandle)
at
Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling.ExceptionPolicyImpl.HandleException(Exceptio n
exceptionToHandle)
at
Microsoft.Practices.EnterpriseLibrary.ExceptionHan dling.ExceptionPolicy.HandleException(Exception
exceptionToHandle, String policyName)
at Shared.BasePage.OnError(EventArgs e)
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(Http Context
context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.billing_participantmessages_aspx.ProcessReques t(HttpContext
context)
at
System.Web.HttpApplication.CallHandlerExecutionSte p.System.Web.HttpApplication.IExecutionStep.Execut e()
at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step,
Boolean& completedSynchronously)
Custom event details:

*** End Event Log entry ***

Jan 23 '06 #1
1 1424
It turns out that it also fails in the debugger, although only
intermittently.

I finally discovered that the problem was that the ServerVariables
collection was being changed while my custom formatter was doing a "for
each" loop to dump these variables into the exception message. I have
no idea what would cause the ServerVariables to change while the page
is being processed but I did the exact same "for each" loop on this
collection in .NET 1.1 for a year or more without encountering this
problem.

Anyway, the solution I implemented to solve this problem was to first
create a copy of the ServerVariables by instantiating a new
NameObjectKeysEnumerator object and passing in the ServerVariables
collection to the constructor. I can then iterate the copy of this
collection without it changing on me.

BTW a "Collection was modified after the enumerator was instantiated."
exception gets thrown by NameObjectKeysEnumerator.MoveNext() when this
happens but Enterprise Library catches the exception and throws a new
generic "Unable to handle exception: 'LoggingExceptionHandler'."
exception without assigning the lower level exception to the inner
exception property of the new exception. It would have saved me a lot
of time if Enterprise Library wrapped the old exception instead of just
creating a new meaningless generic one. Since this problem was
intermittent it wasn't easy to track this down even using a debugger.

Jan 29 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: shablool | last post by:
Hi all! The Strinx library is an efficient and easy-to-use string library. It is written in C++, using modern template approach. It uses a class hierarchy to implement a set of string objects...
9
by: Claudio Di Flumeri | last post by:
Hello all, I've added a global exception handler to my application in this way: Sub Main() AddHandler Application.ThreadException, AddressOf ThreadException AddHandler...
0
by: Chris Crowe [MVP 1997 -> 2006] | last post by:
I am having major problems using GetStoredProcCommand and using Parameters in the same function call in the latest builds of the Enterprise Library Data. The error I get is : Failed to...
1
by: David Herbst | last post by:
Enterprise Library Jan 2006 with Visual Studio 2005 on Windows 2000 Server sp4. My custom exception formatter fails with a "Unable to handle exception: 'LoggingExceptionHandler'." exception. ...
0
by: Eniac | last post by:
Hello, I've started using Enterprise Library 2.0 recently and I've encountered a problem that seems to be ... well... undocumented :) Basically, when I set a Trace Listener (formatted event...
1
by: Jess Chadwick | last post by:
I am attempting to use the Enterprise Library (Jan 2006) Cryptography block to encrypt a credit card number in my ASP.NET 2.0 Commerce Server application. Everything is configured correctly, as...
5
by: Dick | last post by:
I have a .net 2005 class library project that relies upon the Data Access Application Block from the 2006 Enterprise Library. I want to call my project from a legacy VB6 application. Simple...
24
by: Earl | last post by:
I have all of my data operations in a separate library, so I'm looking for what might be termed "best practices" on a return type from those classes. For example, let's say I send an update from...
2
by: srinivasan.shanmugapillai | last post by:
Hi, I'm running a VB.NET windows applicatrion that is using the enterprise services transactions. While running this application without enterprise services support, a connection is...
0
by: =?Utf-8?B?YW5rMmdv?= | last post by:
Hi, Thanks in advance for reading this. Not sure where to post this question, but I hope someone in here can help. Trying to write to Event Log in VS 2005 (.NET 2.0) using Enterprise Library...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.