killing ncover causes child process to hang, rather than die

killing ncover causes child process to hang, rather than die

When the NCover.Console.exe process is killed (for instance, by a nant build timeout), its child process (in my case nunit-console.exe) is not killed, and hangs (fills up a buffer trying to talk to the now-defunct NCover?  i dunno).

When NCover is killed, it should terminate its child process.


Re: 1.5.7 and yield blocks in try/finally

I'm sure Peter will correct me if wrong but I believe he deferred fixing this to a later release.

I did submit a test case to him for it from when it was previously raised but I think he found it was a non-trivial case to address at the time due to the way the IL was generated. This case is in his integration test suite and on a todo list when I last looked so hopefully he finds a way to do so in the future.


Re: 1.5.7 and yield blocks in try/finally

I hope so too as I have a rather large list of enumerator filters and similar classes that do odd things with enumerators, so they can't just use foreach syntax, and thus need a try/finally part to clean up. My coverage report was a rather big mess when isolating just these classes so it adds a lot of noise to my reports.


Re: NCover from NAnt : Task helped, but no coverage information

Hi Dave,

Can you add verbose="true" to your ncover task and then post back the first part of the output? (before it runs the unit tests).


Re: NCover from NAnt : Task helped, but no coverage information

I would be happy to. First, here's the NAnt block one more time:
<ncover program="${project.fullpath}\ThirdParty\NCover\NCover.Console.exe"
    commandLineExe="${nunit}"
    commandLineArgs="Tests.dll /xml=${test.results.filename}"
    workingDirectory="${test.unit.bin.dir}"
    coverageFile="mycoverage.xml"
    logFile="mycoverage.log"
    logLevel="Verbose"
    verbose="true">
    <assemblies basedir="${test.unit.bin.dir}">
        <include name="My..dll"/>
    </assemblies>
</ncover>


Something I wasn't explicit about yesterday: the block is in a .build file that is called from a higher level build file. That should be obvious from the output here:

NAnt 0.85 (Build 0.85.1932.0; rc3; 16/04/2005)
Copyright (C) 2001-2005 Gerry Shaw
http://nant.sourceforge.net

Buildfile: file:///E:/Work/dave/MYSYSTEM5_0/Build/master.build
Target framework: Microsoft .NET Framework 1.1
Target(s) specified: NCoverServerUnitTests


clean:

     [exec]
     [exec] "E:\Work\dave\MYSYSTEM5_0\build\DeleteBinFolders.cmd": Deleting files from bin folders from 'E:\Work\dave\MYSYSTEM5_0\src' ...
     [exec] "E:\Work\dave\MYSYSTEM5_0\build\DeleteBinFolders.cmd": bin folder deletion complete.
     [exec]
     [exec]
     [exec] "E:\Work\dave\MYSYSTEM5_0\build\DeleteCvsBackups.cmd": Deleting CVS backup files from 'E:\Work\dave\MYSYSTEM5_0' ...
     [exec] Could Not Find E:\Work\dave\MYSYSTEM5_0.#
.
     [exec] "E:\Work\dave\MYSYSTEM5_0\build\DeleteCvsBackups.cmd": CVS backup file deletion complete.
     [exec]

