Fix UTF-16 encoded log files in Windows CI test runs#15772
Merged
Conversation
…ndows Agent-Logs-Url: https://github.com/microsoft/aspire/sessions/9dbdcbad-9659-47f2-981c-b58d0d3923e2 Co-authored-by: karolz-ms <15271049+karolz-ms@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix log files to be saved in UTF-8 format instead of UTF-16
Fix UTF-16 encoded log files in Windows CI test runs
Apr 1, 2026
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 15772Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 15772" |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the test/CI infrastructure to ensure logs generated on Windows are written using UTF-8 (instead of UTF-16 or console-codepage-dependent encodings), improving cross-platform readability of collected artifacts.
Changes:
- MSBuild: explicitly set
Encoding="UTF-8"forWriteLinesToFilewhen writing command headers to test stdout logs. - MSBuild: replace
cmd.exeecho > fileheader writing withWriteLinesToFile+ UTF-8 encoding. - PowerShell & CI: ensure Windows workflow/script output files are written in UTF-8 and set Windows console/code page to UTF-8 for Helix/GitHub Actions runs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/helix/send-to-helix-inner.proj | Adds a Windows Helix pre-command to switch console code page to UTF-8. |
| eng/Xunit3/Microsoft.Testing.Platform.targets | Forces UTF-8 when writing the command-line header into captured stdout logs. |
| eng/SpecializedTestRunsheetBuilderBase.targets | Replaces echo-based header writing with WriteLinesToFile using UTF-8. |
| eng/scripts/cli-starter-validation.ps1 | Writes combined logs and stop logs explicitly as UTF-8 to avoid UTF-16 defaults. |
| .github/workflows/run-tests.yml | Sets console output encoding to UTF-8 for Windows test steps. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
radical
approved these changes
Apr 2, 2026
Contributor
|
🎬 CLI E2E Test Recordings — 55 recordings uploaded (commit View recordings
📹 Recordings uploaded automatically from CI run #23913983842 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Log files produced during Windows CI runs were being saved in UTF-16 format, making them unreadable by default on Linux/macOS. Several independent encoding issues across the test infrastructure were contributing to this.
Root causes & fixes
eng/Xunit3/Microsoft.Testing.Platform.targets—WriteLinesToFilewithoutEncoding="UTF-8"defaults to UTF-16 on older MSBuild versions (pre-17.3.4). Added explicitEncoding="UTF-8".eng/SpecializedTestRunsheetBuilderBase.targets— Usedcmd.exeecho ... > fileto write the command header, which inherits the current console code page (non-UTF-8 by default on Windows). Replaced withWriteLinesToFilewithEncoding="UTF-8", consistent with the pattern inMicrosoft.Testing.Platform.targets.eng/scripts/cli-starter-validation.ps1— Used*>redirect andSet-Contentwithout encoding, which defaults to UTF-16 in Windows PowerShell 5.1. Changed to*>&1 | Out-File -Encoding utf8and-Encoding utf8on allSet-Contentcalls.tests/helix/send-to-helix-inner.proj— Addedchcp 65001as a Windows Helix pre-command to set the console code page to UTF-8 before any test execution..github/workflows/run-tests.yml— Added[Console]::OutputEncoding = [System.Text.Encoding]::UTF8in both Windows test steps before invoking the test runner.Checklist
<remarks />and<code />elements on your triple slash comments?aspire.devissue: