ExceptionHandlingException: Could not load file or assembly MyAssembly...?

Topics: Exception Handling Application Block
Oct 8, 2007 at 10:07 AM
Edited Oct 14, 2007 at 5:25 AM
Hi,

I am having a problem with WCF exception shielding. It seems to me that all is right in my configuration and code but the application block chokes when it tries to find my fault. If you look at the thrown exception you'll say that the problem is that the app.block cannot load my assembly BusinessLogic 1.0.0.2719 but the version of my assembly is 1.0.0.0 and in app.config it is refered to as 1.0.0.0. I do not understand why the block is trying to load a different version. Please help this has been haunting me for weeks...

Thank you
Val

A first chance exception of type 'Abc.BusinessLogic.FieldNullException' occurred in BusinessLogic.dll
General Information: 1 : Timestamp: 10/8/2007 8:17:18 AM
Message: Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionHandlingException: Could not load file or assembly 'BusinessLogic, Version=1.0.0.2719, Culture=neutral, PublicKeyToken=25be6966e7e7a65e' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) ---> System.IO.FileLoadException: Could not load file or assembly 'BusinessLogic, Version=1.0.0.2719, Culture=neutral, PublicKeyToken=25be6966e7e7a65e' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'BusinessLogic, Version=1.0.0.2719, Culture=neutral, PublicKeyToken=25be6966e7e7a65e'
at System.RuntimeTypeHandle._GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
at System.RuntimeType.PrivateGetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
at System.Type.GetType(String typeName)
at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.WCF.Configuration.FaultContractHandlerAssembler.Assemble(IBuilderContext context, ExceptionHandlerData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.AssemblerBasedObjectFactory`2.Create(IBuilderContext context, TConfiguration objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyEntryCustomFactory.Create(IBuilderContext context, ExceptionTypeData objectConfiguration, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicyCustomFactory.CreateObject(IBuilderContext context, String name, IConfigurationSource configurationSource, ConfigurationReflectionCache reflectionCache)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfiguredObjectStrategy.BuildUp(IBuilderContext context, Type t, Object existing, String id)
at Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
at Microsoft.Practices.ObjectBuilder.SingletonStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
at Microsoft.Practices.ObjectBuilder.BuilderStrategy.BuildUp(IBuilderContext context, Type typeToBuild, Object existing, String idToBuild)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.ConfigurationNameMappingStrategy.BuildUp(IBuilderContext context, Type t, Object existing, String id)
at Microsoft.Practices.ObjectBuilder.BuilderBase`1.DoBuildUp(IReadWriteLocator locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[] transientPolicies)
at Microsoft.Practices.ObjectBuilder.BuilderBase`1.BuildUp(IReadWriteLocator locator, Type typeToBuild, String idToBuild, Object existing, PolicyList[] transientPolicies)
at Microsoft.Practices.ObjectBuilder.BuilderBase`1.BuildUpTTypeToBuild(IReadWriteLocator locator, String idToBuild, Object existing, PolicyList[] transientPolicies)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUpT(IReadWriteLocator locator, String id, IConfigurationSource configurationSource)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.LocatorNameTypeFactoryBase`1.Create(String name)
at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.GetExceptionPolicy(Exception exception, String policyName, ExceptionPolicyFactory factory)

=== Pre-bind state information ===
LOG: User = VTMELAMED\valo
LOG: DisplayName = BusinessLogic, Version=1.0.0.2719, Culture=neutral, PublicKeyToken=25be6966e7e7a65e
(Fully-specified)
LOG: Appbase = file:///C:/Users/valo/Documents/Projects/Abc/Abc.dev/Main/US/BusinessLogic/BusinessLogicExecutable/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.WCF, Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\valo\Documents\Projects\Abc\Abc.dev\Main\US\BusinessLogic\BusinessLogicExecutable\bin\Debug\BusinessLogicExecutable.vshost.exe.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Post-policy reference: BusinessLogic, Version=1.0.0.2719, Culture=neutral, PublicKeyToken=25be6966e7e7a65e
LOG: Attempting download of new URL file:///C:/Users/valo/Documents/Projects/Abc/Abc.dev/Main/US/BusinessLogic/BusinessLogicExecutable/bin/Debug/BusinessLogic.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Revision Number
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

--- End of inner exception stack trace ---
at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.GetExceptionPolicy(Exception exception, String policyName, ExceptionPolicyFactory factory)
at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.HandleException(Exception exceptionToHandle, String policyName, ExceptionPolicyFactory policyFactory)
at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.ExceptionPolicy.HandleException(Exception exceptionToHandle, String policyName)
at Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.WCF.ExceptionShieldingErrorHandler.ProvideFault(Exception error, MessageVersion version, Message& fault)
Category: General
Priority: -1
EventId: 1
Severity: Information
Title:
Machine: DOLORES
App Domain: BusinessLogicExecutable.vshost.exe
ProcessId: 5540
Process Name: C:\Users\valo\Documents\Projects\Abc\Abc.dev\Main\US\BusinessLogic\BusinessLogicExecutable\bin\Debug\BusinessLogicExecutable.vshost.exe
Thread Name:
Win32 ThreadId:7992
Extended Properties: HandlingInstance ID: - acda3991-9cc1-4674-a467-63cc86bbf574