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
Just purchased a nice set of enterprise icenses for TypeMock. :)

But when we link TypeMock to NCover, we get crashes in all C++ programs. Even the simple C++ (CLR Console project) "Hello World", without any unit test or mocking code being present gives:

Unhandled exception at 0x7c90eddc ... Access Violation writing location 0x... 
:(

We use the latest version of TestDriven.NET with TypeMock 3.61 Enterprise. Also we have tried both NCover 1.54 and 1.55, but this does not make any difference. When we unlink TypeMock from NCover, then things run normally; but linking to NCover was one of the nice features of the Enterprise version which would be nice to have fixed ASAP.

It is important to note that this problem seems to be C++ specific.


Please help!
asked by dsteele (680 points)

4 Answers

0 votes
This is very strange.
How are you running the C++ program?
Could you see if there is a dump file in Program Files/TypeMock/TypeMock.NET
answered by scott (32k points)
0 votes
In VS2005.
  • * Open a new project: "Visual C++" -> CLR -> CLR application, give it some name in the wizard.
    * Press F5
    * The previously named error message appears and one is asked to break/continue.


An xml file and two .out files are generated in the TypeMock.NET directory. They .out files are posted here. The second .out file looks suspicious because of a "file not found": :shock:

TypeMock-consoletest.exe-10.11.2006-13-55-12.out:
Logging program: c:documents and settingsdavidmy documentsisual studio 2005projectsconsoletestdebugconsoletest.exe
Known namespace: nunit 
Known namespace: vstesthost.exe 
Known namespace: MbUnit 
Known namespace: TestDriven.TestRunner.dll 
Known namespace: JetBrains.ReSharper.UnitTestRunner.exe 


LinkedProfilers-consoletest.exe-10.11.2006-13-55-11.out:
Logging program: c:documents and settingsdavidmy documentsisual studio 2005projectsconsoletestdebugconsoletest.exe
Cannot read EnvName0  => The system cannot find the file specified.

Reset Location: C:PROGRA~1NCoverCoverLib.dll 
Adding profiler: {6287B5F9-08A1-45E7-9498-B5B2E7B02995}
Loaded C:PROGRA~1NCoverCoverLib.dll 
Adding typemock profiler
Loaded C:Program FilesTypeMockTypeMock.NETMockWeaver.dll 
Target Runtime .NET 2.0
Initialize Profiler 0, Target Runtime .NET 2.0
Initialize Profiler 1, Target Runtime .NET 2.0


The xml file, typemockconfig.xml, is here for completeness
<?xml version="1.0" encoding="utf-8"?>
<Profilers xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <ShowOnlyAvailableProfilers>true</ShowOnlyAvailableProfilers>
  <ProfilerList>
    <Profiler Name="DevPartner.Coverage" Clsid="{372DC2B6-0A34-4f22-BC34-BE7A18DE9137}" DirectLaunch="false">
      <EnvironmentList>
        <ProfilerEnvronment Name="NM_DISABLE_DA" TheValue="1" />
        <ProfilerEnvronment Name="NM_DOING_COVERAGE" TheValue="1" />
        <ProfilerEnvronment Name="NM_ANALYSIS" TheValue="cov" />
      </EnvironmentList>
    </Profiler>
    <Profiler Name="DevPartner.Profiler" Clsid="{372DC2B6-0A34-4f22-BC34-BE7A18DE9137}" DirectLaunch="false">
      <EnvironmentList>
        <ProfilerEnvronment Name="NM_DISABLE_DA" TheValue="1" />
        <ProfilerEnvronment Name="NM_DOING_COVERAGE" TheValue="" />
        <ProfilerEnvronment Name="NM_ANALYSIS" TheValue="perf" />
      </EnvironmentList>
    </Profiler>
    <Profiler Name="CoverageEye" Clsid="{18656C37-035D-41CD-82C2-85DEF2DD5F7B}" DirectLaunch="true">
      <EnvironmentList />
    </Profiler>
    <Profiler Name="NCover" Clsid="{6287B5F9-08A1-45E7-9498-B5B2E7B02995}" DirectLaunch="false">
      <EnvironmentList />
    </Profiler>
    <Profiler Name="NCover1.3" Clsid="{4BD66EB5-1F60-4bbd-8820-5E13080D49BE}" DirectLaunch="false">
      <EnvironmentList />
    </Profiler>
    <Profiler Name="TestRunner" Clsid="{BC0AFDDB-7093-4752-A891-F15BA4FCFB0D}" DirectLaunch="false">
      <EnvironmentList />
    </Profiler>
    <Profiler Name="dotTrace1.1" Clsid="{D37A1B72-6DC3-46FC-BC31-F7C4D5A11C9C}" DirectLaunch="false">
      <EnvironmentList />
    </Profiler>
    <Profiler Name="dotTrace.Performace" Clsid="{D37A1B73-6DC3-46FC-BC31-F7C4D5A11C9C}" DirectLaunch="false">
      <EnvironmentList />
    </Profiler>
    <Profiler Name="dotTrace.Memory" Clsid="{D37A1B73-6DC4-46FC-BC31-F7C4D5A11C9C}" DirectLaunch="false">
      <EnvironmentList />
    </Profiler>
  </ProfilerList>
</Profilers>
answered by dsteele (680 points)
0 votes
Hi,
Solution 1.
:arrow: As you have the latest TestDriven, you don't need to link.
When you want to run with NCover click Test->With NCover
TestDriven will link NCover just before running

Solution 2.
:arrow: Link NCover only before running the NCover Test.
answered by scott (32k points)
0 votes
OK. Thanks, we will try that. :)
answered by dsteele (680 points)
...