Repository navigation
Return null from FaultGenerator when no fault is generated - #42
Merged
Merged
Conversation
…o fault is generated The implicit conversion from FaultGenerator to the FaultGenerator delegate dereferenced the generated outcome unconditionally, so a generator with no exceptions registered, or with every weight at zero, threw InvalidOperationException instead of returning null (no fault). Upstream: App-vNext/Polly#3220. Refs #28. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of App-vNext/Polly@482bdf82 (upstream App-vNext/Polly#3220), from upstream sync #1. Refs #28.
What
The implicit conversion from
FaultGeneratortoFunc<FaultGeneratorArguments, ValueTask<Exception?>>dereferenced the generated outcome unconditionally. A generator with no exceptions registered, or with every weight at zero, therefore threwInvalidOperationException: Nullable object must have a valueinstead of returningnull(no fault).src/Paramore.Fences.Core/Simmy/Fault/FaultGenerator.cs:!.Value.Exceptionbecomes?.Exception. This is upstream's one-line fix.FaultGeneratorTests: upstream's two tests, renamed toMember_Scenario_OutcomeasImplicitConversion_NoExceptionRegistered_ReturnsNullandImplicitConversion_AllWeightsZero_ReturnsNull. Both fail without the fix.Checks
.PublicAPI/is untouched. No dependency changes.CHANGELOG.mdis untouched. It is generated from PR titles at release time, so this PR's title is the entry.ComponentDisposeHelper.cs:30). Unmodifiedmaindoes the same, so this isn't caused by this change. See Coverage collection is unreliable, and blocks the coverlet 10 upgrade #14.🤖 Generated with Claude Code