Build/Test Issues

Trouble running tests that use RavenDB 3.x embedded in memory with NCrunch 2.12.0.2

Started by tcabanski on 4,389 views

Project builds both in VS 2013 and from the command line. Tests pass from the command line. However, NCrunch fails the 3 tests currently using RavenDB embedded in memory with the following error:

SetUp : System.IO.FileLoadException : A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
at Raven.Database.Util.MetricsCountersManager..ctor()
at Raven.Database.Indexing.WorkContext..ctor() in c:\Builds\RavenDB-3.0-Unstable\Raven.Database\Indexing\WorkContext.cs:line 48
at Raven.Database.DocumentDatabase..ctor(InMemoryRavenConfiguration configuration, TransportState recievedTransportState) in c:\Builds\RavenDB-3.0-Unstable\Raven.Database\DocumentDatabase.cs:line 120
at Raven.Database.Server.RavenDBOptions..ctor(InMemoryRavenConfiguration configuration, DocumentDatabase db) in c:\Builds\RavenDB-3.0-Unstable\Raven.Database\Server\RavenDBOptions.cs:line 54
at Raven.Database.Server.OwinHttpServer..ctor(InMemoryRavenConfiguration config, DocumentDatabase db, Boolean useHttpServer, Action`1 configure) in c:\Builds\RavenDB-3.0-Unstable\Raven.Database\Server\OwinHttpServer.cs:line 24
at Raven.Server.RavenDbServer.Initialize(Action`1 configure) in c:\Builds\RavenDB-3.0-Unstable\Raven.Database\Server\RavenDbServer.cs:line 106
at Raven.Database.Client.EmbeddedDocumentStore.Initialize() in c:\Builds\RavenDB-3.0-Unstable\Raven.Database\Client\EmbeddedDocumentStore.cs:line 225
at Raven.Client.Embedded.EmbeddableDocumentStore.Initialize() in c:\Builds\RavenDB-3.0-Unstable\Raven.Database\Client\EmbeddableDocumentStore.cs:line 138
at SouthsideUtility.RavenDB.Testing.RavenTestDocumentStore..ctor(Boolean ravenInMemory) in c:\Users\tom\Documents\development\SouthsideUtility\app\SouthsideUtility.RavenDB\Testing\RavenTestDocumentStore.cs:line 26
at SouthsideUtility.RavenDB.Testing.RavenDbTest..ctor() in c:\Users\tom\Documents\development\SouthsideUtility\app\SouthsideUtility.RavenDB\Testing\RavenDbTest.cs:line 12
at RabbitOperations.Collector.Tests.Unit.Configuration.SettingsTests..ctor()

If I switch the tests to use an external RavenDB server, they work fine from NCrunch.

I followed the advice to set "prevent signing of output assembly" to true for all the projects without success.

This is happening in an open source project I am working on. Source code is available at https://github.com/SouthsideSoftware/RabbitOperations on the branch feature/signalr. It can be cloned and opened in VS 2013. Nuget packages should be downloaded automatically on build. Command line build uses powershell with this command:

> psake


Hi, thanks for sharing this issue.

I've tried cloning the source code you've described above, but all tests seem to be passing normally. Is it possible this is sequence-specific code?

I'm not sure exactly what the test is trying to do in this situation .. but it's possible that it's attempting to call into your assemblies from another strongly built assembly outside the solution. If this is indeed the case, the output assemblies must be signed and enabling the 'Prevent signing of output assembly' will likely give you problems.
You mean it works from within VS.NET using NCrunch? It works on my machine from the command line but not from NCrunch. Is there something I can do to reset NCrunch to the default state you are seeing?

There are no strongly named assemblies in my project. RavenDB does not use strong signing either.

There are no sequence issues in the tests. It's just any test that uses RavenDB embedded in memory (currently the 3 tests in SettingsTests).

Edited

Clearing out your NCrunch settings files and cache directory should give you the same behaviour .. otherwise you can try cloning the branch to a different location to see if this makes the tests pass.

I'll be honest and say that I know absolutely nothing about how RavenDB works, or how its tests behave. I did notice that the tests in your project are inheriting from a base test type in RavenDB, which does suggest RavenDB has some kind of framework-based testing environment using its own code to bootstrap the test. I cannot assume that this code has been written with NCrunch in mind, and it's possible that the code does some environment-specific or cross domain work that is beyond any control or understanding of NCrunch. I would suggest checking to see what the RavenDB code does and how it loads the assemblies into memory.

Edited

Post a reply

Log in to reply.