Problems with registration and injection of an orchestrator with scene lifetimeScope implementing the IStartable interface. #748
Unanswered
srodriguezf
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Good afternoon,
I have a global LifetimeScope in this registry with the following line a global orchestrator.
builder.RegisterEntryPoint(Lifetime.Singleton).As().WithParameter("initializationServiceOrder", GlobalServicesInitializationList.SceneInitializationOrder);
This orchestrator I inject it and it works perfectly. Class definition:
public class GlobalOrchestrator : IStartable, IGlobalOrchestrator
Further on, I have a scene lifetimeScope and I register a scene orchestrator as follows:
builder.RegisterEntryPoint().As().WithParameter("initializationPluginOrder", PluginInitializationList.SceneInitializationOrder);
Both the global orchestrator and the scene orchestrator implement the IStartable interface.
When trying to inject it into a scene service of the same LifetimeScope the following error occurs:
InvalidOperationException: ValueFactory attempted to access the Value property of this instance. System.Lazy1[T].ViaFactory (System.Threading.LazyThreadSafetyMode mode) (at :0)
System.Lazy1[T].ExecutionAndPublication (System.LazyHelper executionAndPublication, System.Boolean useDefaultConstructor) (at :0) System.Lazy1[T].CreateValue () (at :0)
System.Lazy1[T].get_Value () (at :0) VContainer.ScopedContainer.CreateTrackedInstance (VContainer.Registration registration) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:178) VContainer.ScopedContainer.ResolveCore (VContainer.Registration registration) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:163) VContainer.ScopedContainer.Resolve (VContainer.Registration registration) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:115) VContainer.ScopedContainer.Resolve (System.Type type) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:91) VContainer.IObjectResolverExtensions.ResolveOrParameter (VContainer.IObjectResolver resolver, System.Type parameterType, System.String parameterName, System.Collections.Generic.IReadOnlyList1[T] parameters) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/IObjectResolverExtensions.cs:59)
VContainer.Internal.ReflectionInjector.InjectFields (System.Object obj, VContainer.IObjectResolver resolver, System.Collections.Generic.IReadOnlyList1[T] parameters) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Internal/ReflectionInjector.cs:66) VContainer.Internal.ReflectionInjector.Inject (System.Object instance, VContainer.IObjectResolver resolver, System.Collections.Generic.IReadOnlyList1[T] parameters) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Internal/ReflectionInjector.cs:26)
VContainer.Unity.PrefabComponentProvider.SpawnInstance (VContainer.IObjectResolver resolver) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Unity/InstanceProviders/PrefabComponentProvider.cs:46)
VContainer.Registration.SpawnInstance (VContainer.IObjectResolver resolver) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Registration.cs:33)
VContainer.ScopedContainer+<>c__DisplayClass17_0.<.ctor>b__1 () (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:82)
System.Lazy1[T].ViaFactory (System.Threading.LazyThreadSafetyMode mode) (at :0) System.Lazy1[T].ExecutionAndPublication (System.LazyHelper executionAndPublication, System.Boolean useDefaultConstructor) (at :0)
System.Lazy1[T].CreateValue () (at :0) System.Lazy1[T].get_Value () (at :0)
VContainer.ScopedContainer.CreateTrackedInstance (VContainer.Registration registration) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:178)
VContainer.ScopedContainer.ResolveCore (VContainer.Registration registration) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:163)
VContainer.ScopedContainer.Resolve (VContainer.Registration registration) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:115)
VContainer.Internal.CollectionInstanceProvider.SpawnInstance (VContainer.IObjectResolver currentScope, System.Collections.Generic.IReadOnlyList1[T] entirelyRegistrations) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Internal/InstanceProviders/CollectionInstanceProvider.cs:96) VContainer.Internal.CollectionInstanceProvider.SpawnInstance (VContainer.IObjectResolver resolver) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Internal/InstanceProviders/CollectionInstanceProvider.cs:75) VContainer.Registration.SpawnInstance (VContainer.IObjectResolver resolver) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Registration.cs:33) VContainer.ScopedContainer.ResolveCore (VContainer.Registration registration) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:169) VContainer.ScopedContainer.Resolve (VContainer.Registration registration) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:115) VContainer.ScopedContainer.Resolve (System.Type type) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:91) VContainer.IObjectResolverExtensions.ResolveOrParameter (VContainer.IObjectResolver resolver, System.Type parameterType, System.String parameterName, System.Collections.Generic.IReadOnlyList1[T] parameters) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/IObjectResolverExtensions.cs:59)
VContainer.Internal.ReflectionInjector.InjectMethods (System.Object obj, VContainer.IObjectResolver resolver, System.Collections.Generic.IReadOnlyList1[T] parameters) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Internal/ReflectionInjector.cs:97) VContainer.Internal.ReflectionInjector.Inject (System.Object instance, VContainer.IObjectResolver resolver, System.Collections.Generic.IReadOnlyList1[T] parameters) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Internal/ReflectionInjector.cs:28)
VContainer.Internal.ReflectionInjector.CreateInstance (VContainer.IObjectResolver resolver, System.Collections.Generic.IReadOnlyList1[T] parameters) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Internal/ReflectionInjector.cs:46) VContainer.Internal.InstanceProvider.SpawnInstance (VContainer.IObjectResolver resolver) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Internal/InstanceProviders/InstanceProvider.cs:21) VContainer.Registration.SpawnInstance (VContainer.IObjectResolver resolver) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Registration.cs:33) VContainer.ScopedContainer+<>c__DisplayClass17_0.<.ctor>b__1 () (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:82) System.Lazy1[T].ViaFactory (System.Threading.LazyThreadSafetyMode mode) (at :0)
System.Lazy1[T].ExecutionAndPublication (System.LazyHelper executionAndPublication, System.Boolean useDefaultConstructor) (at :0) System.Lazy1[T].CreateValue () (at :0)
System.Lazy1[T].get_Value () (at :0) VContainer.ScopedContainer.CreateTrackedInstance (VContainer.Registration registration) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:178) VContainer.ScopedContainer.ResolveCore (VContainer.Registration registration) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:163) VContainer.ScopedContainer.Resolve (VContainer.Registration registration) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:115) VContainer.Internal.CollectionInstanceProvider.SpawnInstance (VContainer.IObjectResolver currentScope, System.Collections.Generic.IReadOnlyList1[T] entirelyRegistrations) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Internal/InstanceProviders/CollectionInstanceProvider.cs:96)
VContainer.Internal.CollectionInstanceProvider.SpawnInstance (VContainer.IObjectResolver resolver) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Internal/InstanceProviders/CollectionInstanceProvider.cs:75)
VContainer.Registration.SpawnInstance (VContainer.IObjectResolver resolver) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Registration.cs:33)
VContainer.ScopedContainer.ResolveCore (VContainer.Registration registration) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:169)
VContainer.ScopedContainer.Resolve (VContainer.Registration registration) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:115)
VContainer.ScopedContainer.Resolve (System.Type type) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:91)
VContainer.IObjectResolverExtensions.ResolveOrParameter (VContainer.IObjectResolver resolver, System.Type parameterType, System.String parameterName, System.Collections.Generic.IReadOnlyList1[T] parameters) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/IObjectResolverExtensions.cs:59) VContainer.Internal.ReflectionInjector.InjectMethods (System.Object obj, VContainer.IObjectResolver resolver, System.Collections.Generic.IReadOnlyList1[T] parameters) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Internal/ReflectionInjector.cs:97)
VContainer.Internal.ReflectionInjector.Inject (System.Object instance, VContainer.IObjectResolver resolver, System.Collections.Generic.IReadOnlyList1[T] parameters) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Internal/ReflectionInjector.cs:28) VContainer.Internal.ReflectionInjector.CreateInstance (VContainer.IObjectResolver resolver, System.Collections.Generic.IReadOnlyList1[T] parameters) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Internal/ReflectionInjector.cs:46)
VContainer.Internal.InstanceProvider.SpawnInstance (VContainer.IObjectResolver resolver) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Internal/InstanceProviders/InstanceProvider.cs:21)
VContainer.Registration.SpawnInstance (VContainer.IObjectResolver resolver) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Registration.cs:33)
VContainer.ScopedContainer+<>c__DisplayClass17_0.<.ctor>b__1 () (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:82)
System.Lazy1[T].ViaFactory (System.Threading.LazyThreadSafetyMode mode) (at :0) System.Lazy1[T].ExecutionAndPublication (System.LazyHelper executionAndPublication, System.Boolean useDefaultConstructor) (at :0)
System.Lazy1[T].CreateValue () (at :0) System.Lazy1[T].get_Value () (at :0)
VContainer.ScopedContainer.CreateTrackedInstance (VContainer.Registration registration) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:178)
VContainer.ScopedContainer.ResolveCore (VContainer.Registration registration) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:163)
VContainer.ScopedContainer.Resolve (VContainer.Registration registration) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:115)
VContainer.Internal.CollectionInstanceProvider.SpawnInstance (VContainer.IObjectResolver currentScope, System.Collections.Generic.IReadOnlyList1[T] entirelyRegistrations) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Internal/InstanceProviders/CollectionInstanceProvider.cs:96) VContainer.Internal.ContainerLocalInstanceProvider.SpawnInstance (VContainer.IObjectResolver resolver) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Internal/InstanceProviders/ContainerLocalInstanceProvider.cs:26) VContainer.Registration.SpawnInstance (VContainer.IObjectResolver resolver) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Registration.cs:33) VContainer.ScopedContainer+<>c__DisplayClass17_0.<.ctor>b__1 () (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:82) System.Lazy1[T].ViaFactory (System.Threading.LazyThreadSafetyMode mode) (at :0)
System.Lazy1[T].ExecutionAndPublication (System.LazyHelper executionAndPublication, System.Boolean useDefaultConstructor) (at :0) System.Lazy1[T].CreateValue () (at :0)
System.Lazy1[T].get_Value () (at :0) VContainer.ScopedContainer.CreateTrackedInstance (VContainer.Registration registration) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:178) VContainer.ScopedContainer.ResolveCore (VContainer.Registration registration) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:166) VContainer.ScopedContainer.Resolve (VContainer.Registration registration) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:115) VContainer.ScopedContainer.Resolve (System.Type type) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:91) VContainer.IObjectResolverExtensions.Resolve[T] (VContainer.IObjectResolver resolver) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/IObjectResolverExtensions.cs:10) VContainer.Unity.EntryPointDispatcher.Dispatch () (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Unity/EntryPointDispatcher.cs:59) VContainer.Unity.EntryPointsBuilder+<>c.b__0_0 (VContainer.IObjectResolver container) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Unity/ContainerBuilderUnityExtensions.cs:19) VContainer.ContainerBuilder.EmitCallbacks (VContainer.IObjectResolver container) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/ContainerBuilder.cs:175) VContainer.ScopedContainerBuilder.BuildScope () (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/ContainerBuilder.cs:41) VContainer.ScopedContainer.CreateScope (System.Action1[T] installation) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:126)
VContainer.Container.CreateScope (System.Action1[T] installation) (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Container.cs:263) VContainer.Unity.LifetimeScope.Build () (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Unity/LifetimeScope.cs:200) VContainer.Unity.LifetimeScope.Awake () (at ./Library/PackageCache/jp.hadashikick.vcontainer@331f0bbb68/Runtime/Unity/LifetimeScope.cs:146)
Any idea why when I inject the orchestrator I get this error with respect to the registration?
Beta Was this translation helpful? Give feedback.
All reactions