NCoverServerUnitTests:

     [nant] E:\Work\dave\MYSYSTEM5_0\Build\MY.build coverage
            Buildfile: file:///E:/Work/dave/MYSYSTEM5_0/Build/MY.build
            Target framework: Microsoft .NET Framework 1.1
            Target(s) specified: coverage


            coverage:

                 [echo] project.fullpath: E:\Work\dave\MYSYSTEM5_0

            test.dir.setup:

                 [echo] Starting NUnit code coverage run...
                 [echo] project.fullpath: E:\Work\dave\MYSYSTEM5_0
                 [echo] working dir: E:\Work\dave\MYSYSTEM5_0\src\My\Tests\unitOutput\debug
                 [echo] coverage file: c:\coverage-output\Coverage.xml
                 [echo] test.output.dir: E:\Work\dave\MYSYSTEM5_0\build\tests
                 [echo] test.results.filname: My-Unit-results.xml
               [ncover] Creating settings file: C:\DOCUME~1\dcameron\LOCALS~1\Temp\tmp8C9.tmp.ncoversettings
               [ncover] Working directory: E:\Work\dave\MYSYSTEM5_0\Build
               [ncover] Arguments: //r "C:\DOCUME~1\dcameron\LOCALS~1\Temp\tmp8C9.tmp.ncoversettings"
               [ncover] <?xml version="1.0" encoding="utf-8"?>
               [ncover] <ProfilerSettings>
               [ncover]   <CommandLineExe>E:\Work\dave\MYSYSTEM5_0\ThirdParty\NUnit\V2.2.8.0\bin\nunit-console.exe</CommandLineExe>
               [ncover]   <CommandLineArgs>Tests.dll /xml=My-Unit-results.xml</CommandLineArgs>
               [ncover]   <WorkingDirectory>E:\Work\dave\MYSYSTEM5_0\src\My\Tests\unitOutput\debug</WorkingDirectory>
               [ncover]   <Assemblies>My.AutoProfitPricing;My.Common;My.Server.Core;My.Server.CustomerManagement;My.Server.FacadesAndServices;My.Server.Gateways;My.Server.Gateways.TbsExport;My.Server.Infrastructure;My.Server.Management.Customers.Application;My.Server.ProfitPricing</Assemblies>
               [ncover]   <CoverageXml>mycoverage.xml</CoverageXml>
               [ncover]   <LogFile>mycoverage.log</LogFile>
               [ncover]   <VerboseLog>true</VerboseLog>
               [ncover]   <NoLog>false</NoLog>
               [ncover]   <DumpOnErrorNormal>false</DumpOnErrorNormal>
               [ncover]   <DumpOnErrorFull>false</DumpOnErrorFull>
               [ncover] </ProfilerSettings>
               [ncover] Starting 'E:\Work\dave\MYSYSTEM5_0\ThirdParty\NCover\NCover.Console.exe (//r "C:\DOCUME~1\dcameron\LOCALS~1\Temp\tmp8C9.tmp.ncoversettings" )' in 'E:\Work\dave\MYSYSTEM5_0\Build'
               [ncover] NCover.Console v1.5.4 - Code Coverage Analysis for .NET - http://ncover.org
               [ncover] Copyright (c) 2004-2005 Peter Waldschmidt
               [ncover]
               [ncover]
               [ncover] Command: E:\Work\dave\MYSYSTEM5_0\ThirdParty\NUnit\V2.2.8.0\bin\nunit-console.exe
               [ncover] Command Args: Tests.dll /xml=My-Unit-results.xml
               [ncover] Working Directory: E:\Work\dave\MYSYSTEM5_0\src\My\Tests\unitOutput\debug
               [ncover] Assemblies: My.AutoProfitPricing;My.Common;My.Server.Core;My.Server.CustomerManagement;My.Server.FacadesAndServices;My.Server.Gateways;My.Server.Gateways.TbsExport;My.Server.Infrastructure;My.Server.Management.Customers.Application;My.Server.ProfitPricing
               [ncover] Coverage Xml: mycoverage.xml
               [ncover] Coverage Log: mycoverage.log
               [ncover]
               [ncover] Waiting for profiled application to connect...
               [ncover]
Program Output *


Re: NCover from NAnt : Task helped, but no coverage information

Hi Dave,

Thanks for that - can't spot anything obviously wrong there. Have you made sure that the NCover CoverLib.dll is COM registered in that folder (E:\Work\dave\MYSYSTEM5_0\ThirdParty\NCover\NCover.Console.exe) ?

Have you tried NCover from the command line? You could try:
ncover.console.exe
  //w E:\Work\dave\MYSYSTEM5_0\src\My\Tests\unitOutput\debug
  E:\Work\dave\MYSYSTEM5_0\ThirdParty\NUnit\V2.2.8.0\bin\nunit-console.exe
  "Tests.dll /xml=My-Unit-results.xml"


Re: NCover from NAnt : Task helped, but no coverage information

