Skip to content

Unity Resolve Issue after Upgrade of Unity.Abstractions from 2.3.1 to 4.1.2 #104

@rinotom

Description

@rinotom

After upgrading the Unity.Abstractions from 2.3.1 to 4.1.2, we are getting the below error on Resolve() using ParameterOverrides:

By this upgrade we had change the code below:

            T ret = default(T);

            ret = this.Container.Resolve<T>(new ParameterOverrides { { key, value } });

            return ret;

and make it as below:

            T ret = default(T);

            ret = this.Container.Resolve<T>(new ParameterOverride(key, value));

            return ret;

And it is throwing up an error as below during runtime:

Unity.ResolutionFailedException
  HResult=0x80131500
  Message=For more information add Diagnostic extension: Container.AddExtension(new Diagnostic())
  Source=Unity.Container
  StackTrace:
   at Unity.UnityContainer.<>c.<.ctor>b__58_1(BuilderContext& context)
   at Unity.UnityContainer.Unity.IUnityContainer.Resolve(Type type, String name, ResolverOverride[] overrides)
   at Unity.UnityContainerExtensions.Resolve[T](IUnityContainer container, ResolverOverride[] overrides)

Inner Exception 1:
InvalidOperationException: Failed to select a constructor for MyClassName

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions