MicrosoftPremier / VstsExtensions

Documentation and issue tracking for Microsoft Premier Services Visual Studio Team Services Extensions
MIT License
56 stars 14 forks source link

Unable to Perform Coverage Threshold Checks #199

Closed jasonSchroeder89 closed 1 year ago

jasonSchroeder89 commented 1 year ago

I am attempting to add unit-test coverage-threshold checks to a C# WPF application running on .NET 6 being developed by my employer.

We are using Coverlet to perform coverage-threshold checks on our local development machines, and we would like to run the same test in our Azure DevOps pipeline during the PR process to ensure our thresholds are being met. We have not been able to get Coverlet running in the Pipeline, so we added the Build Quality Check extension to our DevOps Org.

I have included the following instructions in our azure-pipelines.yml file, using instructions from another project that I can confirmis generating code-coverage reports in another project; the developer that wrote that pipeline is not longer with the company, and it has fallen to me to try to build upon their work:

  • task: DotNetCoreCLI@2 displayName: Unit test with dotnet inputs: command: 'test' arguments: '--configuration Release --collect:"XPlat Code Coverage"' publishTestResults: true projects: '$(testProject)'

  • script: | dotnet tool install -g dotnet-reportgenerator-globaltool reportgenerator -reports:$(Agent.WorkFolder)/**/coverage.cobertura.xml -targetdir:"$(Build.ArtifactStagingDirectory)/coverlet" -reporttypes:Cobertura displayName: Create code coverage report

  • task: PublishCodeCoverageResults@1 displayName: Publish code coverage report inputs: codeCoverageTool: 'Cobertura' summaryFileLocation: '$(Build.ArtifactStagingDirectory)/coverlet/Cobertura.xml'

  • task: BuildQualityChecks@8 displayName: Check Line Coverage inputs: checkCoverage: true coverageFailOption: 'fixed' coverageType: 'custom' customCoverageType: 'Line' coverageThreshold: '[Current Threshold Redacted]' buildConfiguration: '$(buildConfiguration)' buildPlatform: '$(buildPlatform)'

  • task: BuildQualityChecks@8 displayName: Check Method Coverage inputs: checkCoverage: true coverageFailOption: 'fixed' coverageType: 'custom' customCoverageType: 'Method' coverageThreshold: ''[Current Threshold Redacted]' buildConfiguration: '$(buildConfiguration)' buildPlatform: '$(buildPlatform)'

  • task: BuildQualityChecks@8 displayName: Check Branch Coverage inputs: checkCoverage: true coverageFailOption: 'fixed' coverageType: 'custom' customCoverageType: 'Branch' coverageThreshold: ''[Current Threshold Redacted]' buildConfiguration: '$(buildConfiguration)' buildPlatform: '$(buildPlatform)

The Pipeline fails at the first BuildQualityChecks task, with the following output:

Starting: Check Line Coverage

Task : Build Quality Checks Description : Breaks a build based on quality metrics like number of warnings or code coverage. Version : 8.2.1 Author : Microsoft Help : [Docs]

Using IdentifierJobResolver Validating code coverage policy... Successfully read code coverage data from build. [WARNING] No coverage data matched the specified platform (release) and configuration (any cpu). Please check the values of the build variables $(BuildPlatform) and $(BuildConfiguration) and make sure the same values are used in the reporting options section of the Visual Studio Test task.

[warning]No coverage data matched the specified platform (release) and configuration (any cpu). Please check the values of the build variables $(BuildPlatform) and $(BuildConfiguration) and make sure the same values are used in the reporting options section of the Visual Studio Test task.

Total Line: 0 Covered Line: 0 Code Coverage (%): 0 [ERROR] The code coverage value (0%, 0 Line) is lower than the minimum value ([Current Threshold Redacted]%)!

[error]The code coverage value (0%, 0 Line) is lower than the minimum value ([Current Threshold Redacted]%)!

TF401027: You need the Git 'PullRequestContribute' permission to perform this action. Details: identity 'Build\714ea1c9-c926-45b9-82f5-144e191c420b', scope 'repository'. Error calling API, retrying after 3000 milliseconds. TF401027: You need the Git 'PullRequestContribute' permission to perform this action. Details: identity 'Build\714ea1c9-c926-45b9-82f5-144e191c420b', scope 'repository'. There was an error creating the pull request status. Please ensure that the build account has sufficient permissions (see https://github.com/MicrosoftPremier/VstsExtensions/blob/master/BuildQualityChecks/en-US/PullRequests.md#prerequisites-1)! Finishing: Check Line Coverage

I have redacted the thresholds for privacy reasons, but they are of the form '##.##' corresponding to the coverage values calculated by the Coverlet CLI tool.

Is it possible to use this extension in conjunction with Coverlet, and if so, what modification(s) do I need to make to my pipeline file to perform these checks successfully?

ReneSchumacher commented 1 year ago

Hi @jasonSchroeder89,

what type of test framework are you using? Is it MSTest or XUnit or something else? For MSTest the pipeline might look like this:

steps:
  - task: UseDotNet@2
    displayName: Use .NET 6.x
    inputs:
      version: 6.x

  - task: DotNetCoreCLI@2
    displayName: Build and test solution
    inputs:
      command: test
      projects: Lib.Tests/Lib.Tests.csproj
      configuration: $(BuildConfiguration)
      arguments: '--collect:"XPlat Code Coverage"'
      publishTestResults: true

  - task: PublishCodeCoverageResults@1
    displayName: Publish code coverage
    inputs:
      codeCoverageTool: Cobertura
      summaryFileLocation: '$(Agent.TempDirectory)/*/*cobertura*.xml'

  - task: BuildQualityChecks@8
    displayName: Check code coverage
    inputs:
      checkCoverage: true
      coverageFailOption: fixed
      coverageThreshold: 80

The test step automatically creates the necessary test results and code coverage files in Cobertura format in the agent's temp folder. Unfortunately, the test step does not publish the coverage results. Thus, you have to add a PublishCodeCoverageResult and point it to the agent's temp folder. I'm deliberately using '$(Agent.TempDirectory)/*/*cobertura*.xml' with one asterisk after the variable because the task finds two (identical) coverage files otherwise and issues a warning.

Does that help?

namanimsft commented 1 year ago

We are having the same issues from today morning (PST) onwards. We are using .net 6 and xunit

image
ReneSchumacher commented 1 year ago

@namanimsft Thanks for pointing out the sudden change in behavior. I know that the Azure DevOps teams have changed the coverage backend, and it seems that they have broken something. 😞

According to the task docs, the DotnetCoreCLI task (the one you're using) should automatically publish coverage data with the test results. The log clearly shows that a .coverage file has been uploaded as an attachment:

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
Results File: C:\Agents\AzDO\A1\_work\_temp\AzDoSvc_RENESCHU_2022-12-14_12_54_21.trx

Attachments:
  C:\Agents\AzDO\A1\_work\_temp\740cc58a-5c8f-4225-a049-12bf1e21b538\AzDoSvc_RENESCHU_2022-12-14.12_54_19.coverage
Passed!  - Failed:     0, Passed:     1, Skipped:     0, Total:     1, Duration: 30 ms - Lib.Tests.dll (net6.0)

The BQC log also shows that this attachment triggers something in the backend but coverage data is not correctly evaluated:

##[debug]-------------------- RAW DATA --------------------
##[debug]buildCoverageSummary:
##[debug]{"coverageData":[],"build":{"id":"4148","url":"xxx"},"deltaBuild":null,"status":0}
##[debug]------------------ END RAW DATA ------------------
##[debug]-------------------- RAW DATA --------------------
##[debug]buildCoverageSummary:
##[debug]{"coverageData":[],"build":{"id":"4148","url":"xxx"},"deltaBuild":null,"status":0}
##[debug]------------------ END RAW DATA ------------------
Waiting for code coverage data...
##[debug]-------------------- RAW DATA --------------------
##[debug]buildCoverageSummary:
##[debug]{"coverageData":[],"build":{"id":"4148","url":"xxx"},"deltaBuild":null,"status":1}
##[debug]------------------ END RAW DATA ------------------
Waiting for code coverage data...
##[debug]-------------------- RAW DATA --------------------
##[debug]buildCoverageSummary:
##[debug]{"coverageData":[],"build":{"id":"4148","url":"xxx"},"deltaBuild":null,"status":1}
##[debug]------------------ END RAW DATA ------------------
Waiting for code coverage data...
##[debug]-------------------- RAW DATA --------------------
##[debug]buildCoverageSummary:
##[debug]{"coverageData":[],"build":{"id":"4148","url":"xxx"},"deltaBuild":null,"status":2}
##[debug]------------------ END RAW DATA ------------------
Successfully read code coverage data from build.

The first two raw outputs have status 0, which means that coverage merge job in the backend has not run yet. The next two raw outputs have status 1, which means that coverage merge job is running. And the last raw output has status 2, which means that coverage merge job has finished and Azure DevOps should have valid coverage data. However, the coverageData element is empty.

Afaik, there is no workaround for our own coverage format (.coverage files). As long as you're using Cobertura or JaCoCo coverage format, you could use the manual coverage results publishing step as shown above. I will forward this to the Azure DevOps teams.

marcwmiller commented 1 year ago

Hi Rene-

We've also started experiencing the same failure beginning yesterday, 12/13/2022 at 8:54a EST with no changes having been made to pipeline using .net 6 and xunit.

namanimsft commented 1 year ago

@ReneSchumacher, Use of Cobertura format along with code coverage publish step helped us to unblock for now. Please forward this bug to Azure devops team. thanks!

rasunkar commented 1 year ago

We are looking into this and will update our findings soon

joshidp commented 1 year ago

Any update on this issue?

Thanks!

jasonSchroeder89 commented 1 year ago

@ReneSchumacher Sorry for the delayed response, was on vacation.

I have tried changing our pipeline.yml file to reflect the one in your response, but I am still running into issues with BQC being able to find the coverage report.

Here is our .yml, file, project name redacted for privacy reasons:

trigger:
    - master

pool:
    vmImage: 'windows-latest'

variables:
    solution: '**/*.sln'
    testProject: '**/[PROJECT_NAME].Test/[PROJECT_NAME].Test.csproj'
    BuildPlatform: 'Any CPU'
    BuildConfiguration: 'Release'
    NUGET_PLUGIN_HANDSHAKE_TIMEOUT_IN_SECONDS: 120
    NUGET_PLUGIN_REQUEST_TIMEOUT_IN_SECONDS: 120
    RestoreUseSkipNonexistentTargets: "false"

steps:
- task: NuGetAuthenticate@1
  displayName: Authenticate with Azure Artifacts Feed

- task: UseDotNet@2
  displayName: Use .NET 6.x
  inputs:
    version: 6.x

- task: NuGetToolInstaller@1
  displayName: Install Nuget.exe Tool
  inputs:
    versionSpec: ">=6.4.0-0"

- task: DotNetCoreCLI@2
  displayName: Restore Packages
  inputs:
    command: 'restore'
    feedsToUse: 'select'
    vstsFeed: [FEED_ID_REDACTED]'

- task: MSBuild@1
  displayName: Build Projects
  inputs:
    solution: '$(solution)'
    msbuildVersion: 'latest'
    platform: '$(BuildPlatform)'
    configuration: '$(BuildConfiguration)'

- task: DotNetCoreCLI@2
  displayName: Build and test solution
  inputs:
    command: test
    projects: $(testProject)
    configuration: $(BuildConfiguration)
    platform: $(BuildPlatform)
    arguments: '--collect:"XPlat Code Coverage"'
    publishTestResults: true

- task: PublishCodeCoverageResults@1
  displayName: Publish code coverage
  inputs:
    codeCoverageTool: Cobertura
    summaryFileLocation: '$(Agent.TempDirectory)/*/*cobertura*.xml'
    configuration: $(BuildConfiguration)
    platform: $(BuildPlatform)

- task: BuildQualityChecks@8
  displayName: Check Line Coverage
  inputs:
    checkCoverage: true
    coverageFailOption: 'fixed'
    coverageType: 'lines'
    coverageThreshold: '57.79'
    buildConfiguration: '$(BuildConfiguration)'
    buildPlatform: '$(BuildPlatform)'

- task: BuildQualityChecks@8
  displayName: Check Branch Coverage
  inputs:
    checkCoverage: true
    coverageFailOption: 'fixed'
    coverageType: 'branches'
    coverageThreshold: '61.84'
    buildConfiguration: '$(BuildConfiguration)'
    buildPlatform: '$(BuildPlatform)'

Below is the error message when the pipeline is run:

2022-12-19T21:09:43.3413508Z ##[debug]Evaluating condition for step: 'Check Line Coverage'
2022-12-19T21:09:43.3415324Z ##[debug]Evaluating: SucceededNode()
2022-12-19T21:09:43.3415713Z ##[debug]Evaluating SucceededNode:
2022-12-19T21:09:43.3419420Z ##[debug]=> True
2022-12-19T21:09:43.3420803Z ##[debug]Result: True
2022-12-19T21:09:43.3421572Z ##[section]Starting: Check Line Coverage
2022-12-19T21:09:43.3605687Z ==============================================================================
2022-12-19T21:09:43.3605965Z Task         : Build Quality Checks
2022-12-19T21:09:43.3606231Z Description  : Breaks a build based on quality metrics like number of warnings or code coverage.
2022-12-19T21:09:43.3606461Z Version      : 8.2.1
2022-12-19T21:09:43.3606598Z Author       : Microsoft
2022-12-19T21:09:43.3606889Z Help         : [[Docs]](https://github.com/MicrosoftPremier/VstsExtensions/blob/master/BuildQualityChecks/en-US/overview.md)
2022-12-19T21:09:43.3607220Z ==============================================================================
2022-12-19T21:09:43.4005953Z ##[debug]Using node path: C:\agents\2.213.2\externals\node10\bin\node.exe
2022-12-19T21:09:43.5845724Z ##[debug]agent.TempDirectory=D:\a\_temp
2022-12-19T21:09:43.5871049Z ##[debug]loading inputs and endpoints
2022-12-19T21:09:43.5884992Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
2022-12-19T21:09:43.5902617Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
2022-12-19T21:09:43.5906001Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
2022-12-19T21:09:43.5909294Z ##[debug]loading INPUT_ALLOWCOVERAGEVARIANCE
2022-12-19T21:09:43.5911678Z ##[debug]loading INPUT_ALLOWWARNINGVARIANCE
2022-12-19T21:09:43.5913918Z ##[debug]loading INPUT_BASEDEFINITIONFILTER
2022-12-19T21:09:43.5916287Z ##[debug]loading INPUT_BUILDCONFIGURATION
2022-12-19T21:09:43.5918620Z ##[debug]loading INPUT_BUILDPLATFORM
2022-12-19T21:09:43.5920830Z ##[debug]loading INPUT_CHECKCOVERAGE
2022-12-19T21:09:43.5923042Z ##[debug]loading INPUT_CHECKWARNINGS
2022-12-19T21:09:43.5925476Z ##[debug]loading INPUT_COVERAGEDELTATYPE
2022-12-19T21:09:43.5927712Z ##[debug]loading INPUT_COVERAGEFAILOPTION
2022-12-19T21:09:43.5929836Z ##[debug]loading INPUT_COVERAGEPRECISION
2022-12-19T21:09:43.5931958Z ##[debug]loading INPUT_COVERAGETHRESHOLD
2022-12-19T21:09:43.5934285Z ##[debug]loading INPUT_COVERAGETYPE
2022-12-19T21:09:43.5936482Z ##[debug]loading INPUT_COVERAGEUPPERTHRESHOLD
2022-12-19T21:09:43.5938951Z ##[debug]loading INPUT_CREATEBUILDISSUES
2022-12-19T21:09:43.5941236Z ##[debug]loading INPUT_DISABLECERTCHECK
2022-12-19T21:09:43.5943341Z ##[debug]loading INPUT_EVALUATEFILEWARNINGS
2022-12-19T21:09:43.5945665Z ##[debug]loading INPUT_EVALUATETASKWARNINGS
2022-12-19T21:09:43.5947730Z ##[debug]loading INPUT_EXPLICITFILTER
2022-12-19T21:09:43.5950430Z ##[debug]loading INPUT_FALLBACKONPRTARGETBRANCH
2022-12-19T21:09:43.5952801Z ##[debug]loading INPUT_FORCECOVERAGEIMPROVEMENT
2022-12-19T21:09:43.5955523Z ##[debug]loading INPUT_FORCEFEWERWARNINGS
2022-12-19T21:09:43.5957719Z ##[debug]loading INPUT_IGNOREDECREASEABOVEUPPERTHRESHOLD
2022-12-19T21:09:43.5959832Z ##[debug]loading INPUT_INCLUDEPARTIALLYSUCCEEDED
2022-12-19T21:09:43.5962245Z ##[debug]loading INPUT_INCLUSIVEFILTERING
2022-12-19T21:09:43.5965457Z ##[debug]loading INPUT_SHOWSTATISTICS
2022-12-19T21:09:43.5967789Z ##[debug]loading INPUT_TREAT0OF0AS100
2022-12-19T21:09:43.5971208Z ##[debug]loading INPUT_USEUNCOVEREDELEMENTS
2022-12-19T21:09:43.5972077Z ##[debug]loading INPUT_WARNINGFAILOPTION
2022-12-19T21:09:43.5974718Z ##[debug]loading INPUT_WARNINGFILESARTIFACT
2022-12-19T21:09:43.5976950Z ##[debug]loading INPUT_WARNINGTASKFILTERS
2022-12-19T21:09:43.5979094Z ##[debug]loading INPUT_WARNINGTHRESHOLD
2022-12-19T21:09:43.5997186Z ##[debug]loading SECRET_SYSTEM_ACCESSTOKEN
2022-12-19T21:09:43.6007532Z ##[debug]loaded 35
2022-12-19T21:09:43.6017320Z ##[debug]Agent.ProxyUrl=undefined
2022-12-19T21:09:43.6018190Z ##[debug]Agent.CAInfo=undefined
2022-12-19T21:09:43.6018652Z ##[debug]Agent.ClientCert=undefined
2022-12-19T21:09:43.6022626Z ##[debug]Agent.SkipCertValidation=undefined
2022-12-19T21:09:43.8658043Z ##[debug]createBuildIssues=true
2022-12-19T21:09:43.8659045Z ##[debug]check path : D:\a\_tasks\BuildQualityChecks_16a2ad20-f191-11e5-bed4-ab22bcd17937\8.2.1\task.json
2022-12-19T21:09:43.8659746Z ##[debug]adding resource file: D:\a\_tasks\BuildQualityChecks_16a2ad20-f191-11e5-bed4-ab22bcd17937\8.2.1\task.json
2022-12-19T21:09:43.8660304Z ##[debug]system.culture=en-US
2022-12-19T21:09:43.8670153Z ##[debug]check path : D:\a\_tasks\BuildQualityChecks_16a2ad20-f191-11e5-bed4-ab22bcd17937\8.2.1\node_modules\nodeapihelpers\messages.json
2022-12-19T21:09:43.8671350Z ##[debug]adding resource file: D:\a\_tasks\BuildQualityChecks_16a2ad20-f191-11e5-bed4-ab22bcd17937\8.2.1\node_modules\nodeapihelpers\messages.json
2022-12-19T21:09:43.8671977Z ##[debug]system.culture=en-US
2022-12-19T21:09:43.8682770Z ##[debug]disableCertCheck=false
2022-12-19T21:09:43.8688372Z ##[debug]SystemVssConnection exists true
2022-12-19T21:09:43.8691568Z ##[debug]System.TeamFoundationCollectionUri=[DEVOPS_ORG_REDACTED]
2022-12-19T21:09:43.8726904Z ##[debug]BQC.LogRawData=undefined
2022-12-19T21:09:43.8727822Z ##[debug]Build.Repository.Provider=TfsGit
2022-12-19T21:09:43.8728382Z ##[debug]baseBranchRef=undefined
2022-12-19T21:09:43.8729178Z ##[debug]Build.SourceBranch=refs/heads/add-coverage-threshold-checks
2022-12-19T21:09:43.8729988Z ##[debug]baseDefinitionId=undefined
2022-12-19T21:09:43.8730443Z ##[debug]System.DefinitionId=47
2022-12-19T21:09:43.8732082Z ##[debug]includePartiallySucceeded=true
2022-12-19T21:09:43.8734127Z ##[debug]fallbackOnPRTargetBranch=true
2022-12-19T21:09:43.8737537Z ##[debug]System.TeamProject=[PROJECT_NAME_REDACTED]
2022-12-19T21:09:43.8738395Z ##[debug]System.DefinitionId=47
2022-12-19T21:09:43.8739040Z ##[debug]Build.DefinitionVersion=9
2022-12-19T21:09:43.8739472Z ##[debug]Build.BuildId=4590
2022-12-19T21:09:43.8739933Z ##[debug]PSGer.Build.PollInterval=undefined
2022-12-19T21:09:43.8740671Z ##[debug]PSGer.Build.MaxWaitTime=undefined
2022-12-19T21:09:43.8752723Z ##[debug]Resource file has already set to: D:\a\_tasks\BuildQualityChecks_16a2ad20-f191-11e5-bed4-ab22bcd17937\8.2.1\node_modules\nodeapihelpers\messages.json
2022-12-19T21:09:44.3655580Z ##[debug]System.StageName=__default
2022-12-19T21:09:44.3656219Z ##[debug]System.PhaseDisplayName=Job
2022-12-19T21:09:44.3656670Z ##[debug]System.PhaseName=Job
2022-12-19T21:09:44.3657154Z ##[debug]System.JobId=12f1170f-54f2-53f3-20dd-22fc7dff55f9
2022-12-19T21:09:44.3658348Z ##[debug]System.JobDisplayName=Job
2022-12-19T21:09:44.3659025Z ##[debug]System.JobName=__default
2022-12-19T21:09:44.3659349Z Using IdentifierJobResolver
2022-12-19T21:09:44.3661480Z ##[debug]Resource file has already set to: D:\a\_tasks\BuildQualityChecks_16a2ad20-f191-11e5-bed4-ab22bcd17937\8.2.1\node_modules\nodeapihelpers\messages.json
2022-12-19T21:09:44.3665632Z ##[debug]Build.Repository.Provider=TfsGit
2022-12-19T21:09:44.3666358Z ##[debug]System.PullRequest.PullRequestId=undefined
2022-12-19T21:09:44.3667137Z ##[debug]Build.SourceBranch=refs/heads/add-coverage-threshold-checks
2022-12-19T21:09:44.3667955Z ##[debug]runTitle=undefined
2022-12-19T21:09:44.3668528Z ##[debug]Build.Repository.ID=18e6f3ce-d7f5-4322-b7a3-e9ee021faf50
2022-12-19T21:09:44.3669031Z ##[debug]System.TeamProject=[PROJECT_NAME_REDACTED]
2022-12-19T21:09:44.3670467Z ##[debug]System.CollectionUri=[DEVOPS_ORG_REDACTED]
2022-12-19T21:09:44.3671116Z ##[debug]Build.BuildId=4590
2022-12-19T21:09:44.3671802Z ##[debug]BQC.ForceNewBaseline=undefined
2022-12-19T21:09:44.3672282Z ##[debug]BQC.DisableVariableCreation=undefined
2022-12-19T21:09:44.3672732Z ##[debug]getEnabledPolicies
2022-12-19T21:09:44.3674628Z ##[debug]checkWarnings=false
2022-12-19T21:09:44.3676465Z ##[debug]checkCoverage=true
2022-12-19T21:09:44.3676917Z ##[debug] - coverage
2022-12-19T21:09:44.3680614Z ##[debug]getCurrentJobName
2022-12-19T21:09:44.3682927Z ##[debug]runTitle=undefined
2022-12-19T21:09:44.3685429Z ##[debug]waitForPreviousBuildStepsToFinish
2022-12-19T21:09:44.3688360Z ##[debug]getPreviousBuildSteps
2022-12-19T21:09:44.5800627Z Validating code coverage policy...
2022-12-19T21:09:44.5801674Z ##[debug]System.TeamProject=[PROJECT_NAME_REDACTED]
2022-12-19T21:09:44.5802159Z ##[debug]Build.BuildId=4590
2022-12-19T21:09:44.5804194Z ##[debug]CoverageValueReader.getCoverageValue
2022-12-19T21:09:44.5805204Z ##[debug]Build.BuildId=4590
2022-12-19T21:09:44.5805901Z ##[debug]CoverageValueReader.getCodeCoverageSummaryFromBuild
2022-12-19T21:09:44.5808045Z ##[debug]getCodeCoverageData
2022-12-19T21:09:44.5808915Z ##[debug]prepareClients
2022-12-19T21:09:48.2257601Z Successfully read code coverage data from build.
2022-12-19T21:09:48.2259051Z ##[debug]CoverageValueReader.filterCoverageDataByConfigAndPlatform
2022-12-19T21:09:48.2262241Z ##[debug]buildConfiguration=Release
2022-12-19T21:09:48.2264204Z ##[debug]buildPlatform=Any CPU
2022-12-19T21:09:48.2266391Z ##[debug]explicitFilter=false
2022-12-19T21:09:48.2267032Z ##[debug]Inspecting 1 code coverage data sets...
2022-12-19T21:09:48.2269659Z [WARNING] No coverage data matched the specified platform (release) and configuration (any cpu). Please check the values of the build variables $(BuildPlatform) and $(BuildConfiguration) and make sure the same values are used in the reporting options section of the Visual Studio Test task.
2022-12-19T21:09:48.2302825Z ##[warning]No coverage data matched the specified platform (release) and configuration (any cpu). Please check the values of the build variables $(BuildPlatform) and $(BuildConfiguration) and make sure the same values are used in the reporting options section of the Visual Studio Test task.
2022-12-19T21:09:48.2313577Z ##[debug]Processed: ##vso[task.logissue type=warning;]No coverage data matched the specified platform (release) and configuration (any cpu). Please check the values of the build variables $(BuildPlatform) and $(BuildConfiguration) and make sure the same values are used in the reporting options section of the Visual Studio Test task.
2022-12-19T21:09:48.2315586Z ##[debug]CoverageValueReader.aggregateCoverageValues
2022-12-19T21:09:48.2316394Z ##[debug]coverageType=lines
2022-12-19T21:09:48.2316897Z ##[debug]CoverageValueReader.calculateCoveragePercentageWithPrecision
2022-12-19T21:09:48.2425040Z ##[debug]coveragePrecision=4
2022-12-19T21:09:48.2426553Z ##[debug]coverageVariance=undefined
2022-12-19T21:09:48.2427375Z ##[debug]treat0of0as100=false
2022-12-19T21:09:48.2428121Z ##[debug]treat0of0as100=false
2022-12-19T21:09:48.2428633Z Total lines: 0
2022-12-19T21:09:48.2428983Z Covered lines: 0
2022-12-19T21:09:48.2429353Z Code Coverage (%): 0
2022-12-19T21:09:48.2429969Z ##[debug]coverageFailOption=fixed
2022-12-19T21:09:48.2430816Z ##[debug]FixedCoverageThresholdRule.isFulfilledImpl
2022-12-19T21:09:48.2431676Z ##[debug]coverageThreshold=57.79
2022-12-19T21:09:48.2432368Z [ERROR] The code coverage value (0%, 0 lines) is lower than the minimum value (57.79%)!
2022-12-19T21:09:48.2433800Z ##[error]The code coverage value (0%, 0 lines) is lower than the minimum value (57.79%)!
2022-12-19T21:09:48.2435049Z ##[debug]Processed: ##vso[task.logissue type=error;]The code coverage value (0%, 0 lines) is lower than the minimum value (57.79%)!
2022-12-19T21:09:48.2436138Z ##[debug]set CodeCoveragePolicy.Result=failed
2022-12-19T21:09:48.2445386Z ##[debug]Processed: ##vso[task.setvariable variable=CodeCoveragePolicy.Result;isOutput=false;issecret=false;]failed
2022-12-19T21:09:48.2446664Z ##[debug]CodeCoveragePolicy.createOutputVariables
2022-12-19T21:09:48.2447578Z ##[debug]set CodeCoveragePolicyResult=failed
2022-12-19T21:09:48.2449328Z ##[debug]Processed: ##vso[task.setvariable variable=CodeCoveragePolicyResult;isOutput=false;issecret=false;]failed
2022-12-19T21:09:48.2450369Z ##[debug]set CodeCoveragePolicy.Elements.Total=0
2022-12-19T21:09:48.2452095Z ##[debug]Processed: ##vso[task.setvariable variable=CodeCoveragePolicy.Elements.Total;isOutput=false;issecret=false;]0
2022-12-19T21:09:48.2453228Z ##[debug]set CodeCoveragePolicy.Elements.Covered=0
2022-12-19T21:09:48.2455214Z ##[debug]Processed: ##vso[task.setvariable variable=CodeCoveragePolicy.Elements.Covered;isOutput=false;issecret=false;]0
2022-12-19T21:09:48.2456221Z ##[debug]set CodeCoveragePolicy.Elements.Uncovered=0
2022-12-19T21:09:48.2457848Z ##[debug]Processed: ##vso[task.setvariable variable=CodeCoveragePolicy.Elements.Uncovered;isOutput=false;issecret=false;]0
2022-12-19T21:09:48.2458869Z ##[debug]set CodeCoveragePolicy.Percentage.Covered=0
2022-12-19T21:09:48.2460490Z ##[debug]Processed: ##vso[task.setvariable variable=CodeCoveragePolicy.Percentage.Covered;isOutput=false;issecret=false;]0
2022-12-19T21:09:48.2461522Z ##[debug]set CodeCoveragePolicy.Percentage.Uncovered=0
2022-12-19T21:09:48.2463133Z ##[debug]Processed: ##vso[task.setvariable variable=CodeCoveragePolicy.Percentage.Uncovered;isOutput=false;issecret=false;]0
2022-12-19T21:09:48.2464181Z ##[debug]set CodeCoveragePolicy.Elements.Label=lines
2022-12-19T21:09:48.2465841Z ##[debug]Processed: ##vso[task.setvariable variable=CodeCoveragePolicy.Elements.Label;isOutput=false;issecret=false;]lines
2022-12-19T21:09:48.2466769Z ##[debug]setTaskResult
2022-12-19T21:09:48.2467514Z ##[debug]Agent.TempDirectory=D:\a\_temp
2022-12-19T21:09:48.2475617Z ##[debug]Processed: ##vso[task.addattachment type=Distributedtask.Core.Summary;name=Build Quality Checks;]D:\a\_temp\BuildQualityChecksSummary.md
2022-12-19T21:09:48.2476358Z ##[debug]createBuildIssues=true
2022-12-19T21:09:48.2476794Z ##[debug]task result: Failed
2022-12-19T21:09:48.2478063Z ##[debug]Processed: ##vso[task.complete result=Failed;]
2022-12-19T21:09:48.2480235Z ##[section]Finishing: Check Line Coverage
ReneSchumacher commented 1 year ago

Hi @jasonSchroeder89 and happy new year!

Please remove the buildConfiguration and buildPlatform settings from the task. Cobertura format does not associate configuration and platform.

Marius-du-Toit commented 1 year ago

Any updates on this issue?

ReneSchumacher commented 1 year ago

Hi all,

sorry for the delay over the holiday season. To my knowledge, the issue was resolved. Apparently, some changes were not properly applied across all Azure DevOps scale units, which corrected itself after a while. At least for my repro pipelines, everything seems to be back to normal, so I'm closing this issue now.

If you are still facing this issue, please feel free to add a comment or open a new issue.