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
0 votes
I experienced this before, but lately it was stable. Looks like I am having this problem again.

Scenario:
- Upgraded TypeMock Isolator to version 5.2 (in fact, 5.2.1 internal build that was sent to us)
- Upgraded TestDriven.NET to 2.18 beta
- Run "Run Tests" from TestDriven menu, works fine, all mocking is done.
- Run "Test with Coverage", NCover fails to generate coverage report.
- Check "Isolator Configuration". It is not linked to coverage tool. Link it to NCover
- Run "Test with Coverage", now TypeMock complains that it is not enabled.
- Check "Isolator Configuration" again. It still is not linked to coverage tool. Link it to NCover.

and so on, and so force. If I don't link TypeMock with NCover, coverage generation fails (and it should), if I link it, first time it complains that TypeMock is not enabled, after that it mysteriously unlinks TypeMock from NCover and then coverage generation fails again.

The problem occurs only from within Visual Stuidio, but it is painful enough.

What can be wrong? I remember I've seen it before.
asked by vagif (19.4k points)

24 Answers

0 votes
Hi Vagif,

Perhpas this is a 32/64 bit issue.
You can set TestDriven to run your test as a 32bit assembly using Corflags as explained here: http://blog.typemock.com/2009/01/soluti ... hines.html.
answered by dhelper (11.9k points)
0 votes
Nope. Tried that, but it did not help.

The strangest thing is that "Link with TypeMock" flag is not sticky any more. Or it is lost after "Run with coverage" session. So I can run tests without coverage many times without linking Isolator with coverage tool. After I link Isolator with NCover and try "Test with code coverage mode" it fails tests complaining that TypeMock is not enabled. TypeMock is actually enabled, but if I display its configuration I see that in no longer is linked with code coverage tool.

There must be something wrong with losing "Link with code coverage" flag.
answered by vagif (19.4k points)
0 votes
The button should stay pressed until you press it again - it should still be sticky.

I need to investigate this issue - let's take it offline
answered by dhelper (11.9k points)
0 votes
I sent you the mail. Reinstallation did not help.
answered by vagif (19.4k points)
0 votes
Hello,

I'm having similar problems. I'm on Windows 2008 Standard x64. Please post any possible solutions or things to try out here.

Scenario:
- Using TypeMock Isolator version 5.2.1
- Using TestDriven.NET 2.19 beta
- Run "Run Tests" from TestDriven menu, throws in many cases "System.AccessViolationException: Atempted to read or write protected memory...", but some tests also passes.
- Run "Test with Coverage", NCover fails to generate coverage report.
- Check "Isolator Configuration". It is not linked to coverage tool. Link it to NCover
- Run "Test with Coverage", now TypeMock complains that it is not enabled.
- Check "Isolator Configuration" again. It still is not linked to coverage tool. Link it to NCover.
- Running tests in NUnit GUI doesn't work. It says that Typemock is not enabled.
- Running tests in ReSharper GUI works fine. All tests passes.

My college is running Windows Vista Ultimate x86, and when he runs tests from TestDriven menu, all tests passes. But he also gets the same error when trying to run the tests from the NUnit GUI. He doesn't have NCover installed, so we haven't tested that yet.
answered by Jan-Erik (1.4k points)
0 votes
Thanks for the extra info, this is extremely helpful. We are still investigating the issue and will keep you posted on any progress.

Thanks,
Doron
Typemock Support
answered by doron (17.2k points)
0 votes
A quick follow up. My college installed NCover, and get the same error:

Invalid NCover coverage xml file: c:lablalaTestDriven.NET 2.0CoverageSolutionNameCoverage0.xml

This is the error I get in NUnit gui:

RS_CustomerTests.RS_CustomerServiceTests.GetAllCustomers_GetsCustomers_ClosesProxy:
TypeMock.TypeMockException :
*** Typemock Isolator is not currently enabled.
To enable do one of the following:

* To run Typemock Isolator as part of an automated process you can:
- run tests via TMockRunner.exe command line tool
- use 'TypeMockStart' tasks for MSBuild or NAnt

* To work with Typemock Isolator inside Visual Studio.NET:
set Tools->Enable Typemock Isolator from within Visual Studio

