FineCodeCoverage icon indicating copy to clipboard operation
FineCodeCoverage copied to clipboard

Doesn't work at all.

Open kkohler2 opened this issue 2 years ago • 22 comments

Installed product versions

  • Visual Studio: 2022 (17.8.6)
  • This extension: 1.1.209

Description

Installed extension, opened project, built it, ran code coverage for solution. No results!

Steps to recreate

  1. Start Visual Studio
  2. Install extension Fine Code Coverage
  3. Close Visual Studio to let extension get installed
  4. Restart Visual Studio
  5. Open project
  6. Build solution
  7. Build/Run Code Analysis on Solution

Current behavior

Results of summary image

Expected behavior

Results window will actually show results. Lines covered or not covered will be indicated with the colors on left side of window.

Side Notes

I tried with a MAUI app that has NUnit tests and a ASP.NET WebService with XUnit tests. Same results for both.

kkohler2 avatar Feb 01 '24 16:02 kkohler2

What do you see in the FCC output window ?

tonyhallett avatar Feb 01 '24 18:02 tonyhallett

Also see #347

tonyhallett avatar Feb 01 '24 18:02 tonyhallett

Build/Run Code Analysis on Solution

So you haven't run any tests ?

tonyhallett avatar Feb 02 '24 22:02 tonyhallett

I have this same issue after running tests. I have about 130 tests. I see the following: image

but when I click a different tab: image

According to the tutorial I watched it should generate the report when I run my tests (it does not.) I have also went up to Test > Analyze Code Coverage For All Tests and this gives me nothing as well.

nevernerdlet avatar Feb 09 '24 17:02 nevernerdlet

@nevernerdlet Looks like a different issue - Build/Run Code Analysis on Solution will never produce a report - you have at least run some tests. Any chance you can share your project ? The log from the FCC Output Window Pane ?

tonyhallett avatar Feb 09 '24 19:02 tonyhallett

What options have you set ?

tonyhallett avatar Feb 09 '24 19:02 tonyhallett

@nevernerdlet Looks like a different issue - Build/Run Code Analysis on Solution will never produce a report - you have at least run some tests. Any chance you can share your project ? The log from the FCC Output Window Pane ?

Log output is below. The file it's referencing is in the bin folder of one of the 4 test projects (not sure why it's not mentioning all 4 here either) and if I go to that file, it's empty. The real file with actual unit test info seems to reside in the TestResults folder inside the project folder, not in bin.

Log output:

Fine Code Coverage 2/12/2024 1:21:48 PM: Ms code coverage Fine Code Coverage 2/12/2024 1:22:24 PM: ReportGenerator Run Arguments [reporttype:Cobertura] "-targetdir:D:\GITWorkspace\Services\CQRS.Core\Query.Policy.Core.Test\bin\x64\Debug\fine-code-coverage\coverage-tool-output" "-reports:D:\GITWorkspace\Services\CQRS.Core\Query.Policy.Core.Test\bin\x64\Debug\fine-code-coverage\coverage-tool-output\bf274536-b7f5-482c-8183-71834189532a\cjchambers_GLBCJCV01_2024-02-12.13_21_49.cobertura.xml" "-reporttypes:Cobertura" Fine Code Coverage 2/12/2024 1:22:25 PM: ReportGenerator Run [reporttype:Cobertura] 2024-02-12T13:22:24: Arguments 2024-02-12T13:22:24: -targetdir:D:\GITWorkspace\Services\CQRS.Core\Query.Policy.Core.Test\bin\x64\Debug\fine-code-coverage\coverage-tool-output 2024-02-12T13:22:24: -reports:D:\GITWorkspace\Services\CQRS.Core\Query.Policy.Core.Test\bin\x64\Debug\fine-code-coverage\coverage-tool-output\bf274536-b7f5-482c-8183-71834189532a\cjchambers_GLBCJCV01_2024-02-12.13_21_49.cobertura.xml 2024-02-12T13:22:24: -reporttypes:Cobertura 2024-02-12T13:22:25: Writing report file 'D:\GITWorkspace\Services\CQRS.Core\Query.Policy.Core.Test\bin\x64\Debug\fine-code-coverage\coverage-tool-output\Cobertura.xml' 2024-02-12T13:22:25: Report generation took 0.2 seconds Fine Code Coverage 2/12/2024 1:22:25 PM: ReportGenerator Run Arguments [reporttype:HtmlInline_AzurePipelines] "-targetdir:D:\GITWorkspace\Services\CQRS.Core\Query.Policy.Core.Test\bin\x64\Debug\fine-code-coverage\coverage-tool-output" "-reports:D:\GITWorkspace\Services\CQRS.Core\Query.Policy.Core.Test\bin\x64\Debug\fine-code-coverage\coverage-tool-output\Cobertura.xml" "-plugins:c:\users\cjchambers\appdata\local\microsoft\visualstudio\17.0_225e66af\extensions\2jra3ack.zvd\ReportGeneratorPlugins.dll" "-reporttypes:FccLight" "riskHotspotsAnalysisThresholds:metricThresholdForCyclomaticComplexity=30" "riskHotspotsAnalysisThresholds:metricThresholdForCrapScore=15" "riskHotspotsAnalysisThresholds:metricThresholdForNPathComplexity=200" Fine Code Coverage 2/12/2024 1:22:26 PM: ReportGenerator Run [reporttype:HtmlInline_AzurePipelines] 2024-02-12T13:22:25: Arguments 2024-02-12T13:22:25: -targetdir:D:\GITWorkspace\Services\CQRS.Core\Query.Policy.Core.Test\bin\x64\Debug\fine-code-coverage\coverage-tool-output 2024-02-12T13:22:25: -reports:D:\GITWorkspace\Services\CQRS.Core\Query.Policy.Core.Test\bin\x64\Debug\fine-code-coverage\coverage-tool-output\Cobertura.xml 2024-02-12T13:22:25: -plugins:c:\users\cjchambers\appdata\local\microsoft\visualstudio\17.0_225e66af\extensions\2jra3ack.zvd\ReportGeneratorPlugins.dll 2024-02-12T13:22:25: -reporttypes:FccLight 2024-02-12T13:22:25: riskHotspotsAnalysisThresholds:metricThresholdForCyclomaticComplexity=30 2024-02-12T13:22:25: riskHotspotsAnalysisThresholds:metricThresholdForCrapScore=15 2024-02-12T13:22:25: riskHotspotsAnalysisThresholds:metricThresholdForNPathComplexity=200 2024-02-12T13:22:26: Writing report file 'D:\GITWorkspace\Services\CQRS.Core\Query.Policy.Core.Test\bin\x64\Debug\fine-code-coverage\coverage-tool-output\index.html' 2024-02-12T13:22:26: Report generation took 0.2 seconds Fine Code Coverage 2/12/2024 1:22:26 PM: Processing cobertura Fine Code Coverage 2/12/2024 1:22:26 PM: Processing report Fine Code Coverage 2/12/2024 1:22:26 PM: ================================== DONE ==================================

nevernerdlet avatar Feb 12 '24 19:02 nevernerdlet

What options have you set ?

Options. I think these were default, I'm not sure. I tried to customize which projects it would collect on and that was sorta the last I ever saw anything work right. So I uninstalled the extension, rebooted and reinstalled.

D:\GITWorkspace\Services\CQRS.Core\Query.Policy.Core.Test\bin\x64\Debug\fine-code-coverage\coverage-tool-output C:\Users\cjchambers\AppData\Local\FineCodeCoverage\msCodeCoverage\17.1.0\build\netstandard1.0 False D:\\GITWorkspace\\Services\\CQRS.Core\\Query.Policy.Core.Test\\bin\\x64\\Debug\\IML.BAL.CQRS.Core.Query.Policy.Core.Test.dll .*\.dll$ True True True False Cobertura

nevernerdlet avatar Feb 12 '24 19:02 nevernerdlet

Can you show the contents of the cobertura file ? What programming language are you using ?

tonyhallett avatar Feb 12 '24 20:02 tonyhallett

Are you supplying a runsettings ?

tonyhallett avatar Feb 12 '24 20:02 tonyhallett

Can you show the contents of the cobertura file ? What programming language are you using ?

c#. .net 7 Visual studio version: 17.8.5

Cobertura file:

This is the one it seems to be looking at: D:\GITWorkspace\Services\CQRS.Core\Query.Policy.Core.Test\bin\x64\Debug\fine-code-coverage\coverage-tool-output\Cobertura.xml

Contents:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
<coverage line-rate="1" branch-rate="1" lines-covered="0" lines-valid="0" branches-covered="0" branches-valid="0" complexity="NaN" version="0" timestamp="1707749945">
  <sources />
  <packages />
</coverage>

There should be one in each test project, but there is not, only this one. And it should not be empty. I have 130 tests. 121 pass, 9 fail.

I DO NOT have a runsettings file. I had one, but deleted it in case it was causing the problem. I'm basically just trying to hit out of the box functionality right now.

nevernerdlet avatar Feb 12 '24 21:02 nevernerdlet

There will be only one cobertura with ms code coverage. Agreed it should not be empty. Can you share your solution with me ?

tonyhallett avatar Feb 12 '24 21:02 tonyhallett

