Resolution Failure

Mar 12, 2015 at 4:08 PM
Edited Mar 12, 2015 at 4:09 PM
We have our application setup to use a configuration file to load the Unity mappings. We then have logic that creates a Singleton which loads the Unity Container (using proper locking around when creating the container) and then resolves the item we are looking for. For some reason the call to this seems to intermittently fail, but then subsequent calls work fine. I have even tested removing the singleton and creating the Unity Container each time and the issue still seems to happen.

The Stack Trace at this exception is:
At the time of the exception, the container was: Resolving <interface>,(none) ---> System.InvalidOperationException: The type <interface> does not have an accessible constructor. at Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.ThrowForNullExistingObject(IBuilderContext context) at lambda_method(Closure , IBuilderContext ) at Microsoft.Practices.ObjectBuilder2.DynamicBuildPlanGenerationContext.<>c__DisplayClass1.b__0(IBuilderContext context) at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(IBuilderContext context) 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.Resolve(Type t, String name, ResolverOverride[] resolverOverrides) at Microsoft.Practices.Unity.UnityContainerExtensions.Resolve[T](IUnityContainer container, ResolverOverride[] overrides)

Most of my searches on this error have to do with either the incorrect config file or a mapping is missing. I have verified repeatedly that both are correct in that the call will work, then fail, then work again, often times without even re-loading the config file. Does anyone have any information as to what might be at issue here, or is there a better practice with regards to loading the configuration file?