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

Null reference exception with mono/ninject #121

Closed
bonesoul opened this issue May 22, 2014 · 4 comments
Closed

Null reference exception with mono/ninject #121

bonesoul opened this issue May 22, 2014 · 4 comments

Comments

@bonesoul
Copy link
Owner

seems we have to use ninject for mono - download page lists the build-server;

but the thing how we'll get this automated?

as we are building a server application we mainly target mono + linux - and without getting this automated, ninject will just harm.

more interestingly;

ninject/Ninject#126

they're dropping support for mono - which is quite something I'm not happy with.

Ninject 4.0 will drop support for .NET < 4.0 (and therefore Mono < 4.0)
support so that we can use concurrent collections. For .NET 3.5 application
we will keep bugfixing Ninject 3.x but not add any new features.

and again i'm quite not happy with cryptic errors & exceptions of ninject which made me consider getting it out of the project and instead implement our own dependency injection pattern -- yes we can't have the nifty feature of ninject -- but if we follow our current pattern with a few resolvers we can handle the job i guess..

I vote for the DI pattern for sure but usability should be our main priotry. Wanted to hear you guys opinions.

@bonesoul
Copy link
Owner Author

@bonesoul
Copy link
Owner Author

https://simpleinjector.codeplex.com/
https://github.com/grumpydev/TinyIoC/

but seem to support mono. tinyioc seem to support named instances.

let's the carry the discussion over here instead of irc, as it's hard to follow.

@bonesoul
Copy link
Owner Author

and here is the cryptic message from ninject/mono - i guess none of us want to deal with users reporting cryptic exception caused by ninject -- and again we mainly target mono. So our build process for mono should be flawless.

