Create scene "First" and add it to build settings as first
Create scene "Second" and add it to build settings as second
Create LifetimeScope for first, second scene and Root Scope
Setup scopes on the scenes and assign RootScope to VContainerSettings
Add SceneManager.LoadScene(gameobject.scene.buildIndex + 1) to Start() method of "First" scope
Assign RootScope as a Parent scope to "First" and "Second" scopes
Launch scene "First"
What you see:
Scene "First" launches without errors
After the launch of scene "First" scene "Second" being instantly loaded
You receive nullReferenceException from the "Second" scope of the loaded scene
Error:
NullReferenceException: Object reference not set to an instance of an object
VContainer.IObjectResolverExtensions.Resolve[T] (VContainer.IObjectResolver resolver) (at Library/PackageCache/jp.hadashikick.vcontainer@af7bd4ecab/Runtime/IObjectResolverExtensions.cs:10)
Game.Source.LevelScope.Start () (at Assets/Scripts/LevelScope.cs:23)
UPD:
This issue comes when we want to use RootScope for our scopes but at the same time selecting "Parent Scope" as "RootScope" when it should be just "None". Simply need to replace "None" with the "RootScope" VContainer-sdie to avoid misunderstandings.
Now to fix the issue user need just to select "None" as the "ParentScope" in order to use "RootScope" as a "ParentScope".
Simple reproducible project: https://drive.google.com/file/d/1UChz1CGHh5nDtnP7QhuOKodUUqAd9s_f/view?usp=sharing
Steps to reproduce:
What you see:
Error:
UPD: This issue comes when we want to use RootScope for our scopes but at the same time selecting "Parent Scope" as "RootScope" when it should be just "None". Simply need to replace "None" with the "RootScope" VContainer-sdie to avoid misunderstandings.
Now to fix the issue user need just to select "None" as the "ParentScope" in order to use "RootScope" as a "ParentScope".