Resolving TextExceptionFormatter

Topics: Exception Handling Application Block, Silverlight Integration Pack
Aug 5, 2011 at 3:43 AM

Hi everyone,

I having an issue with the resolution of the TextExceptionFormatter in Silverlight.

When trying to use EnterpriseLibraryContainer.Current, the Silverlight application is reporting that it cannot resolve the FormatterTypeName, which is set in the config shown below.

I have tried using:

  •  Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter
  • TextExceptionFormatter
  • Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling
  • Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Silverlight
I am using Unity for my IoC, and I am wondering if I should be registering the TextExceptionFormatter and, if so, how I should do the registration

Thanks!

Jason

<?xml version="1.0" encoding="utf-8"?>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:el="clr-namespace:Microsoft.Practices.EnterpriseLibrary.Logging.Configuration;assembly=Microsoft.Practices.EnterpriseLibrary.Logging.Silverlight"
                    xmlns:eh="clr-namespace:Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration;assembly=Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Silverlight"
                    xmlns:ehl="clr-namespace:Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.Configuration;assembly=Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.Silverlight">
  <el:LoggingSettings DefaultCategory="SilverlightGeneral" x:Key="loggingConfiguration">
    <el:LoggingSettings.TraceListeners>
      <el:RemoteServiceTraceListenerData LoggingServiceFactory="CustomBinding_ILoggingService" SubmitInterval="00:01:00" SendImmediately="True" Name="Remote Service Trace Listener" />
    </el:LoggingSettings.TraceListeners>
    <el:LoggingSettings.TraceSources>
      <el:TraceSourceData Name="SilverlightGeneral">
        <el:TraceSourceData.TraceListeners>
          <el:TraceListenerReferenceData Name="Remote Service Trace Listener" />
        </el:TraceSourceData.TraceListeners>
      </el:TraceSourceData>
    </el:LoggingSettings.TraceSources>
    <el:LoggingSettings.SpecialTraceSources>
      <el:SpecialTraceSourcesData>
        <el:SpecialTraceSourcesData.AllEventsTraceSource>
          <el:TraceSourceData Name="All Events" />
        </el:SpecialTraceSourcesData.AllEventsTraceSource>
        <el:SpecialTraceSourcesData.NotProcessedTraceSource>
          <el:TraceSourceData Name="Unprocessed Category" />
        </el:SpecialTraceSourcesData.NotProcessedTraceSource>
        <el:SpecialTraceSourcesData.ErrorsTraceSource>
          <el:TraceSourceData Name="Logging Errors &amp; Warnings">
            <el:TraceSourceData.TraceListeners>
              <el:TraceListenerReferenceData Name="Remote Service Trace Listener" />
            </el:TraceSourceData.TraceListeners>
          </el:TraceSourceData>
        </el:SpecialTraceSourcesData.ErrorsTraceSource>
      </el:SpecialTraceSourcesData>
    </el:LoggingSettings.SpecialTraceSources>
  </el:LoggingSettings>
  <eh:ExceptionHandlingSettings x:Key="exceptionHandling">
    <eh:ExceptionHandlingSettings.ExceptionPolicies>
      <eh:ExceptionPolicyData Name="Unhandled Exception">
        <eh:ExceptionPolicyData.ExceptionTypes>
          <eh:ExceptionTypeData Name="All Exceptions" TypeName="System.Exception, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e">
            <eh:ExceptionTypeData.ExceptionHandlers>
                <ehl:LoggingExceptionHandlerData LogCategory="SilverlightGeneral" FormatterTypeName="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter" Name="Logging Exception Handler" />
            </eh:ExceptionTypeData.ExceptionHandlers>
          </eh:ExceptionTypeData>
        </eh:ExceptionPolicyData.ExceptionTypes>
      </eh:ExceptionPolicyData>
    </eh:ExceptionHandlingSettings.ExceptionPolicies>
  </eh:ExceptionHandlingSettings>
</ResourceDictionary>

 

Aug 5, 2011 at 5:46 AM

Resolved this issue by regenerating the configuration file in the editor. Only difference appears to be the FormatterTypeName

Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Silverlight, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

Bit of a head scratcher, this 'un. I wouldn't have though the version number would have made a difference in this case, but it does.