we have to move to tinyioc or the other i guess.

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
  at Ninject.Infrastructure.Language.ExtensionsForMemberInfo.get_ParentDefinitionMethodInfo () [0x00000] in <filename unknown>:0 
  at Ninject.Infrastructure.Language.ExtensionsForMemberInfo.GetParentDefinition (System.Reflection.MethodInfo method, BindingFlags flags) [0x00000] in <filename unknown>:0 
  at Ninject.Infrastructure.Language.ExtensionsForMemberInfo.GetParentDefinition (System.Reflection.PropertyInfo property) [0x00000] in <filename unknown>:0 
  at Ninject.Infrastructure.Language.ExtensionsForMemberInfo.IsDefined (System.Reflection.PropertyInfo element, System.Type attributeType, Boolean inherit) [0x00000] in <filename unknown>:0 
  at Ninject.Infrastructure.Language.ExtensionsForMemberInfo.HasAttribute (System.Reflection.MemberInfo member, System.Type type) [0x00000] in <filename unknown>:0 
  at Ninject.Selection.Heuristics.StandardInjectionHeuristic.ShouldInject (System.Reflection.MemberInfo member) [0x00000] in <filename unknown>:0 
  at Ninject.Selection.Selector+<>c__DisplayClass3.<SelectPropertiesForInjection>b__2 (IInjectionHeuristic h) [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable.Any[IInjectionHeuristic] (IEnumerable`1 source, System.Func`2 predicate) [0x00000] in <filename unknown>:0 
  at Ninject.Selection.Selector.<SelectPropertiesForInjection>b__1 (System.Reflection.PropertyInfo p) [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1E`1[System.Reflection.PropertyInfo].MoveNext () [0x00000] in <filename unknown>:0 
  at System.Collections.Generic.List`1[System.Reflection.PropertyInfo].AddEnumerable (IEnumerable`1 enumerable) [0x00000] in <filename unknown>:0 
  at System.Collections.Generic.List`1[System.Reflection.PropertyInfo].AddRange (IEnumerable`1 collection) [0x00000] in <filename unknown>:0 
  at Ninject.Selection.Selector.SelectPropertiesForInjection (System.Type type) [0x00000] in <filename unknown>:0 
  at Ninject.Planning.Strategies.PropertyReflectionStrategy.Execute (IPlan plan) [0x00000] in <filename unknown>:0 
  at Ninject.Planning.Planner+<>c__DisplayClass1.<CreateNewPlan>b__0 (IPlanningStrategy s) [0x00000] in <filename unknown>:0 
  at Ninject.Infrastructure.Language.ExtensionsForIEnumerableOfT.Map[IPlanningStrategy] (IEnumerable`1 series, System.Action`1 action) [0x00000] in <filename unknown>:0 
  at Ninject.Planning.Planner.CreateNewPlan (System.Type type) [0x00000] in <filename unknown>:0 
  at Ninject.Planning.Planner.GetPlan (System.Type type) [0x00000] in <filename unknown>:0 
  at Ninject.Activation.Providers.StandardProvider.Create (IContext context) [0x00000] in <filename unknown>:0 
  at Ninject.Activation.Context.ResolveInternal (System.Object scope) [0x00000] in <filename unknown>:0 
  at Ninject.Activation.Context.Resolve () [0x00000] in <filename unknown>:0 
  at Ninject.KernelBase+<>c__DisplayClass15.<Resolve>b__f (IBinding binding) [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable+<CreateSelectIterator>c__Iterator10`2[Ninject.Planning.Bindings.IBinding,System.Object].MoveNext () [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable+<CreateCastIterator>c__Iterator0`1[Coinium.IApplicationContext].MoveNext () [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable.Single[IApplicationContext] (IEnumerable`1 source, System.Func`2 predicate, Fallback fallback) [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable.Single[IApplicationContext] (IEnumerable`1 source) [0x00000] in <filename unknown>:0 
  at Ninject.ResolutionExtensions.Get[IApplicationContext] (IResolutionRoot root, Ninject.Parameters.IParameter[] parameters) [0x00000] in <filename unknown>:0 
  at Coinium.Core.Config.Bootstrapper.Run () [0x00000] in <filename unknown>:0 
  at Coinium.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
  at Ninject.Infrastructure.Language.ExtensionsForMemberInfo.get_ParentDefinitionMethodInfo () [0x00000] in <filename unknown>:0 
  at Ninject.Infrastructure.Language.ExtensionsForMemberInfo.GetParentDefinition (System.Reflection.MethodInfo method, BindingFlags flags) [0x00000] in <filename unknown>:0 
  at Ninject.Infrastructure.Language.ExtensionsForMemberInfo.GetParentDefinition (System.Reflection.PropertyInfo property) [0x00000] in <filename unknown>:0 
  at Ninject.Infrastructure.Language.ExtensionsForMemberInfo.IsDefined (System.Reflection.PropertyInfo element, System.Type attributeType, Boolean inherit) [0x00000] in <filename unknown>:0 
  at Ninject.Infrastructure.Language.ExtensionsForMemberInfo.HasAttribute (System.Reflection.MemberInfo member, System.Type type) [0x00000] in <filename unknown>:0 
  at Ninject.Selection.Heuristics.StandardInjectionHeuristic.ShouldInject (System.Reflection.MemberInfo member) [0x00000] in <filename unknown>:0 
  at Ninject.Selection.Selector+<>c__DisplayClass3.<SelectPropertiesForInjection>b__2 (IInjectionHeuristic h) [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable.Any[IInjectionHeuristic] (IEnumerable`1 source, System.Func`2 predicate) [0x00000] in <filename unknown>:0 
  at Ninject.Selection.Selector.<SelectPropertiesForInjection>b__1 (System.Reflection.PropertyInfo p) [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1E`1[System.Reflection.PropertyInfo].MoveNext () [0x00000] in <filename unknown>:0 
  at System.Collections.Generic.List`1[System.Reflection.PropertyInfo].AddEnumerable (IEnumerable`1 enumerable) [0x00000] in <filename unknown>:0 
  at System.Collections.Generic.List`1[System.Reflection.PropertyInfo].AddRange (IEnumerable`1 collection) [0x00000] in <filename unknown>:0 
  at Ninject.Selection.Selector.SelectPropertiesForInjection (System.Type type) [0x00000] in <filename unknown>:0 
  at Ninject.Planning.Strategies.PropertyReflectionStrategy.Execute (IPlan plan) [0x00000] in <filename unknown>:0 
  at Ninject.Planning.Planner+<>c__DisplayClass1.<CreateNewPlan>b__0 (IPlanningStrategy s) [0x00000] in <filename unknown>:0 
  at Ninject.Infrastructure.Language.ExtensionsForIEnumerableOfT.Map[IPlanningStrategy] (IEnumerable`1 series, System.Action`1 action) [0x00000] in <filename unknown>:0 
  at Ninject.Planning.Planner.CreateNewPlan (System.Type type) [0x00000] in <filename unknown>:0 
  at Ninject.Planning.Planner.GetPlan (System.Type type) [0x00000] in <filename unknown>:0 
  at Ninject.Activation.Providers.StandardProvider.Create (IContext context) [0x00000] in <filename unknown>:0 
  at Ninject.Activation.Context.ResolveInternal (System.Object scope) [0x00000] in <filename unknown>:0 
  at Ninject.Activation.Context.Resolve () [0x00000] in <filename unknown>:0 
  at Ninject.KernelBase+<>c__DisplayClass15.<Resolve>b__f (IBinding binding) [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable+<CreateSelectIterator>c__Iterator10`2[Ninject.Planning.Bindings.IBinding,System.Object].MoveNext () [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable+<CreateCastIterator>c__Iterator0`1[Coinium.IApplicationContext].MoveNext () [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable.Single[IApplicationContext] (IEnumerable`1 source, System.Func`2 predicate, Fallback fallback) [0x00000] in <filename unknown>:0 
  at System.Linq.Enumerable.Single[IApplicationContext] (IEnumerable`1 source) [0x00000] in <filename unknown>:0 
  at Ninject.ResolutionExtensions.Get[IApplicationContext] (IResolutionRoot root, Ninject.Parameters.IParameter[] parameters) [0x00000] in <filename unknown>:0 
  at Coinium.Core.Config.Bootstrapper.Run () [0x00000] in <filename unknown>:0 
  at Coinium.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 

@bonesoul
Copy link
Owner Author

Fixed with: #128

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant