List Info

Thread: Enterprise Library Exception Block




Enterprise Library Exception Block
user name
2006-05-15 03:17:25
I'm trying to use the Exception Block in Enterprise Library
for Fx 2.0 for the first time.
 
The project that I'll be using it in is a strong-name type
assembly.  So i altered the source code for the Entreprise
Library so that it was strong named as well.
 
In an effort to better understand how the block worked, I
created a brand solution that is so far not strong named.  I
joined my strong named Ent Lib assemblies as references to
this new project.
 
In my test project I have a Form with one button on it, when
the button is pressed , I raise an exception and pass it to
the Exception Block, it's within the Exp Block code that I
get the following error.  
 
First here is my click event *(the line with the  is the
line of the error)
 
private void button1_Click(object sender, EventArgs e){
 try{
   try{
     MakeError();
   }
   catch (Exception ex) {
    
if (ExceptionPolicy.HandleException(ex, "Exception
Policy")){
        throw;
     }
   }
 }
 catch (Exception ex1){
    MessageBox.Show(ex1.Message);
 }
}
 
public void MakeError(){
  throw new Exception("There's, like, an error, you
know?");
}
 
Here is the error and stack trace
 
System.Configuration.ConfigurationErrorsException was
unhandled by user code
  Message="An error occurred creating the
configuration section handler for exceptionHandling: Could
not load file or assembly
'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or
one of its dependencies. The located assembly's manifest
definition does not match the assembly reference. (Exception
from HRESULT: 0x80131040) (C:\\Documents and
Settings\\vince.VINNYCHI\\My Documents\\Visual Studio
2005\\Projects\\WindowsApplication3\\WindowsApplicatio
n3\\bin\\Debug\\WindowsApplication3.vshost.exe.config
line 4)"
  Source="System.Configuration"
  BareMessage="An error occurred creating the
configuration section handler for exceptionHandling: Could
not load file or assembly
'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or
one of its dependencies. The located assembly's manifest
definition does not match the assembly reference. (Exception
from HRESULT: 0x80131040)"
  Filename="C:\\Documents and
Settings\\vince.VINNYCHI\\My Documents\\Visual Studio
2005\\Projects\\WindowsApplication3\\WindowsApplicatio
n3\\bin\\Debug\\WindowsApplication3.vshost.exe.config
"
  Line=4
  StackTrace:
       at
System.Configuration.BaseConfigurationRecord.FindAndEnsureFa
ctoryRecord(String configKey, Boolean&
isRootDeclaredHere)
       at
System.Configuration.BaseConfigurationRecord.GetSectionRecur
sive(String configKey, Boolean getLkg, Boolean
checkPermission, Boolean getRuntimeObject, Boolean
requestIsHere, Object& result, Object&
resultRuntimeObject)
       at
System.Configuration.BaseConfigurationRecord.GetSection(Stri
ng configKey, Boolean getLkg, Boolean checkPermission)
       at
System.Configuration.BaseConfigurationRecord.GetSection(Stri
ng configKey)
       at
System.Configuration.ClientConfigurationSystem.System.Config
uration.Internal.IInternalConfigSystem.GetSection(String
sectionName)
       at
System.Configuration.ConfigurationManager.GetSection(String
sectionName)
       at
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.S
ystemConfigurationSourceImplementation.GetSection(String
sectionName)
       at
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.S
ystemConfigurationSource.GetSection(String sectionName)
       at
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Conf
iguration.ExceptionHandlingSettings.GetExceptionHandlingSett
ings(IConfigurationSource configurationSource)
       at
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Exce
ptionHandlingConfigurationView.get_ExceptionHandlingSettings
()
       at
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Exce
ptionHandlingConfigurationView.GetExceptionPolicyData(String
policyName)
       at
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Exce
ptionPolicyCustomFactory.GetConfiguration(String id,
IConfigurationSource configurationSource)
       at
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Exce
ptionPolicyCustomFactory.CreateObject(IBuilderContext
context, String name, IConfigurationSource
configurationSource, ConfigurationReflectionCache
reflectionCache)
       at
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.O
bjectBuilder.ConfiguredObjectStrategy.BuildUp(IBuilderContex
t context, Type t, Object existing, String id)
       at
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IB
uilderContext context, Type typeToBuild, Object existing,
String idToBuild) in C:\Program Files\Microsoft Enterprise
Library January
2006\src\ObjectBuilder\BuilderStrategy.cs:line 39
       at
Microsoft.Practices.ObjectBuilder.SingletonStrategy.BuildUp(
IBuilderContext context, Type typeToBuild, Object existing,
String idToBuild) in C:\Program Files\Microsoft Enterprise
Library January
2006\src\ObjectBuilder\Strategies\Singleton\SingletonSt
rategy.cs:line 48
       at
Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IB
uilderContext context, Type typeToBuild, Object existing,
String idToBuild) in C:\Program Files\Microsoft Enterprise
Library January
2006\src\ObjectBuilder\BuilderStrategy.cs:line 39
       at
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.O
bjectBuilder.ConfigurationNameMappingStrategy.BuildUp(IBuild
erContext context, Type t, Object existing, String id)
       at
Microsoft.Practices.ObjectBuilder.BuilderBase`1.DoBuildUp(IR
eadWriteLocator locator, Type typeToBuild, String idToBuild,
Object existing, PolicyList[] transientPolicies) in
C:\Program Files\Microsoft Enterprise Library January
2006\src\ObjectBuilder\BuilderBase.cs:line 101
       at
Microsoft.Practices.ObjectBuilder.BuilderBase`1.BuildUp(IRea
dWriteLocator locator, Type typeToBuild, String idToBuild,
Object existing, PolicyList[] transientPolicies) in
C:\Program Files\Microsoft Enterprise Library January
2006\src\ObjectBuilder\BuilderBase.cs:line 79
       at
Microsoft.Practices.ObjectBuilder.BuilderBase`1.BuildUp[TTyp
eToBuild](IReadWriteLocator locator, String idToBuild,
Object existing, PolicyList[] transientPolicies) in
C:\Program Files\Microsoft Enterprise Library January
2006\src\ObjectBuilder\BuilderBase.cs:line 66
       at
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.O
bjectBuilder.EnterpriseLibraryFactory.BuildUp[T](IReadWriteL
ocator locator, String id, IConfigurationSource
configurationSource)
       at
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.O
bjectBuilder.LocatorNameTypeFactoryBase`1.Create(String
name)
       at
Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Exce
ptionPolicy.GetExceptionPolicy(Exception exception, String
policyName)
 
 
 
 
 
---
Vince
 

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )