Skip to content

Copy job history to avoid InvalidOperationException#47

Merged
perrich merged 1 commit intoperrich:masterfrom
martincostello:copy-job-history
Jun 14, 2025
Merged

Copy job history to avoid InvalidOperationException#47
perrich merged 1 commit intoperrich:masterfrom
martincostello:copy-job-history

Conversation

@martincostello
Copy link
Contributor

Copy job history from storage before returning to avoid mutating state.

Surfaced via a failing test in open-telemetry/opentelemetry-dotnet-contrib.

Avoiding for now via open-telemetry/opentelemetry-dotnet-contrib#2835.

Copy job history from storage before returning to avoid mutating state.
Copilot AI review requested due to automatic review settings June 11, 2025 09:28
Copy link

Copilot AI left a comment

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 copies the job history before returning it to prevent state mutations and avoid an InvalidOperationException.

  • Clone the job History using ToList() to ensure subsequent modifications do not affect the stored state.
  • Maintain the existing object properties while addressing the failing test.

@perrich perrich merged commit d41fb18 into perrich:master Jun 14, 2025
1 check passed
@perrich
Copy link
Owner

perrich commented Jun 14, 2025

Thank you for the fix.

@martincostello
Copy link
Contributor Author

@perrich Could we get a new release with this change included published to NuGet.org please? We still get the issue pop-up in our CI in https://github.com/open-telemetry/opentelemetry-dotnet-contrib from time to time.

@martincostello
Copy link
Contributor Author

Nevermind, I see 1.8.1.2 in NuGet contains this change, there just wasn't a corresponding GitHub release.

martincostello added a commit to open-telemetry/opentelemetry-dotnet-contrib that referenced this pull request Aug 15, 2025
Update dependencies in tests to their latest versions, mainly to pick up the fix from perrich/Hangfire.MemoryStorage#47.
martincostello added a commit to open-telemetry/opentelemetry-dotnet-contrib that referenced this pull request Aug 17, 2025
Update dependencies in tests to their latest versions, mainly to pick up the fix from perrich/Hangfire.MemoryStorage#47.
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.

3 participants