Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Example App #12

Closed
inboxnauman opened this issue May 19, 2018 · 8 comments
Closed

Error in Example App #12

inboxnauman opened this issue May 19, 2018 · 8 comments

Comments

@inboxnauman
Copy link

Can you please help me in resolving this?

ZenjectException: Unable to resolve type 'Karma.IRouter' while building object with type 'MenuPresenter'.
Object graph:
MenuPresenter

Zenject.DiContainer.Resolve (Zenject.InjectContext context) (at Assets/Lib/Karma/Zenject/Source/Main/DiContainer.cs:753)
Zenject.DiContainer.InjectExplicitInternal (System.Object injectable, System.Type injectableType, Zenject.InjectArgs args) (at Assets/Lib/Karma/Zenject/Source/Main/DiContainer.cs:1133)
Zenject.DiContainer.InjectExplicit (System.Object injectable, System.Type injectableType, Zenject.InjectArgs args) (at Assets/Lib/Karma/Zenject/Source/Main/DiContainer.cs:1046)
Zenject.DiContainer.InjectExplicit (System.Object injectable, System.Collections.Generic.List1 extraArgs) (at Assets/Lib/Karma/Zenject/Source/Main/DiContainer.cs:1008) Zenject.DiContainer.Inject (System.Object injectable, IEnumerable1 extraArgs) (at Assets/Lib/Karma/Zenject/Source/Main/DiContainer.cs:1794)
Zenject.DiContainer.Inject (System.Object injectable) (at Assets/Lib/Karma/Zenject/Source/Main/DiContainer.cs:1788)
Zenject.LazyInstanceInjector.LazyInjectAll () (at Assets/Lib/Karma/Zenject/Source/Main/LazyInstanceInjector.cs:65)
Zenject.DiContainer.FlushInjectQueue () (at Assets/Lib/Karma/Zenject/Source/Main/DiContainer.cs:314)
Zenject.SceneContext.Resolve () (at Assets/Lib/Karma/Zenject/Source/Install/Contexts/SceneContext.cs:269)
Zenject.SceneContext.RunInternal () (at Assets/Lib/Karma/Zenject/Source/Install/Contexts/SceneContext.cs:137)
Zenject.RunnableContext.Run () (at Assets/Lib/Karma/Zenject/Source/Install/Contexts/RunnableContext.cs:36)
Zenject.RunnableContext.Initialize () (at Assets/Lib/Karma/Zenject/Source/Install/Contexts/RunnableContext.cs:22)
Zenject.SceneContext.Awake () (at Assets/Lib/Karma/Zenject/Source/Install/Contexts/SceneContext.cs:113)
UnityEngine.GameObject:AddComponent()
Karma.App:CreateZenjectContext() (at Assets/Lib/Karma/Karma/App.cs:89)
Karma.App:Awake() (at Assets/Lib/Karma/Karma/App.cs:56)

@SacredSkull
Copy link
Collaborator

SacredSkull commented May 19, 2018

Yes I saw that but the problem disappeared after some re-runs. I think it's some kind of race-condition; I'll have another look for it. AFAIK that error doesn't even stop the app from working - if you perform (or inspect in a debugger) router.something() it isn't null.

Can you confirm that the rest of the app works/doesn't work?

@inboxnauman
Copy link
Author

The app is unstable :(

@SacredSkull
Copy link
Collaborator

Really strange - I only saw this once and then never again on 2 computers. Looking into it atm!

SacredSkull added a commit to SacredSkull/karma that referenced this issue May 19, 2018
@SacredSkull
Copy link
Collaborator

SacredSkull commented May 19, 2018

Can you try my fork? It should fix this race condition. All you really need to update is the Assets/Lib/Karma/Karma/App.cs file from my repo.

@inboxnauman
Copy link
Author

Worked for me after commenting //context.hideFlags = HideFlags.HideInHierarchy | HideFlags.DontSave | HideFlags.NotEditable;

@SacredSkull
Copy link
Collaborator

SacredSkull commented May 19, 2018

HideInHierarchy and NotEditable don't actually do anything as far as Zenject or Karma is concerned - it just hides it from the Unity Editor/Inspector so I doubt that fixed it. The only one it might be is the DontSave flag which I'll have a look at.

@SacredSkull
Copy link
Collaborator

Try changing it to context.hideFlags = HideFlags.HideInHierarchy | HideFlags.NotEditable; instead of commenting it and see if it works but I'm still fairly sure there's a race condition here

@inboxnauman
Copy link
Author

You are right. It Works! Thanks buddy and Keep it up for the best MVC framework in community.

SacredSkull added a commit that referenced this issue Apr 28, 2019
* Bug fix for #12
* Bring the Karma project kicking and screaming into 2019 - probably the easiest update yet, surprisingly
Note: this project now uses the .NET 4.x equivalent scripting runtime, and .NET 2.0 Standard for compatibility level, which may or may not be relevant to you.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants