Skip to content

Conversation

@carvex21
Copy link
Contributor

@carvex21 carvex21 commented Aug 20, 2025

Pull Request

The issue or feature being addressed

Fix the Documentation that has incorrect examples for ExecuteOutcomeAsync #2680

Details on the issue fix or feature implementation

  • Markdown documentation fixes:
  1. Migration Guide (migration-v8.md)
    Replaced example that passed a throwing callback with the safe pattern: wrapping the MethodAsync call in try/catch and returning either Outcome.FromResult(...) or Outcome.FromException(...).

  2. Fallback Strategy (fallback.md)
    Updated the “✅ DO” snippet to wrap user code in try/catch and properly return Outcome, enabling exception remapping logic without throwing from the callback.

  3. Circuit Breaker Strategy (circuit-breaker.md)
    Rewrote the “✅ DO” example to include exception capture via Outcome, and updated post-execution logic to correctly handle both BrokenCircuitException and other errors.

  • XML documentation updates. Strengthened the section on ExecuteOutcomeAsync<TResult, TState> to emphasize that the callback must not throw; users must wrap their code and return an Outcome. This clarifies the contract and prevents accidental misuse that relies on internal implementation details. Files affected:
  1. ResiliencePipeline.AsyncT.cs
  2. ResiliencePipelineT.Async.cs
  • Snippet corrections:
  1. Migration.Execute.cs (snippets used in docs)
    Updated the V8 example (SafeExecute_V8) to use the correct, safe callback pattern: wrapping in try/catch and returning an Outcome. This ensures consistency across sample code and real documentation.

Confirm the following

  • I started this PR by branching from the head of the default branch
  • I have targeted the PR to merge into the default branch
  • I have included unit tests for the issue/feature
  • I have successfully run a local build

@carvex21
Copy link
Contributor Author

@dotnet-policy-service agree

@carvex21 carvex21 marked this pull request as ready for review August 20, 2025 19:35
@carvex21 carvex21 force-pushed the fix/fix-docs-for-ExecuteOutcomeAsync branch 4 times, most recently from 68b2fe0 to 2da95a5 Compare August 22, 2025 14:54
@martincostello
Copy link
Member

The snippets don't compile - please check that they build before committing changes to them.

@carvex21 carvex21 force-pushed the fix/fix-docs-for-ExecuteOutcomeAsync branch from 2da95a5 to 9372c7b Compare August 22, 2025 15:17
@codecov
Copy link

codecov bot commented Aug 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.12%. Comparing base (651508b) to head (950a4fd).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2710   +/-   ##
=======================================
  Coverage   96.12%   96.12%           
=======================================
  Files         309      309           
  Lines        7118     7118           
  Branches     1008     1008           
=======================================
  Hits         6842     6842           
  Misses        222      222           
  Partials       54       54           
Flag Coverage Δ
linux 96.12% <ø> (ø)
macos 96.12% <ø> (ø)
windows 96.11% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@carvex21 carvex21 force-pushed the fix/fix-docs-for-ExecuteOutcomeAsync branch from 9372c7b to 950a4fd Compare August 22, 2025 15:32
@martincostello martincostello merged commit 708b02b into App-vNext:main Aug 22, 2025
27 checks passed
@martincostello
Copy link
Member

Thanks for the contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants