Closed sfmskywalker closed 12 years ago
Most likely you haven't installed or loaded the module of a mock provider e.g. Ninject.MockingKernel.Moq
2012/1/5 Sipke Schoorstra < reply@reply.github.com
When I call kernel.Get, it throws the following exception: System.InvalidOperationException: Error loading Ninject component IMockProviderCallbackProvider:
System.InvalidOperationException: Error loading Ninject component IMockProviderCallbackProvider No such component has been registered in the kernel's component container. Suggestions: 1) If you have created a custom subclass for KernelBase, ensure that you have properly implemented the AddComponents() method. 2) Ensure that you have not removed the component from the container via a call to RemoveAll(). 3) Ensure you have not accidentally created more than one kernel. at Ninject.Components.ComponentContainer.Get(Type component) in c:\Projects\Ninject\Maintenance2.2\ninject\src\Ninject\Components\ComponentContainer.cs: line 131 at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() at System.Linq.Buffer`1..ctor(IEnumerable`1 source) at System.Linq.Enumerable.ToArray(IEnumerable`1 source) at Ninject.Components.ComponentContainer.CreateNewInstance(Type component, Type implementation) in c:\Projects\Ninject\Maintenance2.2\ninject\src\Ninject\Components\ComponentContainer.cs: line 173 at Ninject.Components.ComponentContainer.ResolveInstance(Type component, Type implementation) in c:\Projects\Ninject\Maintenance2.2\ninject\src\Ninject\Components\ComponentContainer.cs: line 167 at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext() at System.Linq.Enumerable.<CastIterator>d__b1`1.MoveNext() at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source, Func`2 predicate) at Ninject.KernelBase.HandleMissingBinding(IRequest request) in c:\Projects\Ninject\Maintenance2.2\ninject\src\Ninject\KernelBase.cs: line 493 at Ninject.KernelBase.Resolve(IRequest request) in c:\Projects\Ninject\Maintenance2.2\ninject\src\Ninject\KernelBase.cs: line 338 at Ninject.Planning.Targets.Target`1.GetValue(Type service, IContext parent) in c:\Projects\Ninject\Maintenance2.2\ninject\src\Ninject\Planning\Targets\Target.cs: line 179 at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() at System.Linq.Buffer`1..ctor(IEnumerable`1 source) at System.Linq.Enumerable.ToArray(IEnumerable`1 source) at Ninject.Activation.Providers.StandardProvider.Create(IContext context) in c:\Projects\Ninject\Maintenance2.2\ninject\src\Ninject\Activation\Providers\StandardProvider.cs: line 81 at Ninject.Activation.Context.Resolve() in c:\Projects\Ninject\Maintenance2.2\ninject\src\Ninject\Activation\Context.cs: line 157 at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext() at System.Linq.Enumerable.<CastIterator>d__b1`1.MoveNext() at System.Linq.Enumerable.Single(IEnumerable`1 source) at Qbies.Tests.UnitTests.Domain.Achievements.given_a_first_order_achievement..ctor() in FirstOrder.cs: line 41 at Qbies.Tests.UnitTests.Domain.Achievements.and_applying_it..ctor() in FirstOrder.cs: line 51
I guess it has something to do with the fact that I am using a later version of Ninject than the one that the MockingKernel is build against.
I tried building your source against the latest Ninject version, but then I get a compilation error:
Error 1 'Ninject.Syntax.IBindingToSyntax<T>' does not contain a definition for 'BindingConfiguration' and no extension method 'BindingConfiguration' accepting a first argument of type 'Ninject.Syntax.IBindingToSyntax<T>' could be found (are you missing a using directive or an assembly reference?) C:\Users\Sipke\Downloads\ninject-ninject.mockingkernel-3.0.0-rc2-0-g097c8ec\ninject-ninject.mockingkernel-097c8ec\src\Ninject.MockingKernel\ExtensionsForBindingSyntax.cs 39 48 Ninject.MockingKernel
Reply to this email directly or view it on GitHub: https://github.com/ninject/ninject.mockingkernel/issues/10
Please close this issue in case my comment helped and fixed your problem
When I call kernel.Get, it throws the following exception: System.InvalidOperationException: Error loading Ninject component IMockProviderCallbackProvider:
I guess it has something to do with the fact that I am using a later version of Ninject than the one that the MockingKernel is build against.
I tried building your source against the latest Ninject version, but then I get a compilation error: