Skip to content

chore(package): regenerate installer strings in LF checkouts - #2149

Merged
Benoît Cortier (CBenoit) merged 2 commits into
masterfrom
fix/installer-localization-lf
Oct 25, 2026
Merged

Benoît Cortier (CBenoit) merged 2 commits into
masterfrom
fix/installer-localization-lf

Conversation

@CBenoit

@CBenoit Benoît Cortier (CBenoit) commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

TextTransform.exe fails with CS1519 when the template has LF line endings, which is what a checkout with core.autocrlf=input or false produces, since Strings.g.tt has no eol attribute. T4 then replaces Strings.g.cs with ErrorGeneratingOutput, so the failed run also corrupts the working tree.

Write the temporary template with CRLF endings whatever the checkout uses. When TextTransform fails for any selected project, remove the outputs the run created and restore the generated files of every selected project from their original bytes, so a failed run exits non-zero and changes nothing.

Regenerating also restores the trailing tabs the template emits on five Agent Tunnel constants of the Gateway Strings.g.cs, which had been added without them.

🤖 Generated with Claude Code

TextTransform.exe fails with CS1519 when the template has LF line
endings, which is what a checkout with core.autocrlf=input or false
produces, since Strings.g.tt has no eol attribute. T4 then replaces
Strings.g.cs with `ErrorGeneratingOutput`, so the failed run also
corrupts the working tree.

Write the temporary template with CRLF endings whatever the checkout
uses, and restore the generated files from their original bytes when
TextTransform fails, so a failed run exits non-zero and changes
nothing.

Regenerating also restores the trailing tabs the template emits on
five Agent Tunnel constants of the Gateway Strings.g.cs, which had
been added without them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 23, 2026 19:42
@CBenoit

Copy link
Copy Markdown
Member Author

Reproduction and proof

Checkout with core.autocrlf=input; git ls-files --eol reports i/lf w/lf for both Strings.g.tt.

Before (master script, LF templates), for both -Product agent and -Product gateway:

error CS1519: Compiling transformation: CS1519: Invalid token 'this' in a member declaration
TextTransform failed for AgentWindowsManaged

The script exits 1, but Strings.g.cs is replaced by the single line ErrorGeneratingOutput (Agent: 308 lines deleted, Gateway: 932).

After, all checks run with pwsh -NoProfile -File package/Update-InstallerLocalization.ps1:

Case Exit Result
LF templates, -Product all 0 Agent outputs byte-identical to committed; Gateway Strings.g.cs differs only by the 5 trailing-tab lines in this PR
CRLF templates (w/crlf), -Product all 0 SHA-256 of all 8 *.wxl and Strings.g.cs identical to the LF run
CRLF templates, master script 0 Same 8 hashes, so the fix does not change generated output
Agent template with <#+ this is not C# #> appended 1 TextTransform failed for AgentWindowsManaged; generated files were left unchanged; Strings.g.cs hash unchanged; no _Strings.*.tt left behind

The 5-line Strings.g.cs difference is the master script's own output on a CRLF checkout too: those Agent Tunnel constants were committed without the trailing tabs Strings.g.tt emits on every constant.

Lines changed

Area Added Removed
Production code 0 0
Tests 0 0
Other: package/Update-InstallerLocalization.ps1 (developer tooling) 10 1
Other: generated Strings.g.cs (whitespace only) 5 5

Note

LLM-assisted content (no human feedback).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Rollback can leave earlier projects’ changes and newly created outputs behind, violating the unchanged-on-failure guarantee.

2 open issues
What changed in this PR

This PR makes installer localization regeneration work in LF checkouts and adds rollback when TextTransform fails.

Changes:

  • Normalize temporary T4 templates to CRLF before execution.
  • Save existing generated files and restore their bytes on transformation failure.
  • Restore generator-emitted trailing tabs on five Gateway constants, with no functional C# changes.
File Description
package/​WindowsManaged/​Resources/​Strings.g.cs Align five constants with generated whitespace.
package/​Update-InstallerLocalization.ps1 Normalize template line endings and add failure rollback.

Review effort: Balanced

Comment thread package/Update-InstallerLocalization.ps1 Outdated
Comment thread package/Update-InstallerLocalization.ps1 Outdated
Snapshot the generated files of all selected projects before running
T4, and on failure remove outputs the run created before restoring the
rest, so a failure in a later project does not keep the earlier
project's changes or a new ErrorGeneratingOutput file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@CBenoit
Benoît Cortier (CBenoit) merged commit cf6b76f into master Oct 25, 2026
49 checks passed
@CBenoit
Benoît Cortier (CBenoit) deleted the fix/installer-localization-lf branch October 25, 2026 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants