Silverlight Exception Handling

Topics: Exception Handling Application Block, Logging Application Block, Silverlight Integration Pack
Jul 18, 2011 at 5:38 PM

I have successfully gotten the silverlight remote logging to work.  However, when I try to implement an exception handler I receive the following compiler error:

Error 39 The tag 'LoggingExceptionHandlerData' does not exist in XML namespace 'http://schemas.microsoft.com/practices/2011/entlib'. D:\Milvia Systems\Development\Testing and R&D\SilverlightNavigation\Configuration.xaml 48 16 SilverlightNavigation

The offending XAML is: 

<

el:LoggingExceptionHandlerData LogCategory="error" FormatterTypeName="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling" Name="Logging Exception Handler" /> 

I am using the release version of the integration kit.

Intellisense in the XAML editor does have the LoggingExceptionHandlerData tag.

I used the configuration editor to create the config file entries and then exported to XAML.

Has anyone gotten Silverlight Exception Handling to work?

Thanks.

Martin Reich

 

Jul 20, 2011 at 4:18 AM

Hi Martin,

Can you try to reference the individual namespace instead and see if it works?

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">

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Nov 28, 2011 at 2:05 PM

I am having the EXACT same error and issue this was not happening before, I have removed the exception handling block and added it again from the configuration and no change when i comment it out my application loads...but obviously thats not a solution.

I am using Enterprise Library silverlight intergaration pack 5.0

has anyone encoutnred this error ?

Nov 29, 2011 at 7:30 AM

Where does your XAML file reside: in the web application project or the Silverlight project?  Also, what are the build action and custom tool settings for the configuration file?

 

--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com

Nov 30, 2011 at 12:52 AM

my xaml file resides in the silverlight project, i just unstalled the EL and ELSL 5.0 and re installed it and the problem went away,  never really solved it., but i am getting a diffrent kind of error now, my Servicereference.ClientConfig which is in my Silverlight app(not in the host.web) refuses to compile into the xap, even though it is in the SL project why is this ??? here is the error i get:

{System.Xml.XmlException: Cannot find file 'ServiceReferences.ClientConfig' in the application xap package.

Message:

Cannot find 'ServiceReferences.ClientConfig' in the .xap application package. This file is used to configure client proxies for web services, and allows the application to locate the services it needs. Either include this file in the application package, or modify your code to use a client proxy constructor that specifies the service address and binding explicitly. Please see inner exception for details.

inner exception:

{System.Xml.XmlException: Cannot find file 'ServiceReferences.ClientConfig' in the application xap package.
   at System.Xml.XmlXapResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
   at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
   at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext)
   at System.ServiceModel.Configuration.ServiceModelSectionGroup.GetSectionGroup()}

Nov 30, 2011 at 1:20 AM

Are you sure it's not in the xap file?  Can you verify it's not in the xap file?  Also, what is the build action for the ServiceReferences.ClientConfig file?  It should be Content.

 

--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com

Jan 31, 2013 at 6:30 PM
So, what is solution for compiling error:
"The tag 'LoggingExceptionHandlerData' does not exist in XML namespace 'http://schemas.microsoft.com/practices/2011/entlib'."?
Jan 31, 2013 at 6:40 PM
I tried to reference individual namespaces as you recommended and same result -
The tag 'LoggingExceptionHandlerData' does not exist in XML namespace 'clr-namespace:Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.Configuration;assembly=Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.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"
 <eh:ExceptionHandlingSettings x:Key="exceptionHandling">

        <eh:ExceptionHandlingSettings.ExceptionPolicies>
            <eh:ExceptionPolicyData Name="ExceptionPolicy">
                <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="General" FormatterTypeName="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling" Name="Logging Exception Handler" />
                        </eh:ExceptionTypeData.ExceptionHandlers>
                    </eh:ExceptionTypeData>
                </eh:ExceptionPolicyData.ExceptionTypes>
            </eh:ExceptionPolicyData>
        </eh:ExceptionHandlingSettings.ExceptionPolicies>
    </eh:ExceptionHandlingSettings>
Feb 1, 2013 at 3:29 PM
I found solution for my problems with Exception Handler in Silverlight.
  1. Compilation error "The tag 'LoggingExceptionHandlerData' does not exist in XML namespace 'http://schemas.microsoft.com/practices/2011/entlib'." appears only if Exception block installed using NuGet. If you refer dlls manually compiling process is OK (though md5 of dlls in both cases the same).
  2. EnterpriseLib configuration tool during export to xaml generates this line for Exception handler:
          <el:LoggingExceptionHandlerData LogCategory="General" FormatterTypeName="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling" Name="Logging Exception Handler" />
    This will give you troubles when EnterpriseLibraryContainer initializing....it will complain abt missed dependencies...
    Problem here, that FormatterTypeName is not properly created - missed full assembly name. Correct line should be like this:
                        <el:LoggingExceptionHandlerData LogCategory="General" FormatterTypeName="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Silverlight, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Name="Logging Exception Handler" />
    You see Version, PublicKey, Culture.... I think it is bug in the config tool. Correct manually line and everything should work.