1
Vote

NullReferenceException on Bind<T>

description

When doing a my first Bind<T> call in my application, I get the following stacktrace:
 
[NullReferenceException: Object reference not set to an instance of an object.]
Ninject.Core.Infrastructure.DebugInfo.ShouldIgnoreType(Type type) in d:\Projects\Ninject\src\Core\Infrastructure\Debugging\DebugInfo.cs:156
Ninject.Core.Infrastructure.DebugInfo.FromStackTrace() in d:\Projects\Ninject\src\Core\Infrastructure\Debugging\DebugInfo.cs:128
Ninject.Core.ModuleBase1.DoBind(Type type) in d:\Projects\Ninject\src\Core\Modules\ModuleBase.cs:269
Ninject.Core.ModuleBase
1.Bind() in d:\Projects\Ninject\src\Core\Modules\ModuleBase.cs:116
SettingsModule.Load() in x:\workspace\tour-manager\web\App_Code\NtmApp.cs:62
Ninject.Core.KernelBase.LoadModules(IEnumerable`1 modules) in d:\Projects\Ninject\src\Core\KernelBase.cs:358
Ninject.Core.KernelBase.Load(IModule[] modules) in d:\Projects\Ninject\src\Core\KernelBase.cs:173
NtmApp..cctor() in x:\workspace\tour-manager\web\App_Code\NtmApp.cs:36
 
I'm a novice at Ninject, so I might be missing something basic, but this seems like an internal error?

comments

liedman wrote Feb 15, 2010 at 3:43 PM

Problems appears to be that my classes NtmApp and SettingsModule are not inside any namespace. Moving them inside a namespace fixes the issue.

wrote Feb 21, 2013 at 11:19 PM