Profiler Connection Termination

Profiler Connection Termination

Hello,

I am using NCover 1.5.6 that is installed with TestDriven.Net 2.0.

I have created an nunit project file containing multiple test projects to execute so I can get an idea of how much coverage we have across our entire code framework.

During execution of the test cases, the following message appears in the ouput window:

Connected Profiled process terminated. Profiler connection not established.

At this point, I don't believe any more coverage analysis is being done.  As a result I am getting an incomplete picture of our code coverage.

Does anyone have any ideas what might be causing this and how I can fix it?

The location of the termination is not very consistent.  If I change order of the components it may happen in one component and then another.

I have WindowsXP Sp2, .Net 2003 and I have .Net Framework 2.0 installed.  I have 4 GB of memory (3.25 which is available for use according to system properties).

Any help would be greatly appreciated.

Montana


Re: Manual?

NCover.Console.exe is a console application - so you have to run it from a command window if you want to read the output from calling it with no arguments.

As for further tips, there is no manual I am aware of, although I do know there is a book called "Windows Developer Power Tools" which has a section on how to use it. There were sample chapters online covering it at one point anyways (Chapter 10 from memory) - James Avery and Jim Holmes are the authors.

Other options - Google is your friend. You can read back through the blog entries on my site to find various tidbits about it and using it with NCoverExplorer.

I also have an updated version of the FAQ for NCover that I prepared for the Peter for the next NCover release which is in the works. This FAQ version has examples and updated to reflect the later command lines. Drop me an email if you want me to send it to you.


Re: Manual?

Hello Jan,

Open a command window and run the console exe. It will give you the parameters. In the same directory is a faq.html file. One thing not very clear in other publications is that for all the parameters for NCover, you have to use double slashes. For the commandline you want to pass to the application you are going to analyse, you have to use single slashes. Insert a space after the parameter definition and value.

For opening a command line you can use start->run->"cmd" of course. But I prefer the "Open Command Window Here" powertoy, to open one from windows explorer. (http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx)

Or you could make use of NCoverExplorer from http://www.kiwidude.com/blog/ like mentioned above. That is a great tool that has a "Run NCover" menu option, that outputs a commandline, msbuild or nant script.

Koob.


Re: Manual?

First of al lthanks for the powertoys, especially the "open command window here" tool is pretty helpfull.

I used the command line help of the NCover console to figure out how to do a coverage measurement. For testing purpose I used NUnit and the tests provided with it. The execution worked without any problems, but the Coverage.XML was pretty much empty. I executed the following command to start NCover:

c:
cd \Program Files\NUnit-Net-2.0 2.2.8\bin
"C:\Program Files\NCover\NCover.Console.exe" nunit-console.exe NUnitTests.nunit //w . //a nunit.core.extensions.dll;nunit.framework.dll;nunit.mocks.dll;nunit.uikit.dll;nunit.util.dll;nunit-console.exe;nunit-gui.exe > log.txt

 

The resulting logfile comes here:

NCover.Console v1.5.4 - Code Coverage Analysis for .NET - http://ncover.org
Copyright (c) 2004-2005 Peter Waldschmidt


Command: nunit-console.exe
Command Args: NUnitTests.nunit
Working Directory: .
Assemblies: nunit.core.extensions.dll;nunit.framework.dll;nunit.mocks.dll;nunit.uikit.dll;nunit.util.dll;nunit-console.exe;nunit-gui.exe
Coverage Xml: Coverage.Xml
Coverage Log: Coverage.Log

Waiting for profiled application to connect...
******************* Program Output *******************
NUnit version 2.2.8
Copyright (C) 2002-2003 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov, Charlie Poole.
Copyright (C) 2000-2003 Philip Craig.
All Rights Reserved.

OS Version: Microsoft Windows NT 5.1.2600 Service Pack 2    .NET Version: 2.0.50727.42

.....Hello from sample test 1
.Hello from sample test 2
TestFixtureSetUp called
.Hello from another test
.Hello from some test
TestFixtureTearDown called
.............................12,3
12,300
12,30
............ILogicalThreadAffinativeTest
.............................................................................................................................N..................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Tests run: 767, Failures: 0, Not run: 1, Time: 19.813 seconds

