Probelm Creating Custom Text Exception Formatter

Topics: Building and extending application blocks, Exception Handling Application Block
Mar 24, 2008 at 6:05 PM
I'm trying to make some customization in the TextExceptionFormatter class .. so i decided to develop my own formatter that inhirit from TextExceptionFormatter ...
here is the full code

using System;
using System.Collections.Generic;
using System.Text;

using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling;
using Microsoft.Practices.EnterpriseLibrary.Logging;
using System.Diagnostics;
using System.IO;

namespace CustomTextFormatter.CustomTextFormatter
{
public class CustomTextFormatter : TextExceptionFormatter
{
public CustomTextFormatter(TextWriter writer, Exception exception)
: base(writer, exception)
{

}

protected override void WriteAdditionalInfo(System.Collections.Specialized.NameValueCollection additionalInformation)
{
base.WriteAdditionalInfo(additionalInformation);

if (this.Exception.Data"Custom" != null)
{
this.Writer.Write("Custom");
this.Writer.Write(" : ");
this.Writer.Write(this.Exception.Data"Custom".ToString());
this.Writer.Write("\n");
}

}

}
}

it is very simple and clear .. i oppened the configuration file and i added a logging handler to the the policy and set the formatter type property to my new
formatter by loading the assembly..

the application gives me the following error at this line

ExceptionPolicy.HandleException(ex, "DAL Policy");

The type 'CustomTextFormatter.CustomTextFormatter, CustomTextFormatter, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' cannot be resolved. Please verify the spelling is correct or that the full type name is provided.

any help please ....
Mar 25, 2008 at 12:56 AM
Can the CustomTextFormatter assembly be loaded by your application? Eg is it in the folder where you app's exe resides?

Fernando
Mar 25, 2008 at 4:00 PM

thanks fernando ...
it is working fine now ..
actually i copied it the the exe folder