Resolving the full type name

Topics: Exception Handling Application Block
Apr 3, 2009 at 1:26 PM
Edited Apr 3, 2009 at 2:31 PM

Hi,

We are writing an WPF application using .NET 3.5 with Enterprise Library 4.1. We have created an custom handler - UIExceptionHandler within our exe project. When we try to invoke the ExceptionPolicy.HandleException(e, "UI Message Policy"); method, we encounter the below [1] error.

Find below my code for

namespace

CName.DName.AName.UI
{
[
ConfigurationElementType(typeof(CustomHandlerData))]
public class UIExceptionHandler : IExceptionHandler
{
public UIExceptionHandler(NameValueCollection ignore)
{
}

public Exception HandleException(Exception exception, Guid handlingInstanceId) {
DialogResult result = this.ShowThreadExceptionDialog(exception);
return exception;
}

// Creates the error message and displays it.
private DialogResult ShowThreadExceptionDialog(Exception ex)
{
return MessageBox.Show("Some Error Message", "Application Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
}
}

Also find below the implementation of the custom handler in the app.config file

<

add name="UIExceptionPolicy">
<
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="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" priority="0" useDefaultLogger="false" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="Logging Handler" />
   <
add type="CName.DName.AName.UI.UIExceptionHandler, CName.DName.AName.UI" name="UI Message Handler"/>
</exceptionHandlers>
</
add>
</
exceptionTypes>
</
add>

 

 

 

 

 

 

FYI - When I tried implementing the UIExceptionHandler custom handler class in an DLL and provided the full name in the app.config, it worked fine. But this fails when I create the handler within the exe project. The name of our exe project is Test.

What might be wrong here?

[1]
The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyImpl, UIExceptionPolicy]) failed: The type 'CName.DName.AName.UI.UIExceptionHandler, CName.DName.AName.UI.' cannot be resolved. Please verify the spelling is correct or that the full type name is provided. (Strategy type ConfiguredObjectStrategy, index 2)

 Regards,
 Vipul

 

Apr 3, 2009 at 2:35 PM

I got this resolved.

Within the project properties of my exe project the Assembly name was set as Test. So within the UIExceptionHandler class, I had to change the namespace from namespace CName.DName.AName.UI to namespace Test and this resolved the issue