Tests not run:
1) NUnit.Core.Tests.StackOverflowTestFixture.SimpleOverflow : Not supported on Net-2.0,Mono

***************** End Program Output *****************

(Unforunately I have currently no webspace available and I forgott the URL of this usefull "quote storing website")

The Coverage.XML is this:

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="coverage.xsl" type="text/xsl"?>
<!-- saved from url=(0022)http://www.ncover.org/ -->
<coverage />

That's it. Did I work out the command wrong or is NCover missing some settings (I have no NCover.Settings)?

 

Thanks,

Jan

P.S.: I'm off to Christmas holidays now, so I'm not gonna reply before 8 January 2006.


Re: Manual?

Remove the .dll suffix from all your arguments in //a - it is the assembly name, not the physical file name that is required.


Re: Manual?

Hello Jan,

I did saw it happen (the same empty Coverage.xml) until I got all 'settings' OK. Problem is that I don't know what fixed it. Maybe it was setting the correct working folder to the NUnit bin folder. Or the order of the parameters on the command line?
But I can share a bit of the settings I use now. It's all in a FinalBuilder script now, so a little tricky to extract.

Command lines I tested:
OK ===>  "C:\Program Files\NUnit\bin\nunit-console.exe" "D:\Autobuild\Build\NunitTests.nunit" /xml="D:\Autobuild\Output\nunit-results.xml"

OK ====> "C:\Program Files\NCover\NCover.Console.exe" //w "C:\Program Files\NUnit\bin" //x "D:\Autobuild\Output\ncover-results.xml" "C:\Program Files\NUnit\bin\nunit-console.exe" "D:\Autobuild\Build\NunitTests.nunit" /xml="D:\Autobuild\Output\nunit-results.xml"

OK ====> "C:\Program Files\NCover\NCoverExplorer\NCoverExplorer.Console.exe" "D:\Autobuild\Output\ncover-results.xml" /x:"D:\Autobuild\Output\ncoverexplorer-results.xml"  /c:"D:\Autobuild\NCoverExplorer.config" /r:4

The NunitTests.nunit (the location somehow is important!)
<NUnitProject>
  <Config name="Default" binpathtype="Auto">
<assembly path="D:\AutoBuild\Build\TestCodusMain\Test.Dal\bin\Debug\Test.Dal.dll" />
<assembly path="D:\AutoBuild\Build\TestCodusMain\Test.Zomaar\bin\Debug\Test.Zomaar.dll" />
  </Config>
</NUnitProject>

The NCoverExplorer.config:
<?xml version="1.0" encoding="utf-8"?>
<NCoverExplorer xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">;
  <ProjectName>Test NCoverExplorer</ProjectName>
  <SatisfactoryCoverageThreshold>80</SatisfactoryCoverageThreshold>
  <TreeFilterStyle>None</TreeFilterStyle>
  <TreeSortStyle>CoveragePercentageAscending</TreeSortStyle>
  <CoverageExclusions>
    <CoverageExclusion>
      <ExclusionType>Assembly</ExclusionType> <!-- Valid values are [Assembly], [Namespace] and [Class]. -->
      <Pattern>Test.</Pattern>
      <IsRegex>false</IsRegex> <!-- Only required with a value of "true" if you do have a regular expression based pattern -->
    </CoverageExclusion>
        <CoverageExclusion>
            <ExclusionType>Namespace</ExclusionType>
            <Pattern>Test.
</Pattern>
        </CoverageExclusion>
    </CoverageExclusions>
</NCoverExplorer>

Next to that I have no extra configurations or changed settings I am aware of.

Hope this helps,
Koob.


Re: Manual?

Oh, and I see now there is an older thread  in http://ncover.org/SITE/forums/thread/428.aspx ; that maybe can help.
F.Y.I: I am using NCover 1.5.5, nunit 2.2.9 and NCoverExplorer 1.3.5


Re: Manual?

Hello,

Thansk for the replies. Now back at work i tried some things.

First of all, I tried to run my above mentioned script again without the .dll endings and also again without the .exe endings. No change in the result.

Second, I downloaded the NCoverExplorer. I tried to run my script with the "Run NCover"-Opertion, where I chose the "NCover.Console.exe" (by the way, it adds the file extension of the assemblies to the generated command line). I ran it with the same options as in the script. The output didn't change.

