Skip to content

Make source generator output deterministic (LF, no BOM) - #2143

Merged
patriksvensson merged 1 commit into
spectreconsole:mainfrom
phil-scott-78:source-generator-deterministic-output
Jun 7, 2026
Merged

patriksvensson merged 1 commit into
spectreconsole:mainfrom
phil-scott-78:source-generator-deterministic-output

Conversation

@phil-scott-78

Copy link
Copy Markdown
Contributor

The Color, Emoji, and Spinner generators wrote output via IndentedTextWriter, which emits Environment.NewLine and via SourceText.From(..., Encoding.UTF8), which emits a UTF-8 BOM. Because the generated .g.cs files are checked in, this produced non-deterministic output that varied by OS

Long and short of it, anyone on Windows doing a build has to remove these files from their commits. Nothing terribly fancy about the implementation, just hard coding LF and BOM conventions into the generator itself. Might be a way to pull that programmatically, but probably more trouble than it is worth.

The Color, Emoji, and Spinner generators wrote output via IndentedTextWriter, which emits Environment.NewLine (CRLF on Windows, LF on Linux), and via SourceText.From(..., Encoding.UTF8), which emits a UTF-8 BOM. Because the generated .g.cs files are checked in, this produced non-deterministic output that varied by OS and conflicted with the repository convention (.gitattributes/.editorconfig mandate LF, and source files have no BOM).

Force LF line endings in the emitters and emit UTF-8 without a BOM so the checked-in generated files are stable regardless of host OS.
@patriksvensson
patriksvensson merged commit ee6a48f into spectreconsole:main Jun 7, 2026
2 checks passed
mergify Bot pushed a commit to TekuSP/framework-dotnet that referenced this pull request Jun 12, 2026
…sole-0.57.0

Bump Spectre.Console from 0.56.0 to 0.57.0 (#23)

Updated [Spectre.Console](https://github.com/spectreconsole/spectre.console) from 0.56.0 to 0.57.0.

<details>
<summary>Release notes</summary>

_Sourced from [Spectre.Console's releases](https://github.com/spectreconsole/spectre.console/releases)._

## 0.57.0

## What's Changed
* Make source generator output deterministic (LF, no BOM) by [@​phil-scott-78](https://github.com/phil-scott-78) in [#​2143](spectreconsole/spectre.console#2143)
* Add new box border styles including beveled, dashed, dotted, heavy, and rounded variants by [@​phil-scott-78](https://github.com/phil-scott-78) in [#​2142](spectreconsole/spectre.console#2142)
* Should preserve auto links when wrapped in grid by [@​patriksvensson](https://github.com/patriksvensson) in [#​2149](spectreconsole/spectre.console#2149)

**Full Changelog**: spectreconsole/spectre.console@0.56.0...0.57.0

Commits viewable in [compare view](spectreconsole/spectre.console@0.56.0...0.57.0).
</details>

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=Spectre.Console&package-manager=nuget&previous-version=0.56.0&new-version=0.57.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>
nmetulev added a commit to microsoft/winappCli that referenced this pull request Nov 18, 2026
Pinned
[Microsoft.Diagnostics.Runtime](https://github.com/Microsoft/clrmd) at
4.2.751201.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.Diagnostics.Runtime's
releases](https://github.com/Microsoft/clrmd/releases)._

No release notes found for this version range.

Commits viewable in [compare
view](https://github.com/Microsoft/clrmd/commits).
</details>

Pinned
[Microsoft.Diagnostics.Runtime.Utilities](https://github.com/Microsoft/clrmd)
at 4.2.751201.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.Diagnostics.Runtime.Utilities's
releases](https://github.com/Microsoft/clrmd/releases)._

No release notes found for this version range.

Commits viewable in [compare
view](https://github.com/Microsoft/clrmd/commits).
</details>

Pinned
[Microsoft.Extensions.DependencyInjection](https://github.com/dotnet/dotnet)
at 10.0.14.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.Extensions.DependencyInjection's
releases](https://github.com/dotnet/dotnet/releases)._

No release notes found for this version range.

Commits viewable in [compare
view](https://github.com/dotnet/dotnet/commits).
</details>

Updated
[Microsoft.Extensions.DependencyInjection.Abstractions](https://github.com/dotnet/dotnet)
from 10.0.5 to 10.0.14.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.Extensions.DependencyInjection.Abstractions's
releases](https://github.com/dotnet/dotnet/releases)._

No release notes found for this version range.

Commits viewable in [compare
view](https://github.com/dotnet/dotnet/commits).
</details>

Pinned
[Microsoft.Extensions.Logging.Abstractions](https://github.com/dotnet/dotnet)
at 10.0.14.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.Extensions.Logging.Abstractions's
releases](https://github.com/dotnet/dotnet/releases)._

No release notes found for this version range.

Commits viewable in [compare
view](https://github.com/dotnet/dotnet/commits).
</details>

Pinned
[Microsoft.Extensions.Logging.Console](https://github.com/dotnet/dotnet)
at 10.0.14.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.Extensions.Logging.Console's
releases](https://github.com/dotnet/dotnet/releases)._

No release notes found for this version range.

Commits viewable in [compare
view](https://github.com/dotnet/dotnet/commits).
</details>

Updated
[Microsoft.Windows.CsWin32](https://github.com/microsoft/CsWin32) from
0.3.360 to 0.3.369.

<details>
<summary>Release notes</summary>

_Sourced from [Microsoft.Windows.CsWin32's
releases](https://github.com/microsoft/CsWin32/releases)._

## 0.3.369


## Changes:

* #​1870: Fix cross-assembly COM projections and shared helpers
* #​1871: Upload consumer-tested NuGet packages from PR builds

This list of changes was [auto
generated](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=15944789&view=logs).

## 0.3.367


## Changes:

* #​1864: Fix OverflowException for sign-extended handles in SafeHandle
conversions

This list of changes was [auto
generated](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=15771099&view=logs).

## 0.3.366


## Changes:

* #​1860: Update Win32 metadata to 71.0.37-preview
* #​1859: Generate SafeHandle owners for cleanup functions that return
BOOLEAN
* #​1844: Generate SafeHandle for RAIIFree-annotated parameters, and
make getting the Value from a SafeHandle easier (but still safe)

This list of changes was [auto
generated](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=15738141&view=logs).

## 0.3.363


## Changes:

* #​1846: Support TypeDefinition handles for struct-typed constants in
nesting and extension blocks
* #​1851: Switch builds to the VSEng-MicroBuildVSStable pool
* #​1850: Fix build-task LibraryImport generation with extensionReceiver
* #​1825: extensionReceiver with CsWin32RunAsBuildTask=true emits
unsupported LibraryImport partials

This list of changes was [auto
generated](https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=15677307&view=logs).

Commits viewable in [compare
view](microsoft/CsWin32@v0.3.360...v0.3.369).
</details>

Pinned [SkiaSharp](https://go.microsoft.com/fwlink/?linkid=868515) at
4.155.0.

Pinned
[Spectre.Console](https://github.com/spectreconsole/spectre.console) at
0.57.2.

<details>
<summary>Release notes</summary>

_Sourced from [Spectre.Console's
releases](https://github.com/spectreconsole/spectre.console/releases)._

## 0.57.2

## What's Change

* Allow wrapping of status text by @​patriksvensson in
spectreconsole/spectre.console#2158

**Full Changelog**:
spectreconsole/spectre.console@0.57.1...0.57.2

## 0.57.1

## What's Changed

* GH2153: Fix async stack traces rendering as MoveNext() instead of
source methods by [@​devlead](https://github.com/devlead) in
[#​2154](spectreconsole/spectre.console#2154)

**Full Changelog**:
spectreconsole/spectre.console@0.57.0...0.57.1

## 0.57.0

## What's Changed
* Make source generator output deterministic (LF, no BOM) by
[@​phil-scott-78](https://github.com/phil-scott-78) in
[#​2143](spectreconsole/spectre.console#2143)
* Add new box border styles including beveled, dashed, dotted, heavy,
and rounded variants by
[@​phil-scott-78](https://github.com/phil-scott-78) in
[#​2142](spectreconsole/spectre.console#2142)
* Should preserve auto links when wrapped in grid by
[@​patriksvensson](https://github.com/patriksvensson) in
[#​2149](spectreconsole/spectre.console#2149)

**Full Changelog**:
spectreconsole/spectre.console@0.56.0...0.57.0

## 0.56.0

## What's Changed

* Ensure redirected output works as expected by
[@​patriksvensson](https://github.com/patriksvensson) in
[#​2098](spectreconsole/spectre.console#2098)
* Add missing text prompt suffix by
[@​merklegroot](https://github.com/merklegroot) in
[#​2102](spectreconsole/spectre.console#2102)
* Fix Align measure to respect explicitly set width by
[@​GrantTotinov](https://github.com/GrantTotinov) in
[#​2101](spectreconsole/spectre.console#2101)
* Option to exclude vertical padding for live progress renderer by
[@​james-newell-forge](https://github.com/james-newell-forge) in
[#​2100](spectreconsole/spectre.console#2100)
* Don't emit ANSI sequence for 0 movement by
[@​merklegroot](https://github.com/merklegroot) in
[#​2104](spectreconsole/spectre.console#2104)
* ConfirmationPrompt: Allow submission without Enter key by
[@​patriksvensson](https://github.com/patriksvensson) in
[#​2111](spectreconsole/spectre.console#2111)
* Add two new layout modes for FigletText by
[@​patriksvensson](https://github.com/patriksvensson) in
[#​2066](spectreconsole/spectre.console#2066)
* Fix escaping of interpolated arguments in markup by
[@​GrantTotinov](https://github.com/GrantTotinov) in
[#​2118](spectreconsole/spectre.console#2118)
* Allow validation chaining by
[@​AntekOlszewski](https://github.com/AntekOlszewski) in
[#​2116](spectreconsole/spectre.console#2116)
* Fix grid regression where expansion did not work by
[@​patriksvensson](https://github.com/patriksvensson) in
[#​2127](spectreconsole/spectre.console#2127)
* Preserve links in segments by
[@​patriksvensson](https://github.com/patriksvensson) in
[#​2135](spectreconsole/spectre.console#2135)

## New Contributors

* [@​merklegroot](https://github.com/merklegroot) made their first
contribution in
[#​2102](spectreconsole/spectre.console#2102)
* [@​GrantTotinov](https://github.com/GrantTotinov) made their first
contribution in
[#​2101](spectreconsole/spectre.console#2101)
* [@​james-newell-forge](https://github.com/james-newell-forge) made
their first contribution in
[#​2100](spectreconsole/spectre.console#2100)

**Full Changelog**:
spectreconsole/spectre.console@0.55.2...0.56.0

## 0.55.2

## What's Changed

* Support variation selectors, ZWJ sequences and surrogate pairs in
length calculation by @​fabsenet in
spectreconsole/spectre.console#2082
* Add default value to selection prompt and multiselection prompt by
@​AntekOlszewski in
spectreconsole/spectre.console#2079

## New Contributors
* @​fabsenet made their first contribution in
spectreconsole/spectre.console#2082

**Full Changelog**:
spectreconsole/spectre.console@0.55.1...0.55.2

## 0.55.1

## What's Changed

* Add tests to verify public API by @​patriksvensson in
spectreconsole/spectre.console#2073
* use StringComparer.OrdinalIgnoreCase as default comparer for
TextPrompt by @​AntekOlszewski in
spectreconsole/spectre.console#2077
* Fix markup link rendering regression by @​patriksvensson in
spectreconsole/spectre.console#2084
* Add VS16 suffix to non-presentation emojis by @​patriksvensson in
spectreconsole/spectre.console#2087
* Ensure rendered exceptions take up minimal space by @​patriksvensson
in spectreconsole/spectre.console#2089
* Fix link parsing to terminate properly by @​zhuman in
spectreconsole/spectre.console#2091

## New Contributors
* @​zhuman made their first contribution in
spectreconsole/spectre.console#2091

**Full Changelog**:
spectreconsole/spectre.console@0.55.0...0.55.1

## 0.55.0

This release brings new features, performance improvements, bug fixes,
and some important architectural changes.

> [!CAUTION]
> There are breaking changes in this release, so make sure you review
the release notes and try things out before upgrading in production.

## New Spectre.Console.Ansi Library

One of the biggest changes in this release is the introduction of 

[Spectre.Console.Ansi](https://www.nuget.org/packages/spectre.console.ansi),
a new standalone library for writing ANSI escape
sequences to the terminal without taking a full dependency on
`Spectre.Console`.

This makes it easy to add ANSI support to lightweight tools and
libraries where
pulling in the full Spectre.Console package would be overkill.
Spectre.Console
itself now depends on this library internally.

We've also added some nice convenience methods for the .NET Console
class:

```csharp
using Spectre.Console.Ansi;

Console.Markup("[yellow]Hello[/] ");
Console.MarkupLine("[blue]World[/]");
  
Console.Ansi(writer => writer
    .BeginLink("https://spectreconsole.net", linkId: 123)
    .Decoration(Decoration.Bold | Decoration.Italic)
    .Foreground(Color.Yellow)
    .Write("Spectre Console")
    .ResetStyle()
    .EndLink());
```

## Style Is Now a Struct

`Style` has been converted from a class to a struct, and link/URL
information
has been extracted into a separate `Link` type. This improves allocation
performance, especially in rendering-heavy scenarios, but is a breaking
change
for code that relies on reference semantics.

## Progress Improvements

The `Progress` widget received a lot of love in this release. It now
uses
`TimeProvider` instead of the wall clock, making it significantly easier
to
write deterministic tests. `ProgressTask` has a new `Tag` property for
attaching
arbitrary metadata, and you can now override the global
hide-when-completed
behavior on individual tasks. Tasks can also be removed from the
progress
context entirely.

Speed calculations have been improved with configurable max sampling age
and
 ... (truncated)

Commits viewable in [compare
view](spectreconsole/spectre.console@0.54.0...0.57.2).
</details>

Updated
[Spectre.Console.Testing](https://github.com/spectreconsole/spectre.console)
from 0.54.0 to 0.57.2.

<details>
<summary>Release notes</summary>

_Sourced from [Spectre.Console.Testing's
releases](https://github.com/spectreconsole/spectre.console/releases)._

## 0.57.2

## What's Change

* Allow wrapping of status text by @​patriksvensson in
spectreconsole/spectre.console#2158

**Full Changelog**:
spectreconsole/spectre.console@0.57.1...0.57.2

## 0.57.1

## What's Changed

* GH2153: Fix async stack traces rendering as MoveNext() instead of
source methods by [@​devlead](https://github.com/devlead) in
[#​2154](spectreconsole/spectre.console#2154)

**Full Changelog**:
spectreconsole/spectre.console@0.57.0...0.57.1

## 0.57.0

## What's Changed
* Make source generator output deterministic (LF, no BOM) by
[@​phil-scott-78](https://github.com/phil-scott-78) in
[#​2143](spectreconsole/spectre.console#2143)
* Add new box border styles including beveled, dashed, dotted, heavy,
and rounded variants by
[@​phil-scott-78](https://github.com/phil-scott-78) in
[#​2142](spectreconsole/spectre.console#2142)
* Should preserve auto links when wrapped in grid by
[@​patriksvensson](https://github.com/patriksvensson) in
[#​2149](spectreconsole/spectre.console#2149)

**Full Changelog**:
spectreconsole/spectre.console@0.56.0...0.57.0

## 0.56.0

## What's Changed

* Ensure redirected output works as expected by
[@​patriksvensson](https://github.com/patriksvensson) in
[#​2098](spectreconsole/spectre.console#2098)
* Add missing text prompt suffix by
[@​merklegroot](https://github.com/merklegroot) in
[#​2102](spectreconsole/spectre.console#2102)
* Fix Align measure to respect explicitly set width by
[@​GrantTotinov](https://github.com/GrantTotinov) in
[#​2101](spectreconsole/spectre.console#2101)
* Option to exclude vertical padding for live progress renderer by
[@​james-newell-forge](https://github.com/james-newell-forge) in
[#​2100](spectreconsole/spectre.console#2100)
* Don't emit ANSI sequence for 0 movement by
[@​merklegroot](https://github.com/merklegroot) in
[#​2104](spectreconsole/spectre.console#2104)
* ConfirmationPrompt: Allow submission without Enter key by
[@​patriksvensson](https://github.com/patriksvensson) in
[#​2111](spectreconsole/spectre.console#2111)
* Add two new layout modes for FigletText by
[@​patriksvensson](https://github.com/patriksvensson) in
[#​2066](spectreconsole/spectre.console#2066)
* Fix escaping of interpolated arguments in markup by
[@​GrantTotinov](https://github.com/GrantTotinov) in
[#​2118](spectreconsole/spectre.console#2118)
* Allow validation chaining by
[@​AntekOlszewski](https://github.com/AntekOlszewski) in
[#​2116](spectreconsole/spectre.console#2116)
* Fix grid regression where expansion did not work by
[@​patriksvensson](https://github.com/patriksvensson) in
[#​2127](spectreconsole/spectre.console#2127)
* Preserve links in segments by
[@​patriksvensson](https://github.com/patriksvensson) in
[#​2135](spectreconsole/spectre.console#2135)

## New Contributors

* [@​merklegroot](https://github.com/merklegroot) made their first
contribution in
[#​2102](spectreconsole/spectre.console#2102)
* [@​GrantTotinov](https://github.com/GrantTotinov) made their first
contribution in
[#​2101](spectreconsole/spectre.console#2101)
* [@​james-newell-forge](https://github.com/james-newell-forge) made
their first contribution in
[#​2100](spectreconsole/spectre.console#2100)

**Full Changelog**:
spectreconsole/spectre.console@0.55.2...0.56.0

## 0.55.2

## What's Changed

* Support variation selectors, ZWJ sequences and surrogate pairs in
length calculation by @​fabsenet in
spectreconsole/spectre.console#2082
* Add default value to selection prompt and multiselection prompt by
@​AntekOlszewski in
spectreconsole/spectre.console#2079

## New Contributors
* @​fabsenet made their first contribution in
spectreconsole/spectre.console#2082

**Full Changelog**:
spectreconsole/spectre.console@0.55.1...0.55.2

## 0.55.1

## What's Changed

* Add tests to verify public API by @​patriksvensson in
spectreconsole/spectre.console#2073
* use StringComparer.OrdinalIgnoreCase as default comparer for
TextPrompt by @​AntekOlszewski in
spectreconsole/spectre.console#2077
* Fix markup link rendering regression by @​patriksvensson in
spectreconsole/spectre.console#2084
* Add VS16 suffix to non-presentation emojis by @​patriksvensson in
spectreconsole/spectre.console#2087
* Ensure rendered exceptions take up minimal space by @​patriksvensson
in spectreconsole/spectre.console#2089
* Fix link parsing to terminate properly by @​zhuman in
spectreconsole/spectre.console#2091

## New Contributors
* @​zhuman made their first contribution in
spectreconsole/spectre.console#2091

**Full Changelog**:
spectreconsole/spectre.console@0.55.0...0.55.1

## 0.55.0

This release brings new features, performance improvements, bug fixes,
and some important architectural changes.

> [!CAUTION]
> There are breaking changes in this release, so make sure you review
the release notes and try things out before upgrading in production.

## New Spectre.Console.Ansi Library

One of the biggest changes in this release is the introduction of 

[Spectre.Console.Ansi](https://www.nuget.org/packages/spectre.console.ansi),
a new standalone library for writing ANSI escape
sequences to the terminal without taking a full dependency on
`Spectre.Console`.

This makes it easy to add ANSI support to lightweight tools and
libraries where
pulling in the full Spectre.Console package would be overkill.
Spectre.Console
itself now depends on this library internally.

We've also added some nice convenience methods for the .NET Console
class:

```csharp
using Spectre.Console.Ansi;

Console.Markup("[yellow]Hello[/] ");
Console.MarkupLine("[blue]World[/]");
  
Console.Ansi(writer => writer
    .BeginLink("https://spectreconsole.net", linkId: 123)
    .Decoration(Decoration.Bold | Decoration.Italic)
    .Foreground(Color.Yellow)
    .Write("Spectre Console")
    .ResetStyle()
    .EndLink());
```

## Style Is Now a Struct

`Style` has been converted from a class to a struct, and link/URL
information
has been extracted into a separate `Link` type. This improves allocation
performance, especially in rendering-heavy scenarios, but is a breaking
change
for code that relies on reference semantics.

## Progress Improvements

The `Progress` widget received a lot of love in this release. It now
uses
`TimeProvider` instead of the wall clock, making it significantly easier
to
write deterministic tests. `ProgressTask` has a new `Tag` property for
attaching
arbitrary metadata, and you can now override the global
hide-when-completed
behavior on individual tasks. Tasks can also be removed from the
progress
context entirely.

Speed calculations have been improved with configurable max sampling age
and
 ... (truncated)

Commits viewable in [compare
view](spectreconsole/spectre.console@0.54.0...0.57.2).
</details>

Pinned [System.CommandLine](https://github.com/dotnet/dotnet) at 2.0.14.

<details>
<summary>Release notes</summary>

_Sourced from [System.CommandLine's
releases](https://github.com/dotnet/dotnet/releases)._

No release notes found for this version range.

Commits viewable in [compare
view](https://github.com/dotnet/dotnet/commits).
</details>

Pinned [System.Diagnostics.EventLog](https://github.com/dotnet/dotnet)
at 10.0.14.

<details>
<summary>Release notes</summary>

_Sourced from [System.Diagnostics.EventLog's
releases](https://github.com/dotnet/dotnet/releases)._

No release notes found for this version range.

Commits viewable in [compare
view](https://github.com/dotnet/dotnet/commits).
</details>

Pinned [System.Drawing.Common](https://github.com/dotnet/dotnet) at
10.0.14.

<details>
<summary>Release notes</summary>

_Sourced from [System.Drawing.Common's
releases](https://github.com/dotnet/dotnet/releases)._

No release notes found for this version range.

Commits viewable in [compare
view](https://github.com/dotnet/dotnet/commits).
</details>

Pinned
[System.Security.Cryptography.Pkcs](https://github.com/dotnet/dotnet) at
10.0.14.

<details>
<summary>Release notes</summary>

_Sourced from [System.Security.Cryptography.Pkcs's
releases](https://github.com/dotnet/dotnet/releases)._

No release notes found for this version range.

Commits viewable in [compare
view](https://github.com/dotnet/dotnet/commits).
</details>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nikola Metulev <711864+nmetulev@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Nikola Metulev <nmetulev@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants