我對Ninject完全陌生,並且看到一個異常並且不知道該怎麼做。是否有人可以幫助: -Ninject空引用異常
Object reference not set to an instance of an object.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
[NullReferenceException: Object reference not set to an instance of an object.]
System.Object.GetType() +0
Ninject.Core.Creation.Providers.InjectionProviderBase.GetValueFromInlineArgument(IContext context, ITarget target) in \Ninject\src\Core\Creation\Providers\InjectionProviderBase.cs:139
Ninject.Core.Creation.Providers.InjectionProviderBase.ResolveConstructorArguments(IContext context, ConstructorInjectionDirective directive) in \Ninject\src\Core\Creation\Providers\InjectionProviderBase.cs:109
Ninject.Core.Creation.Providers.InjectionProviderBase.CallInjectionConstructor(IContext context) in \Ninject\src\Core\Creation\Providers\InjectionProviderBase.cs:79
Ninject.Core.Creation.Providers.InjectionProviderBase.Create(IContext context) in \Ninject\src\Core\Creation\Providers\InjectionProviderBase.cs:60
Ninject.Core.Activation.ActivatorBase.Create(IContext context, Object& instance) in \Ninject\src\Core\Activation\ActivatorBase.cs:114
Ninject.Core.Behavior.BehaviorBase.CreateInstance(IContext context, Object& instance) in \Ninject\src\Core\Behavior\BehaviorBase.cs:102
Ninject.Core.Behavior.TransientBehavior.Resolve(IContext context) in \Ninject\src\Core\Behavior\TransientBehavior.cs:55
Ninject.Core.KernelBase.ResolveInstance(Type service, IContext context, Boolean isEagerActivation) in \Ninject\src\Core\KernelBase.cs:566
Ninject.Core.KernelBase.Get(Type type, IContext context) in \Ninject\src\Core\KernelBase.cs:278
Ninject.Core.Resolution.Resolvers.StandardResolver.ResolveInstance(IContext outerContext, IContext innerContext) in \Ninject\src\Core\Resolution\Resolvers\StandardResolver.cs:54
Ninject.Core.Resolution.Resolvers.ResolverBase.Resolve(IContext outerContext, IContext innerContext) in \Ninject\src\Core\Resolution\Resolvers\ResolverBase.cs:80
Ninject.Core.Creation.Providers.InjectionProviderBase.ResolveConstructorArguments(IContext context, ConstructorInjectionDirective directive) in \Ninject\src\Core\Creation\Providers\InjectionProviderBase.cs:119
Ninject.Core.Creation.Providers.InjectionProviderBase.CallInjectionConstructor(IContext context) in \Ninject\src\Core\Creation\Providers\InjectionProviderBase.cs:79
Ninject.Core.Creation.Providers.InjectionProviderBase.Create(IContext context) in \Ninject\src\Core\Creation\Providers\InjectionProviderBase.cs:60
Ninject.Core.Activation.ActivatorBase.Create(IContext context, Object& instance) in \Ninject\src\Core\Activation\ActivatorBase.cs:114
Ninject.Core.Behavior.BehaviorBase.CreateInstance(IContext context, Object& instance) in \Ninject\src\Core\Behavior\BehaviorBase.cs:102
Ninject.Core.Behavior.TransientBehavior.Resolve(IContext context) in \Ninject\src\Core\Behavior\TransientBehavior.cs:55
Ninject.Core.KernelBase.ResolveInstance(Type service, IContext context, Boolean isEagerActivation) in \Ninject\src\Core\KernelBase.cs:566
Ninject.Core.KernelBase.Get(Type type, IContext context) in \Ninject\src\Core\KernelBase.cs:278
Ninject.Core.Resolution.Resolvers.StandardResolver.ResolveInstance(IContext outerContext, IContext innerContext) in \Ninject\src\Core\Resolution\Resolvers\StandardResolver.cs:54
Ninject.Core.Resolution.Resolvers.ResolverBase.Resolve(IContext outerContext, IContext innerContext) in \Ninject\src\Core\Resolution\Resolvers\ResolverBase.cs:80
Ninject.Core.Activation.Strategies.FieldInjectionStrategy.Initialize(IContext context, Object& instance) in \Ninject\src\Core\Activation\Strategies\FieldInjectionStrategy.cs:59
Ninject.Core.Activation.ActivatorBase.Create(IContext context, Object& instance) in \Ninject\src\Core\Activation\ActivatorBase.cs:130
Ninject.Core.KernelBase.InjectExistingObject(Object instance) in \Ninject\src\Core\KernelBase.cs:599
Ninject.Core.KernelBase.Inject(Object instance) in \Ninject\src\Core\KernelBase.cs:288
Ninject.Framework.Web.KernelContainer.Inject(Object instance) in \Ninject\src\Framework\Web\KernelContainer.cs:69
Ninject.Framework.Web.UserControlBase.RequestActivation() in \Ninject\src\Framework\Web\UserControlBase.cs:41
Ninject.Framework.Web.UserControlBase.OnInit(EventArgs e) in \Ninject\src\Framework\Web\UserControlBase.cs:33
System.Web.UI.Control.InitRecursive(Control namingContainer) +143
System.Web.UI.Control.InitRecursive(Control namingContainer) +391
System.Web.UI.Control.InitRecursive(Control namingContainer) +391
System.Web.UI.Control.InitRecursive(Control namingContainer) +391
System.Web.UI.Control.InitRecursive(Control namingContainer) +391
System.Web.UI.Control.InitRecursive(Control namingContainer) +391
System.Web.UI.Control.InitRecursive(Control namingContainer) +391
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1477
我認爲整個堆棧跟蹤不夠。你應該提供代碼,你如何使用ninject。 – adt 2011-12-31 11:32:00
請添加更多背景!你的NInject內核是如何配置的?獲取異常時執行的代碼是什麼? – nemesv 2011-12-31 11:32:30
從框架代碼中拋出的'NullReferenceException'通常表明該框架中存在一個錯誤,因爲框架不應該拋出'NullReferenceException'(因爲NRE對於告訴問題是沒有什麼幫助的)。 – Steven 2011-12-31 12:06:20