Build Pipeline, Code Coverage - internal server error
Hello,
I've came across an unusual issue while trying to enable Code coverage for pull requests.
I've enabled codeCoverageEnabled in the VSTest@3 task in my build pipeline and set this pipeline as a Build Validation in target branch policy settings.
After creating a Pull Request, the build validation pipeline executes successfully, but there is no status check sent to the PR and after switching to "Code Coverage" tab in the pipeline run details, the following error can be seen:
There is an internal server error. The code coverage job has failed.
There are no errors in the pipelines logs. All the steps execute properly, unit tests are run and the test report can be seen in the "Tests" tab.
Results File: D:\a\_temp\TestResults\VssAdministrator_fv-az902-812_2025-03-10_16_56_35.trx
Attachments:
D:\a\_temp\TestResults\17e9a4fb-d181-4802-9954-e2f35847ecb3\VssAdministrator_fv-az902-812_2025-03-10.16_57_58.coverage
Test Run Successful.
Total tests: 2403
Passed: 2398
Skipped: 5
Total time: 2.1072 Minutes
Vstest.console.exe exited with code 0.
**************** Completed test execution *********************
Test results files: D:\a\_temp\TestResults\VssAdministrator_fv-az902-812_2025-03-10_16_56_35.trx
Created test run: 1027454
Publishing test results: 2403
Publishing test results to test run '1027454'.
TestResults To Publish 2403, Test run id:1027454
Test results publishing 1000, remaining: 1403. Test run id: 1027454
Test results publishing 1000, remaining: 403. Test run id: 1027454
Test results publishing 403, remaining: 0. Test run id: 1027454
Published test results: 2403
Publishing Attachments: 2
Completed TestExecution Model...
Finishing: Run Unit Tests
The thing is - when running the same pipeline outside the Pull Request, simply by using "Run pipeline" button and choosing the same branch as a resource, the pipeline runs fine and "Code Coverage" tab displays properly, along with the coverage report generated. So the jobs themselves work fine and the coverage report generates fine too.
As there are no errors/warnings in the pipeline logs, I have no idea how to debug and get more information what the actual error is. I suspect it fails in some internal logic when it tries to set PR status...