Skip to content

[runtime-diagnostics] Workaround for publish test results regression#124859

Draft
max-charlamb wants to merge 1 commit intodotnet:mainfrom
max-charlamb:runtime-diagnostics-publish-fix
Draft

[runtime-diagnostics] Workaround for publish test results regression#124859
max-charlamb wants to merge 1 commit intodotnet:mainfrom
max-charlamb:runtime-diagnostics-publish-fix

Conversation

@max-charlamb
Copy link
Member

No description provided.

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a workaround for a regression in Azure Pipelines' PublishTestResults@2 task version 2.270.0 (tracked in microsoft/azure-pipelines-tasks#21770). The regression causes the task to incorrectly split xUnit test names on all dots, including those within parenthesized test parameters, resulting in garbled test names in the published results.

Changes:

  • Added PowerShell script steps to preprocess xUnit XML files before publishing test results
  • The script uses regex to replace dots with underscores inside parenthesized sections of test names
  • Applied the workaround to both the cDAC and DAC jobs in the runtime-diagnostics pipeline

Comment on lines 95 to 104
- powershell: |
$xmlFiles = Get-ChildItem '$(Build.SourcesDirectory)/artifacts/TestResults' -Recurse -Filter *.xml -ErrorAction SilentlyContinue
foreach ($file in $xmlFiles) {
$content = Get-Content $file.FullName -Raw
$content = [regex]::Replace($content, '(?<=\bname="[^"]*?\()([^")]+)(?=\))', {
param($m)
$m.Value -replace '\.', '_'
})
Set-Content $file.FullName $content -NoNewline
}
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same PowerShell workaround script is duplicated in two different jobs (lines 95-104 and 142-150). Consider extracting this to a reusable template or separate script file to improve maintainability. If this workaround needs to be updated or removed later when the Azure Pipelines task regression is fixed, you'll need to update it in multiple places.

Copilot uses AI. Check for mistakes.
unpackFolder: $(Build.SourcesDirectory)/artifacts/runtime
displayName: 'Runtime Build Artifacts'
postBuildSteps:
# Workaround for PublishTestResults@2 v2.270.0 regression (microsoft/azure-pipelines-tasks#21770).
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workaround comment at line 141 is incomplete compared to the first occurrence at lines 91-94. The detailed explanation about the regression (splitting test names on dots, the example "SOS.Test(config: foo.10.0.2)" becoming "2)", and the explanation of replacing dots with underscores) is missing. For consistency and clarity, include the full comment here as well.

Suggested change
# Workaround for PublishTestResults@2 v2.270.0 regression (microsoft/azure-pipelines-tasks#21770).
# Workaround for PublishTestResults@2 v2.270.0 regression (microsoft/azure-pipelines-tasks#21770).
# The task started splitting test case names on dots, so a name like
# "SOS.Test(config: foo.10.0.2)" would be truncated to just "2)".
# Replace dots in the parameter portion of xUnit test names with underscores
# before publishing results so the full name is preserved.

Copilot uses AI. Check for mistakes.
Copy xUnit XML test results to Build.StagingDirectory/TestResults using
CopyFiles@2 before PublishTestResults, mirroring the pattern used in
dotnet/diagnostics. This isolates the test results from the source tree
and avoids potential path or file-system differences that may be causing
PublishTestResults v2.270.0 to batch results differently than in the
diagnostics-public-ci pipeline.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@max-charlamb max-charlamb force-pushed the runtime-diagnostics-publish-fix branch from 2a4892c to 25eb1ee Compare February 25, 2026 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants