Skip to content

Make order of generated logger items stable. - #123428

Merged
cincuranet merged 8 commits into
dotnet:mainfrom
cincuranet:stable-gen-logging
Jan 23, 2026
Merged

cincuranet merged 8 commits into
dotnet:mainfrom
cincuranet:stable-gen-logging

Conversation

@cincuranet

Copy link
Copy Markdown
Contributor

Emits generated classes for logging ordered for stable/deterministic build output.

Fixes #119587.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-extensions-logging
See info in area-owners.md if you want to be subscribed.

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.

Pull request overview

This pull request addresses non-deterministic code generation in the Logger Message Generator by sorting logger classes before emitting them. The change ensures that generated code output is stable across different builds.

Changes:

  • Modified the Emit method to sort logger classes by namespace and then by name before generating code

@tarekgh tarekgh added this to the 11.0.0 milestone Jan 21, 2026
@tarekgh tarekgh added the source-generator Indicates an issue with a source generator feature label Jan 21, 2026
@cincuranet
cincuranet marked this pull request as draft January 21, 2026 18:50
@tarekgh

tarekgh commented Jan 21, 2026

Copy link
Copy Markdown
Member

@cincuranet by the way, thanks for fixing this issue 😄

@cincuranet
cincuranet marked this pull request as ready for review January 22, 2026 12:25
@cincuranet

Copy link
Copy Markdown
Contributor Author

@tarekgh PTAL

cincuranet added a commit to dotnet/extensions that referenced this pull request Jan 22, 2026

@tarekgh tarekgh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks @cincuranet!

cincuranet added a commit to dotnet/extensions that referenced this pull request Jan 23, 2026
@cincuranet
cincuranet merged commit 531dd27 into dotnet:main Jan 23, 2026
92 checks passed
@cincuranet
cincuranet deleted the stable-gen-logging branch January 23, 2026 13:27
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 23, 2026
@cincuranet

Copy link
Copy Markdown
Contributor Author

/backport to release/10.0

@github-actions github-actions Bot unlocked this conversation Sep 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/10.0 (link to workflow run)

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-Extensions-Logging source-generator Indicates an issue with a source generator feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LoggerMessageGenerator output order is unstable/non-deterministic

5 participants