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
Yeah, I know - it's a constant issue. I tried all the hints and tips I could find, but couldn't get it to work. So here's my configuration:

Windows Server 2008 (X64)
TypeMock Isolator 5.1 (X64)
NCover 2.1 (X64)
NUnit 2.4.8
CC.NET 1.4

Here are the relevant parts from my MsBuild.targets file:

<TypeMockRegister Company ="$(TypeMockCompany)" License="$(TypeMockLicense)" AutoDeploy="false"/>

<!--<exec command="regsvr32 -s "$(NCoverToolPath)NCover.Lib.x86.dll""/>-->

<TypeMockStart Link="NCover2.0" ProfilerLaunchedFirst="true"/>

<Exec Command=""$(NCoverToolPath) cover.console.exe" //a "@(CoverageAssemblies->'%(Identity)',';')" //x "$(NCoverResultFile)" "$(NUnitToolPath) unit-console.exe" $(NUnitCmdLineArgs)"
Condition="'$(CoverageAnalysisEnabled)'=='true'" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="NCoverExitCode"/>

CommandLineExe="$(NUnitToolPath) unit-console.exe"
LogFile="c: cover.log"


<!--<exec command="regsvr32 -s -u "$(NCoverToolPath)NCover.Lib.x86.dll""/>-->

<Error Code="$(NCoverExitCode)" Text="Fehler bei Ausführen der Unittests." Condition="'$(NCoverExitCode)'>'0'"/>

As you can see I tried it using the NCover command as well as the exec command. I tried to register and unregister. I tried with and without the ProfilerLaunchedFirst attribute on TypeMockStart. I tried with and without the RegisterProfiler attribute on NCover. I even tried it manually by linking with the TypeMockConfiguration UI and running the commands with cmd.

The frustrating thing is: I can not get any deterministic behaviour! It wasn't working in the first placem, so I started to add and remove some attributes (with no result). I then managed to get it running manually - after that it also worked in CC.NET. I then started adding and removing some attributes again and couldn't get it to work any more. It does work running only NCover OR TypeMock, but it doesn't with both of them. I'm definitely running out of ideas - is there probably some more trick I need to to because of the X64?
asked by srudin (1.7k points)

2 Answers

0 votes
It can be that the problem is that the problem is because the linking is done in
a different context from the ncover runner.

Here is a list of things to try out:
Change ncover-console.exe to run in 32 bit using the corflags utility
(You can find it in the Visual Studio command Prompt)
corflags /32bit+ $(NCoverToolPath) cover.console.exe
Now Run the tests

Change ncover to run in 64 bit:
corflags /32bit- $(NCoverToolPath) cover.console.exe
Now Run the tests.

Finally I would suggest trying to link using Isolator Configuration
START -> Programs -> Typemcok -> Isolator 5.1 -> Isolator Configuration
Open the Profilers /Code Coverage tab than Ncover from the drop down list and hit the 'Link with Typemock Isolator' button.

Don't forget to comment out the linking in your build script and unlink manually at the end.

Please tell me the results so we can pinpoint the problem.
answered by ohad (35.4k points)
0 votes
Setting the corflags attribute /32bit+ denied the tests from running at all.

Linking with the Configurator used to work earlier but didn't do anything now.

But still you got me on the right path! The trick for getting this to work on a x64 machine seems to be:

1. Unregister ncover.lib.x86.dll (now you should not see any available linking profile in the Configurator)
2. Register ncover.lib.x64.dll
3. Link the ncover2.0 profile in the Configurator
4. Run MsBuild as follows:

a) Do not register TypeMock
b) Do not register ncover.lib.x??.dll
c) Run TypeMockStart with no parameters
d) Run tests with ncover.console from the x64 directory
e) Run TypeMockStop with no parameters

Maybe not a beauty but it does work here.

I have the impression that 1. the initial registering of the libraries by ncover on a x64 machine is wrong and 2. the automated linking by TypeMock can not handle the x64 version of ncover. But maybe this is wrong and I f* up the machine myself while trying to get it work...

anyway, thanks for your support.
answered by srudin (1.7k points)