For more information consult the documentation (see 'Running' topic)

This is the error I get (not my college) when running tests using TestDriven:

Error 1 TestCase 'RS_CustomerTests.RS_CustomerServiceTests.GetAllCustomers_GetsAllCustomers_ReturnsListOfCustomers'
failed: System.AccessViolationException : Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.ServiceModel.Description.ConfigLoader.CheckAccess(IConfigurationContextProviderInternal element)
at System.ServiceModel.Description.ConfigLoader.LookupChannel(String configurationName, String contractName, Boolean wildcard)
at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName)
at System.ServiceModel.EndpointTrait`1.CreateSimplexFactory()
at System.ServiceModel.EndpointTrait`1.CreateChannelFactory()
at System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
at System.ServiceModel.ClientBase`1..ctor()
at RS_Customer.CustomerServiceReference.CustomerServiceClient..ctor() in D:_Development_Optimalt ProduksjonssystemMainSourceRouting ServicesRS_CustomerRS_CustomerService ReferencesCustomerServiceReferenceReference.cs:line 4001
at RS_Customer.RS_CustomerService.GetAllCustomers() in D:_Development_Optimalt ProduksjonssystemMainSourceRouting ServicesRS_CustomerRS_CustomerRS_CustomerService.cs:line 26
at RS_CustomerTests.RS_CustomerServiceTests.GetAllCustomers_GetsAllCustomers_ReturnsListOfCustomers() in D:_Development_Optimalt ProduksjonssystemMainSourceRouting ServicesRS_CustomerRS_CustomerTestsRS_CustomerServiceTests.GetAllCustomers.cs:line 22
at TypeMock.MockManager.a(String A_0, String A_1, Object A_2, Object A_3, Boolean A_4, Object[] A_5)
at TypeMock.InternalMockManager.getReturn(Object that, String typeName, String methodName, Object methodParameters, Boolean isInjected)
at RS_CustomerTests.RS_CustomerServiceTests.GetAllCustomers_GetsAllCustomers_ReturnsListOfCustomers() in D:_Development_Optimalt ProduksjonssystemMainSourceRouting ServicesRS_CustomerRS_CustomerTestsRS_CustomerServiceTests.GetAllCustomers.cs:line 16 D:_Development_Optimalt ProduksjonssystemMainSourceRouting ServicesRS_CustomerRS_CustomerService ReferencesCustomerServiceReferenceReference.cs 4001
answered by Jan-Erik (1.4k points)
0 votes
Jan-Erik,

Today I had remote session with TypeMock engineers, and we confirmed the problem with both Isolator 5.2 and 5.1. I was told that they had collected enough information to understand where the problem is, so we should expect a fix shortly.

Vagif
answered by vagif (19.4k points)
0 votes
Jan-Erik,

Today I had remote session with TypeMock engineers, and we confirmed the problem with both Isolator 5.2 and 5.1. I was told that they had collected enough information to understand where the problem is, so we should expect a fix shortly.

Vagif


Ok. That's great! Thanks for keeping me updated.
answered by Jan-Erik (1.4k points)
0 votes
OK, an update on this issue:

After talking with Jamie (the creator of TestDriven.NET), it turns out that when running through TDD.NET's "run with coverage" option, TDD.NET automatically uses Isolator's command line runner (TMockRunner) to perform the coverage tool link and run the tests. This means that when running coverage through TDD.NET it's redundant, and as it turns out conflicting, to configure coverage through Isolator's configuration form. The bug that occured because of this scenario is that TMockRunner overrid the registry data modified by the Isolator configuration form, which caused an invalid NCover registry.

Please attempt the following:
1. Unlink NCover and Typemock Isolator from the Isolator configuration form
2. re-register NCover 1.5.8 - this is required to fix NCover registration state. Just run regsvr32 on CoverLib.dll (this should be located under the testdriven install dir in the NCover folder)
3. Run the tests with coverage using TestDriven.NET. There's no need to link with Isolator through the configuration form.

Please let me know if this works now.

We are working to issue a patch that will prevent this from happening by preventing TMockRunner re-linking and unlinking if already linked via the configuration form.

Thanks,
Doron
answered by doron (17.2k points)
...