I did change things like adding " to my commands, specifying the //x-Option and things like that, that should not change anything, in case it woulkd change something, but it didn't.

I read your command, Koob, and I think they are the same as mine. I didn't fine anything different... except for paths and things like that of yourse.

What I'm noticing right now is, that I have a "Coverage.Log" that has quite some lines.

Excerpt:

EVENT:   Log link established.
EVENT:   Communications link established.
MESSAGE: Ready for command input.
EVENT:   Verbose Logging Disabled
EVENT:   Logging Enabled
MESSAGE: Monitoring Assemblies: (All Loaded Assemblies)
MESSAGE: Excluding Types and Methods with these Attributes: nunit-gui.exe;nunit.core.extensions.dll;nunit.framework.dll;nunit.mocks.dll;nunit.uikit.dll;nunit.util.dll;nunit-console.exe;
MESSAGE: Received driver ready event.
MESSAGE: v2.0.50727
EVENT:   Profiler Initialize
MESSAGE: Module Load ---- Thread: 0x000008f4; Module ID: 0x790c2000
MESSAGE: Failed to load symbols for module [mscorlib.dll] in [C:\WINNT\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089].
EVENT:   Loaded Module [C:\WINNT\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll]
MESSAGE: Module Load Complete ---- Module ID: 0x790c2000
MESSAGE: Module [0x790c2000] attached To assembly [0x001648e8]
MESSAGE: Assembly Load ---- Thread: 0x000008f4; Assembly ID: 0x001648e8
EVENT:   Monitoring Assembly [mscorlib][0x001648e8]
MESSAGE: Assembly Load Complete ---- Assembly ID: 0x001648e8
MESSAGE: Module Load ---- Thread: 0x000008f4; Module ID: 0x00a12c14
MESSAGE: Failed to load symbols for module [nunit-console.exe] in [C:\Program Files\NUnit-Net-2.0 2.2.8\bin].
EVENT:   Loaded Module [C:\Program Files\NUnit-Net-2.0 2.2.8\bin\nunit-console.exe]
MESSAGE: Module Load Complete ---- Module ID: 0x00a12c14
MESSAGE: Module [0x00a12c14] attached To assembly [0x0016d490]
MESSAGE: Assembly Load ---- Thread: 0x000008f4; Assembly ID: 0x0016d490

------

Another "Coverage.Log" that is quite smaller is "nopasted" here: http://rafb.net/p/Ux7ZIB90.html

I just figured out, that this logfile is generated on every run of my script and on each run of "Run NCover" in the NCoverExplorer. And it always has content. Size is ranging from some 100kBs to 1,3 Megs at largest. Can I process this file somehow to generate a XML-Report or something like that? Or am I making a mistake in the parameters or other options that the logfile can't be analyzed to generate the XML?

 

Thanks and Regards,

Jan


Re: Manual?

Because I did not find any result for my problem and still couldn't convince NCover to work properly, I wanted to ask if any of you do know any additional hint that might help.


Re: Manual?

There is an faq that I mentioned earlier in the thread that is temporarily located here:

http://www.kiwidude.com/dotnet/NCoverFAQ.html

Make sure that you have COM registered coverlib.dll, then just start with simple command lines such as shown in the examples in this FAQ and work your way up. Don't use the //a argument to begin with - it is only needed to filter assemblies out and you just want to get some results to begin with.


Re: Manual?

I should also have added - you do have the .pdb files for NUnit in that directory right? NCover can only give you coverage information for assemblies with pdbs. There is a good chance if you just have the binary distribution you dont have those.


Re: Manual?

That did it. Don't know where the point of PDBs got lost, but I got myself the NUnit srcs and generated the PDBs and afterwords the XML was generated.. XSLT also worked, so now I'm happy ;) Thanks much for the help!


RE: Profiler Connection Termination

//Quote// you do have the .pdb files //End Quote

Thanks for that HINT!

I realized that I had my MSBuild set to Release, and not Debug.

Now that I have it building in debug mode, things are working again.


RE: Profiler Connection Termination

You can also build the pdb files for a release build. Either way will work.

Joe Feser