OpenCover / opencover

A code coverage tool for .NET 2 and above (WINDOWS OS only), support for 32 and 64 processes with both branch and sequence points
https://blog.many-monkeys.com
Other
1.31k stars 248 forks source link

OpenCover seems to be stuck in an infinite loop #889

Closed SeppPenner closed 5 years ago

SeppPenner commented 5 years ago

My Framework

My Environment

I have already...

My issue is related to (check only those which apply):

Expected Behavior

Generate a coveragexml file from the test project's dll.

Actual Behavior

Stuck in some infinite loop?

Steps to reproduce the problem:

Further information:

sawilde commented 5 years ago

@SeppPenner if you can supply a repeatable example I may be able to help.

OpenCover waits on events i.e. the child process to stop etc so it doesn't terminate too soon. However sometimes it does not get these events. You could try running DebugView at the same time as OpenCover and see if anything useful is emitted - YMMV.

There are a number of switches that may help

  1. -log:All to increase the verbosity of the logging
  2. -communicationtimeout:<millseconds> between 10000 and 60000 - how long to wait for messages from the target process(es).
SeppPenner commented 5 years ago

@sawilde I will try these and provide some results.

SeppPenner commented 5 years ago

I ran the programm like that:

OpenCover.Console.Exe -target:"C:\program files\dotnet\dotnet.exe" -targetargs:"test \"src\Example\Example.Tests.csproj\" --configuration Debug --no-build" -output:"src\TestResults\Example.coveragexml" -oldstyle -register:user -log:All

@sawilde I've added two new files (log.txt which contains the logging from OpenCover with -log:All and DebugView.log which contains the logging from the DebugView) to the gist: https://gist.github.com/SeppPenner/21aff2363dfb15baf026f68e9cac7e45.

@SeppPenner if you can supply a repeatable example I may be able to help.

The problem is that the project is not open source and I'm not allowed to share it. Maybe you can find something that helps in the logs. This issue occured since I updated from .NetCore 2.2.106 to .NetCore 2.2.203 while I'm not completely sure if it's related to this update.

All .Net versions installed:

image

sawilde commented 5 years ago

First I would look to add some filters so that you only get coverage of what you need - this will also speed things up as you will not be instrumenting code that is not yours. e.g. -filters:"+[MyProject*]* -[*Test*]*"

SeppPenner commented 5 years ago

@sawilde I will try that, too.

SeppPenner commented 5 years ago

@sawilde I will need to re-check this again, but it seems like the filters have helped a lot (Seems like I was loading to much references into the project and OpenCover simply took ages to calculate this and ran into timeouts.)

SeppPenner commented 5 years ago

Ok, I'm not seeing the issue with the project again. Thank you for the support.

sawilde commented 5 years ago

@SeppPenner thanks for the update and glad you've got it going.