Dependency injection

Unity exception: Activation error occured while trying to get instance of type

You can get this exception from Unity: Activation error occured while trying to get instance of type in many cases. And then you can try to look into InnerException stack to find only The type MyType cannot be constructed. You must configure the container to supply this value.. Below are the reasons that can lead to this error message:

  1. The class you try instantiate (or dependent class) is abstract.
  2. The class you try instantiate (or dependent class) has no public constructor.
Rating: 
Subscribe to RSS - Dependency injection