Build/Test Issues

Ninject Extension Issue

Started by Silvenga on 3,684 views

I'm running into an odd issue when writing some integration tests targeting an in-memory Owin web server with Ninject. The error is as follows:


System.InvalidOperationException: This module requires Ninject.Web.WebAPI extension


I call it odd because R#'s test runner runs the test just fine.

It appears the issue might stem from Ninject's assembly scan for extensions (e.g. the one above) per a R# issue discussed here (https://devnet.jetbrains.com/thread/475198). The workaround in the second post does allow NCrunch to finish the tests correctly. This issue was resolved in R# 10.0.1.

I am currently running NCrunch v2.20.0.2 as I'm using VS15 with .Net 4.6.1 under Windows 10 (from http://forum.ncrunch.net/yaf_postst1727_-NET-framework-4-6-1.aspx).
Hi, thanks for sharing this issue.

My first guess here is that the tests have a dependency on the Ninject assemblies being co-located with the test assembly. Does turning on the 'Copy referenced assemblies to workspace' NCrunch configuration setting for all the projects involved make any difference here?

More information about this - http://www.ncrunch.net/documentation/considerations-and-constraints_assembly-colocation-assumptions.
Setting the "Copy referenced assemblies to workspace" on the test and the project using Ninject does not appear to make a difference.
Has this extension been installed via Nuget? If so, it's possible that it has an implicit dependency on files from the Nuget package.

Try adding the .nuget directory to your solution-level 'Additional files to include' NCrunch configuration setting. Also, make sure that the 'Copy referenced assemblies to workspace' setting is turned on for ALL the projects in your solution.

If you are using a configuration file of some kind that is required for Ninject, also try including this in the 'Additional files to include' for the project using this file.

Post a reply

Log in to reply.