Custom Formatter Causes Unhandled Exception in EntLib 4.1

Jan 28, 2009 at 4:08 PM
I have a custom exception handling scheme that uses a custom trace listener, custom exception formatter, and custom log formatter.  All were developed under EntLib 4.0 and run fine on that version.  However, when solution is upgraded to EntLib 4.1, the custom log formatter causes the Enterprise Library to throw an "ExceptionHandlingException - Unable to handle exception: 'LoggingExceptionHandler'. " error.  This occurs immediately after completion of the constructor on the custom log formatter.  Logged in Application log as follows:

Event code: 3005

Event message: An unhandled exception has occurred.

Event time: 1/28/2009 9:37:40 AM

Event time (UTC): 1/28/2009 3:37:40 PM

Event ID: 41a70ca1e4d94917929659d8ebd565c6

Event sequence: 8

Event occurrence: 1

Event detail code: 0

 

Application information:

Application domain: /LM/W3SVC/1/Root/CSE-7-128776305978750000

Trust level: Full

Application Virtual Path: /CSE

Application Path: C:\Workspaces\CSE_AF\Dev\Source\Prototype\CSE\

Machine name: EG-076-099

 

Process information:

Process ID: 4792

Process name: aspnet_wp.exe

Account name: NT AUTHORITY\SYSTEM

 

Exception information:

Exception type: ExceptionHandlingException

Exception message: Unable to handle exception: 'LoggingExceptionHandler'.

 

Request information:

Request URL: https://localhost:443/CSE/Login.aspx

Request path: /CSE/Login.aspx

User host address: 127.0.0.1

User:

Is authenticated: False

Authentication Type:

Thread account name: NT AUTHORITY\SYSTEM

 

Thread information:

Thread ID: 1

Thread account name: NT AUTHORITY\SYSTEM

Is impersonating: False

Stack trace: at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyEntry.ExecuteHandlerChain(Exception ex, Guid handlingInstanceID)

at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyEntry.Handle(Exception exceptionToHandle)

at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyImpl.HandleException(Exception exceptionToHandle)

at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.HandleException(Exception exceptionToHandle, String policyName, ExceptionPolicyFactory policyFactory)

at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.HandleException(Exception exceptionToHandle, String policyName)

at CSE.Login.btnLogin_Click(Object sender, EventArgs e) in C:\Workspaces\CSE_AF\Dev\Source\Prototype\CSE\Login.aspx.vb:line 66

at System.Web.UI.WebControls.Button.OnClick(EventArgs e)

at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)

at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)

at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)

at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)

at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 

 

Custom event details:

For more information, see Help and Support Center at



My custom log formatter is declared as follows (Format method omitted for brevity)

<ConfigurationElementType(

GetType(CustomFormatterData))> _

 

Public

Class WebUILogFormatter

 

 

Inherits Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.LogFormatter

 

 

 

Public Sub New(ByVal attributes As NameValueCollection)

 

 

'if I put code in here I can break into the Custom Formatter in debug but as soon as End Sub completes, the above unhandled exception is thrown by EntLib 4.1

End
Sub

 

 

End

Class

 

As I said above, this works perfectly fine under EntLib 4.0.

Any help appreciated.

Thanks.