chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
Hi

I'm experiencing the issue with TypeMock when running RavenDB unit tests with mocking enabled under ncrunch.
The exception stack trace below

System.TypeInitializationException : The type initializer for 'ICSharpCode.NRefactory.CSharp.AstNode' threw an exception.
----> System.InvalidProgramException : Common Language Runtime detected an invalid program.
at ICSharpCode.NRefactory.CSharp.AstNode..ctor()
at ICSharpCode.NRefactory.CSharp.EntityDeclaration..ctor()
at ICSharpCode.NRefactory.CSharp.TypeDeclaration..ctor()
at Raven.Database.Linq.DynamicViewCompiler.TransformQueryToClass() in c:BuildsRavenDB-StableRaven.DatabaseLinqDynamicViewCompiler.cs:line 51
at Raven.Database.Linq.DynamicViewCompiler.GenerateInstance() in c:BuildsRavenDB-StableRaven.DatabaseLinqDynamicViewCompiler.cs:line 594
at Raven.Database.Storage.IndexDefinitionStorage.AddAndCompileIndex(IndexDefinition indexDefinition) in c:BuildsRavenDB-StableRaven.DatabaseStorageIndexDefinitionStorage.cs:line 233
at Raven.Database.Storage.IndexDefinitionStorage.CreateAndPersistIndex(IndexDefinition indexDefinition) in c:BuildsRavenDB-StableRaven.DatabaseStorageIndexDefinitionStorage.cs:line 180
at Raven.Database.DocumentDatabase.PutIndex(String name, IndexDefinition definition) in c:BuildsRavenDB-StableRaven.DatabaseDocumentDatabase.cs:line 1207
at Raven.Client.Embedded.EmbeddedDatabaseCommands.PutIndex(String name, IndexDefinition definition, Boolean overwrite) in c:BuildsRavenDB-StableRaven.Client.EmbeddedEmbeddedDatabaseCommands.cs:line 429
at Raven.Client.Indexes.AbstractIndexCreationTask.Execute(IDatabaseCommands databaseCommands, DocumentConvention documentConvention) in c:BuildsRavenDB-StableRaven.Client.LightweightIndexesAbstractIndexCreationTask.cs:line 198
at Raven.Client.DocumentStoreBase.ExecuteIndex(AbstractIndexCreationTask indexCreationTask) in c:BuildsRavenDB-StableRaven.Client.LightweightDocumentStoreBase.cs:line 91

This can be reproduced by running dummy test below

[Test]
public void Test()
{
using (var documentStore = new EmbeddableDocumentStore {RunInMemory = true}.Initialize())
{
documentStore.ExecuteIndex(new TestIndex());
}
}

This issue is not occurring when mocking disabled.

Environment details: VS 2013 + NCrunch 2.7.0.5 + TypeMock 7.5.1

Please advice.

Thanks
asked by graduss (1.1k points)

1 Answer

0 votes
Hi,

We reproduced this issue and working on it now.
A patch for this issue should be available by the end of next week.
I'll keep you posted.
answered by alex (17k points)
...