-
-
Notifications
You must be signed in to change notification settings - Fork 9
Closed
Description
Description
I worked with last Unity full package version 5.8.13 with no any problems for a long time. But after updating to version 5.10. I get the <Unhandled Exception:
CommonServiceLocator.ActivationException: Activation error occurred while trying to get instance of type MyService, key "">.
As it was prescribed due starting with version 5.9.0 all Unity packages are available as individual NuGet packages, after updating I also installed the Unity.ServiceLocation package.
So, the code is compiling without any errors but now I get this exception after application runned.
To Reproduce
using CommonServiceLocator;
using Unity;
using Unity.Lifetime;
using Unity.ServiceLocation;
...
var container = new UnityContainer();
container.RegisterType<MyService>(new ContainerControlledLifetimeManager());
...
var locator = new UnityServiceLocator(container);
ServiceLocator.SetLocatorProvider(() => locator);
...
var _myService= ServiceLocator.Current.GetInstance<MyService>(); // An exception occurs here
Metadata
Metadata
Assignees
Labels
No labels