Skip to content

Backport UseConsole double-init + progress bar fixes from IdentityStream#3

Merged
bhavishyachandra merged 3 commits into
masterfrom
feature/bring-in-fixes
May 20, 2026
Merged

Backport UseConsole double-init + progress bar fixes from IdentityStream#3
bhavishyachandra merged 3 commits into
masterfrom
feature/bring-in-fixes

Conversation

@bhavishyachandra

Copy link
Copy Markdown
Contributor

Brings in two real bug fixes from the IdentityStream fork of this package, without pulling in the rest of their changes (file-scoped namespaces, nullable reference types, dropping net451/netstandard1.3 targets, etc.) so we preserve backwards compatibility.

Imported fixes

1. UseConsole() no longer throws on double-init

  • Upstream commit: 988d3db
  • Fixes pieceofsummer/Hangfire.Console#120
  • Common scenario in ASP.NET Core apps where startup paths or test hosts re-run configuration. Previously threw InvalidOperationException("Console is already initialized"); now returns silently. Strictly more permissive — any caller already catching the exception simply never enters the catch.

2. DefaultProgressBar normalizes empty name/color to null

  • Upstream commit: f9d4ebd
  • Prevents empty strings from being serialized into ConsoleLine.ProgressName / TextColor where downstream code only checks for null.

Skipped (not portable without breaking changes)

  • Enable nullable reference types
  • Switch to file-scoped namespaces
  • Drop net451 / netstandard1.3 targets
  • Make Message required

These are stylistic/architectural changes — not bug fixes — and importing them would break consumers on legacy targets or relying on current nullability semantics.

Version

  • 1.4.41.4.5
  • Release notes updated in csproj

Validation

  • dotnet build passes for all 3 TFMs (net451, netstandard1.3, netstandard2.0)
  • dotnet test passes 122/122 on net8.0
  • dotnet pack produces Hangtools.Hangfire.Console.1.4.5.nupkg + .snupkg

Brings in two fixes from the IdentityStream fork (https://github.com/IdentityStream/Hangfire.Console):

- UseConsole() no longer throws when called more than once; returns silently instead (fixes pieceofsummer/Hangfire.Console#120, IdentityStream commit 988d3db)
- DefaultProgressBar normalizes empty name/color to null (IdentityStream commit f9d4ebd)

Version bumped to 1.4.5 with release notes.
Copilot AI review requested due to automatic review settings May 20, 2026 13:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Backports two bug fixes from the IdentityStream fork into Hangfire.Console while preserving the existing target frameworks and non-nullable code style, and bumps the package version to 1.4.5.

Changes:

  • Make UseConsole() tolerate repeated initialization attempts by returning instead of throwing.
  • Normalize empty progress bar name/color values to null to avoid serializing empty strings.
  • Bump package version to 1.4.5 and update release notes in the project file.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/Hangfire.Console/GlobalConfigurationExtensions.cs Changes double-init behavior of UseConsole() to return silently when already initialized.
src/Hangfire.Console/Progress/DefaultProgressBar.cs Treats empty progress bar name/color values as null before writing console lines.
src/Hangfire.Console/Hangfire.Console.csproj Updates VersionPrefix and adds v1.4.5 release notes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Hangfire.Console/GlobalConfigurationExtensions.cs Outdated
Comment thread src/Hangfire.Console/Progress/DefaultProgressBar.cs
@bhavishyachandra bhavishyachandra merged commit a1026b1 into master May 20, 2026
1 check passed
@bhavishyachandra bhavishyachandra deleted the feature/bring-in-fixes branch May 20, 2026 14:06
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.

"Console is already initialized" Exception in unit tests

2 participants