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 having an issue with a very simple test that is mocking the static constructors of the test class.
Every time I run this test with code coverage on, I get an AccessViolationException.
The interesting thing is that this error didn't occur before (I think). It started at some point that now I can't figure out.

I'm using only the Visual Studio Unit Testing Framework.

The test method is quite simple:

[TestMethod]
[ExpectedException(typeof(ArgumentNullException))]
[SuppressMessage("Microsoft.Usage", "CA1806")]
public void CreateTest1()
{
    // Mock Repository NHibernate

    using (RecordExpectations recorder = new RecordExpectations())
    {
        new RepositoryNHibernate(typeof(Customer).Name);
        recorder.MockStaticConstructors();
    }

    // Test

    Repository target = new Repository(typeof(Customer).Name);
    target.Create(null);
}


I've setup a TestInitialize method that is calling MockManager.Init() and a TestCleanUp that is calling MockManager.Verify() and MockManager.ClearAll().

The error is actually occurring in the second creation of Repository (outside the recorder).

Am I doing something wrong or is this a compatibility issue between TypeMock and TFS Code Coverage?

Please help. Thanks in advance.

Hugo
asked by hgr (1.1k points)

1 Answer

0 votes
Hi Hugo

Can you send me please the the TypeMock logs?
I'll send you my address + instructions how to get the log files.
answered by ohad (35.4k points)
...