There should also be a generated runsettings file. If you can post that.

tonyhallett avatar Feb 12 '24 21:02 tonyhallett

There will be only one cobertura with ms code coverage. Agreed it should not be empty. Can you share your solution with me ?

I'm sorry I cannot. It's an ADO private repo and my company has specific company guidelines concerning this. Is there anything else I can do? I could try to set up a similar project of 5 or 6 microservice api's with generic code and no sensitive anything and see if it happens then. In fact I have some other .net core projects I can try this in, as we have tests in our DAL project, our class library and in our only .net core UI project. My only issue - if it works in those projects, I don't know what that means other than something is clearly wrong in this service layer project.

nevernerdlet avatar Feb 12 '24 21:02 nevernerdlet

There should also be a generated runsettings file. If you can post that.

Looks like there is a generated one in every webapi project bin\x64\Debug\fine-code-coverage\coverage-tool-output folder and here is one:

<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
  <RunConfiguration>
    <ResultsDirectory>D:\GITWorkspace\Services\CQRS.Core\Query.Policy.Core.Test\bin\x64\Debug\fine-code-coverage\coverage-tool-output</ResultsDirectory>
    <TestAdaptersPaths>C:\Users\cjchambers\AppData\Local\FineCodeCoverage\msCodeCoverage\17.1.0\build\netstandard1.0</TestAdaptersPaths>
    <CollectSourceInformation>False</CollectSourceInformation>
  </RunConfiguration>
  <DataCollectionRunSettings>
    <DataCollectors>
      <DataCollector friendlyName="Code Coverage" enabled="True">
        <Configuration>
          <CodeCoverage>
            <ModulePaths>
              <Exclude>
                <ModulePath>D:\\GITWorkspace\\Services\\CQRS.Core\\Query.Policy.Core.Test\\bin\\x64\\Debug\\IML.BAL.CQRS.Core.Query.Policy.Core.Test.dll</ModulePath>
                <ModulePath>.*\.dll$</ModulePath>
              </Exclude>
              <Include></Include>
            </ModulePaths>
            <Functions>
              <Exclude></Exclude>
              <Include></Include>
            </Functions>
            <Attributes>
              <Exclude></Exclude>
              <Include></Include>
            </Attributes>
            <Sources>
              <Exclude></Exclude>
              <Include></Include>
            </Sources>
            <CompanyNames>
              <Exclude></Exclude>
              <Include></Include>
            </CompanyNames>
            <PublicKeyTokens>
              <Exclude></Exclude>
              <Include></Include>
            </PublicKeyTokens>
            <UseVerifiableInstrumentation>True</UseVerifiableInstrumentation>
            <AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses>
            <CollectFromChildProcesses>True</CollectFromChildProcesses>
            <CollectAspDotNet>False</CollectAspDotNet>
          </CodeCoverage>
          <Format>Cobertura</Format>
          <FCCGenerated />
        </Configuration>
      </DataCollector>
    </DataCollectors>
  </DataCollectionRunSettings>
</RunSettings>

nevernerdlet avatar Feb 12 '24 21:02 nevernerdlet

You are excluding all DLLs without any includes

tonyhallett avatar Feb 12 '24 21:02 tonyhallett

You are excluding all DLLs without any includes

I see what you are saying. Here is my issue - I didn't set that. And the only place I know to edit it is in the Tools > Options > Fine Code Coverage > General

There is nothing in those options that I see that is causing the runsettings file to generate that way. Or am I misunderstanding the role of these options?

image

nevernerdlet avatar Feb 12 '24 22:02 nevernerdlet

Do you have a finecodecoverage-settings.xml from before or entries in your csproj ? There does seem to be an entry in ExcludeAssemblies but I doubt it is that.

tonyhallett avatar Feb 12 '24 22:02 tonyhallett

You have set IncludeReferencedProjects but there are no includes. This seems odd.

tonyhallett avatar Feb 12 '24 22:02 tonyhallett

Actually it could be from that empty array. Will check tomorrow.

tonyhallett avatar Feb 12 '24 23:02 tonyhallett

<ModulePath>.*\.dll$</ModulePath> is due to the whitespace in ExcludeAssemblies. I will change the source to ignore whitespace.

tonyhallett avatar Feb 13 '24 09:02 tonyhallett

<ModulePath>.*\.dll$</ModulePath> is due to the whitespace in ExcludeAssemblies. I will change the source to ignore whitespace.

That makes sense. Thanks! I really appreciate your assistance in this!

nevernerdlet avatar Feb 13 '24 18:02 nevernerdlet

fixed - available in version 1.1.213 available shortly in the visual studio marketplace

tonyhallett avatar Mar 12 '24 13:03 tonyhallett