#17 Fails to generate report with large project

v4.0 (latest)
open-accepted
nobody
6
2010-07-13
2010-07-13
Gavin
No

Hi,

I am using the latest version for .NET 4.0 with NUnit 2.5.5 (using the /framework=4.0.30319 arg for NUnit). On small projects (i.e. simple tests that execute quickly), it seems to work fine. On a larger project that I have ported over, the command line sometimes fails. It seems that the code that waits for the external process to finish (in my case, nunit) attempts to generate the report too early (sometimes causing errors with invalid handles and sometimes generating an empty report).

I have done a bit of digging around in the source code and have managed to get it working consistently by adding a slight delay after the external process is complete (but before the statistics are gathered).

In Connector.cs - around line 76:

System.Threading.Thread.Sleep(1000);
connector.WaitForResults(options.DelayClose);
System.Threading.Thread.Sleep(1000);

This is an incredibly nasty hack - but it's working for me at the moment. I'm not a profiling expert but is it possible to respond to an event raised by the CLR profiler to know when the process is complete rather than polling the process and waiting for a return code? (it may do this already)

Thanks!

Gav

Discussion

  • Shaun Wilde

    Shaun Wilde - 2010-07-13

    Hi Gav

    Can you give me an idea of what is a large project?
    i.e. number of tests, number of lines of code, time to execute and/or other metrics you consider relevant; as I'll need to try and replicate the issue before I can attempt to fix it.

    Shaun

     
  • Shaun Wilde

    Shaun Wilde - 2010-07-13
    • priority: 5 --> 6
    • status: open --> open-accepted
     
  • Shaun Wilde

    Shaun Wilde - 2010-07-13

    Also if it does die could you provide dumps of the console output?

     
  • Gavin

    Gavin - 2010-07-14

    Hi,

    I have spent the last few hours trying to replicate my problem on a trivial project without success. What is even more frustrating is that even my large project *sometimes* generates the correct output (I am using a CPU stress-tester and it does seem to fail more often when the CPU is highly stressed). One of the differences between my "real" project and my trivial test project is that my real project uses a combination of assemblies built for .NET 2.0/3.5/4.0 and a few COM objects - not sure if this could be interfering in some way.

    In terms of errors, when the report is not generatd correctly there are no errors reported on the command line - the resulting xml file only contains a single line (i.e. the result root element).

    I am happy for you to close this ticket until I can give you more info - I can open another one if I am able to reproduce the issue consistently and can attach a sample project.

    Cheers,

    Gav

     
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2010-08-16

    Hi,

    We are also having this problem in our shop, although the sleep doesn't seem to work on our projects. I have got it to work, by using a batch file instead of the nunit.exe and putting a sleep at the end of the batch file.

    We are also using NUnit 2.5.5 with .NET 4. We also have observed something which may be of assistance in diagnosing something.

    We seem to only have this problem on machines that are running multi-core processors on Win7. We have another series of machines that are XP with single cores and they work fine with exactly the same source and configuration (NUnit 2.5.5, .NET4)

    This leads me to believe it's probably that NUnit is doing some multithreading that PartCover isn't waiting to complete (which is why the sleep fixes it for more complex projects).

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks