0

I am currently loosing it about the attempt to generate test coverage reports for a current Corpo project. This worked flawlessly quite some time and is now running wild.

The tests are done using MSTest projects in VS. For coverage collection I am using dotnet-coverage and for report generation I am using the reportgenerator globaltool.

The coverage is collected via dotnet-coverage collect -f cobertura -o coverage.xml dotnet test in the solutions root and the report is generated via reportgenerator -reports:.\coverage.xml -targetdir:.\CoverageReport.

And for a while now, when running the reportgenerator, it sometimes complains about:

File '/_/src/Analyzers/MSTest.Ananlyzers...' does not exist (any more).

like so:

PS D:\Repos\esales-conwinconnect> reportgenerator -reports:.\coverage.xml -targetdir:.\CoverageReport
2025-09-08T12:04:55: Arguments
2025-09-08T12:04:55:  -reports:.\coverage.xml
2025-09-08T12:04:55:  -targetdir:.\CoverageReport
2025-09-08T12:04:57: File '/_/src/Analyzers/MSTest.Analyzers/RoslynAnalyzerHelpers/BoundedCacheWithFactory.cs' does not exist (any more).
2025-09-08T12:04:57: File '/_/src/Analyzers/MSTest.Analyzers/RoslynAnalyzerHelpers/BoundedCacheWithFactory.cs' does not exist (any more).
2025-09-08T12:04:57: File '/_/src/Analyzers/MSTest.Analyzers/RoslynAnalyzerHelpers/CompilationExtensions.cs' does not exist (any more).
...
2025-09-08T12:04:58: File '/_/src/Analyzers/MSTest.Analyzers.CodeFixes/UseNewerAssertThrowsFixer.cs' does not exist (any more).
2025-09-08T12:04:58: File '/_/src/Analyzers/MSTest.Analyzers.CodeFixes/UseProperAssertMethodsFixer.cs' does not exist (any more).
2025-09-08T12:04:58: Writing report file '.\CoverageReport\index.html'
2025-09-08T12:04:58: Report generation took 3,3 seconds
PS D:\Repos\esales-conwinconnect>

Well, no wonder, it should not, since it's no part of the projects. I just can't graps how dotnet-coverage jumps to the conclusion this assemblies and namespaces should be considered in its reporting and it's driving me nuts, especially since these seemingly missing namespaces and classes are - of course - mostly uncovered and are thereby pulling down the coverage.

By sometimes I mean that it actually can occur that I go and delete the XML, delete the output folder, run it again, and it doesn't contain the unwanted namespaces, like so:

PS D:\Repos\esales-conwinconnect> reportgenerator -reports:.\coverage.xml -targetdir:.\CoverageReport
2025-09-08T12:42:02: Arguments
2025-09-08T12:42:02:  -reports:.\coverage.xml
2025-09-08T12:42:02:  -targetdir:.\CoverageReport
2025-09-08T12:42:04: Writing report file '.\CoverageReport\index.html'
2025-09-08T12:42:05: Report generation took 2,5 seconds
PS D:\Repos\esales-conwinconnect>

As you can see, these two runs are merely 40 minutes apart from each other, with nothing changed in between, this was when I wrote this post you are reading. And I cannot figure out when it does and when it does not work.

MSTest.Analyzers is not a direct nuget dependency of the project, but is a transitive dependency of MSTest.Testframework, which in turn is a dependency of the test projects. But I cannot see how this results in the coverage tool taking them into account.

I have already tried to supply the assemblyFilter:-MSTest.* option to the reportgenerator, but this does not seem to do anything, the errors still persist.

3
  • The Test coverage Report has a standard list of items to report. It looks like some of the items in the report doesn't exist in your project. It looks like the report output message are not clear and instead of saying there are zero items in the report is says the file doesn't exist. Commented Sep 8 at 12:08
  • Well, this still does not explain the flakiness of working sometimes. Do you by any chance know where this standard list of items is defined? Commented Sep 9 at 7:15
  • Here is the homepage : learn.microsoft.com/en-us/dotnet/core/testing/mstest-analyzers/… Commented Sep 9 at 9:30

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.