Thanks for the suggestions. I have tried it already with the command line though, and it works great. The command I'm using is:
E:\Work\dave\mySYSTEM5_0>ThirdParty\NCover\NCover.Console.exe ThirdParty\NUnit\V2.2.0.0\nunit-console.exe "Tests.dll" //l C:\coverage-output\logfile.txt //x c:\coverage-output\coveragexml.txt //w "src\mysystem\tests\unitoutput\Debug" //v


I was using this as proof that the COM registration had worked correctly. I have tried it with and without the following line in the NAnt file:
<exec program="regsvr32" workingdir="${project.fullpath}\ThirdParty\NCover" commandline="/s CoverLib.dll" />


One of my colleagues has suggested I just try using the <exec> task again, with the new command line syntax. So, I guess that's my next step.

Dave


Re: NCover from NAnt : Task helped, but no coverage information

Hi Dave,

I notice from your command line that you are not using the //a argument. What happens when you include that? Interested to know if that "breaks" things for you again...

i.e. as above but with:
//a My.AutoProfitPricing;My.Common;My.Server.Core;My.Server.CustomerManagement;My.Server.FacadesAndServices;My.Server.Gateways;My.Server.Gateways.TbsExport;My.Server.Infrastructure;My.Server.Management.Customers.Application;My.Server.ProfitPricing

You could try removing the <assemblies> node from the <ncover> task which should work similarly to the original command line you say works for you. The reason I suggest this is I am simultaneously trading e-mails with someone else for whom the //a argument isn't working with more than one assembly. I know for a fact it "can" work (well, sometimes anyways!) but lets take it out of the equation temporarily?

Another thing to try - what the NCover task does is produce a ".ncoversettings" file and then execute NCover using that with the //r argument. You have the contents of that .ncoversettings file in the output of when you did verbose="true" (All the xml within <ProfilerSettings> above).

Try saving that as a "test.ncoversettings" file (or any name!), and then execute NCover with:
ncover.console //r test.ncoversettings

You can then fiddle with the contents of that file. The NCover task doesnt do anything very complex so it would surprise me if it's the cause of your grief but I would love to get to the bottom of this.


Re: NCover from NAnt : Task helped, but no coverage information

Hello again Grant

I tried adding the //a parameter just now. I tripped up at first by adding .dll at the end of the name, but then remembered some of the other messages around here! Adding a couple of assemblies using //a works.

Adding all of them seems to work. There is nothing in the coverage.xml for My.Server.Management.Customers.Application, but I know there are no tests that touch it, so perhaps it is just omitted?

I just tried removing the <assemblies> node from the NAnt task, but it didn't change anything. The output does look exactly like the output when I call it from the command line without //a, so something strange is definetly afoot.

I'll try tweaking the XML file and using the //r parameter tomorrow morning. (North America, Pacfic morning that is.)

Dave


Re: NCover from NAnt : Task helped, but no coverage information

Hi Dave,

Jay Flowers has just pointed out to me that with the NCover 1.5 versions the <Assemblies> nodes are stored differently in the xml settings file (as separate nodes rather than semi-colon delimited). It hadn't caused me problems that I had noticed but it definitely was him. I have just pushed up a new version of the NAnt and MSBuild tasks to my website at:
http://www.kiwidude.com/dotnet/NCoverExplorer.Extras.zip

Feel free to give that a go as well to see if it helps with your problem.


Re: NCover from NAnt : Task helped, but no coverage information

Hi Grant

The new version of the tasks (1.3.4.1736) fixed it! =)

It works now either with or without the <assemblies> element in the NAnt task.

I flipped back through the xml generated by the task yesterday. If I omitted <assemblies> from the task it still generated an <Assemblies /> element, which I suppose was interpreted as "analyze nothing." And with the semi-colon delimited list it must not be able to match any of the names properly.

Anyway, this is great! And now I'm going to work on integrating NCover and NCoverExplorer in to our build.

Dave


Re: NCover from NAnt : Task helped, but no coverage information

Great stuff Dave, delighted to hear it's all working for you now. It was a subtle change by Peter I hadn't spotted at the time. If you hit any more roadblocks when you start the NCoverExplorer side of things then of course feel free to post back here although hopefully that's the big hurdle out of the way...