开发者

Ninject 2 for CF3.5 TargetInvocationException

开发者 https://www.devze.com 2022-12-23 20:44 出处:网络
In middle of applic开发者_JAVA技巧ation when calling following line: var component = _Kernel.Get<IComponent>();

In middle of applic开发者_JAVA技巧ation when calling following line:

var component = _Kernel.Get<IComponent>();

I'm getting TargetInvocationException. IComponent is a Form.

at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.ConstructorInfo.Invoke(Object[] parameters) at Ninject.Injection.ReflectionInjectorFactory.<>c__DisplayClass1.b__0(Object[] args) at Ninject.Activation.Providers.StandardProvider.Create(IContext context) at Ninject.Activation.Context.Resolve()

at Ninject.KernelBase.b__7(IContext context) at System.Linq.Enumerable.d__d2.MoveNext() at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source) at Ninject.Planning.Targets.Target1.ResolveWithin(IContext parent) at Ninject.Activation.Providers.StandardProvider.GetValue(IContext context, ITarget target) at Ninject.Activation.Providers.StandardProvider.<>c__DisplayClass2.<Create>b__1(ITarget target) at System.Linq.Enumerable.<SelectIterator>d__d2.MoveNext() at System.Linq.Buffer1..ctor(IEnumerable1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source) at Ninject.Activation.Providers.StandardProvider.Create(IContext context) at Ninject.Activation.Context.Resolve()

at Ninject.KernelBase.<Resolve>b__7(IContext context) at System.Linq.Enumerable.<SelectIterator>d__d2.MoveNext() at System.Linq.Enumerable.d__b01.MoveNext() at System.Linq.Enumerable.Single[TSource](IEnumerable1 source) at Ninject.ResolutionExtensions.Get[T](IResolutionRoot root, IParameter[] parameters)


When asking for help, you need to give some context. There is a lot going on and if you don't give any context, it is nearly impossible to help. Give a reproduction scenario, or a small piece of the object being created. Was it an internal class, protected .ctor, etc. The more information you give the easier it is to help.

0

精彩评论

暂无评论...
验证码 换一张
取 消