Reputation: 17762
I have run into ...I don't think I would call it a problem as much as I would a quirk. It confuses and confounds me.
I am adding Ninject
to my site. It works fine. No questions about troubleshooting Ninject specifically, but I encountered this when setting up my modules...
Here is my SessionModule.cs
file.
namespace Lightcast.Web.Mvc.Injection.Modules {
public class SessionModule : Ninject.Modules.NinjectModule {
public override void Load() {
}
}
}
Also shown in this screenshot.
I get the error
Unknown type 'Modules' of Lightcast.Web.Mvc.Injection.Ninject
Now if I change it to this ...
It works just fine. So obviously there is a namespace collision. What I do not understand is why? I have never encountered this before. It just seems like the absolute oddest thing to me.
Upvotes: 3
Views: 68
Reputation: 437584
There is a class or namespace named Ninject
somewhere inside namespace Lightcast.Web.Mvc.Injection.Modules
or one of its parent namespaces.
The error occurs because the C# compiler looks up types and namespaces by trying to find them inside the current namespace and working its way towards the global namespace if it cannot.
Upvotes: 4
Reputation: 14784
The reason seems to be that somewhere in your project a namespace or type named Lightcast.Web.Mvc.Injection.Ninject
exists that hides the global NInject
namespace.
Upvotes: 5