Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com
Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com

I’ve upgraded Enterprise Library form 4. to 5  and replaced references to the DLLs (in particular we are using EnterpriseLibrary.Logging”)  Compiler  doesn’t report any errors about missing dependencies however at run time I’ve got
Could not load file or assembly 'Microsoft.Practices.ServiceLocation’

I had to add the library explicitly.  
It will be good if the error will be shown during the build.

Related links
http://stackoverflow.com/questions/3992072/where-does-microsoft-practices-servicelocation-come-from

http://entlib.codeplex.com/discussions/221485 “Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Validation' 
 

 

Another application reporte the same error at run-time differentlly:

Microsoft.Practices.ServiceLocation.ActivationException: Activation error occured while trying to get instance of type LogWriter, key "" ---> Microsoft.Practices.Unity.ResolutionFailedException: Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter", name = "(none)".

Exception occurred while: while resolving.

Exception is: InvalidOperationException - The type LogWriter cannot be constructed. You must configure the container to supply this value.

-----------------------------------------------

At the time of the exception, the container was:



 Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter,(none)

---> System.InvalidOperationException: The type LogWriter cannot be constructed. You must configure the container to supply this value.

  at Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.GuardTypeIsNonPrimitive(IBuilderContext context, SelectedConstructor selectedConstructor)

  at Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.PreBuildUp(IBuilderContext context)

  at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)

  at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlanCreatorPolicy.CreatePlan(IBuilderContext context, NamedTypeBuildKey buildKey)

  at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context)

  at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)

  at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides)

  --- End of inner exception stack trace ---

  at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides)

  at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, String name, IEnumerable`1 resolverOverrides)

  at Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name, ResolverOverride[] resolverOverrides)

  at Microsoft.Practices.Unity.UnityServiceLocator.DoGetInstance(Type serviceType, String key)

  at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)

  --- End of inner exception stack trace ---

  at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)

  at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance[TService]()

  at Microsoft.Practices.EnterpriseLibrary.Logging.Logger.get_Writer()

  at Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(LogEntry log)

Posted on Saturday, September 10, 2011 8:30 AM Testing/Debugging/Logging | Back to top


Comments on this post: Compiler doesn’t report missing 'Microsoft.Practices.ServiceLocation”

# re: Compiler doesn’t report missing 'Microsoft.Practices.ServiceLocation”
Requesting Gravatar...
Hi there! Having the same problem as you. Funny thing is, I have already explicitly referenced Microsoft.EnterpriseLibrary.ServiceLocation and I'm still getting the exception. I'm stumped.
Left by Pengu on Sep 11, 2013 1:14 AM

Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net