Skip to content

Commit

Permalink
Fix CA0162 warning (#2250)
Browse files Browse the repository at this point in the history
Fix CA0162 warning about unreachable code.
  • Loading branch information
sukreshmanda authored Jul 29, 2024
1 parent 95aebef commit 2ffa02e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions test/Polly.Specs/Wrap/PolicyWrapContextAndKeyAsyncSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ public class PolicyWrapTResultContextAndKeyAsyncSpecs
{
#region PolicyKey and execution Context tests

private static void ThrowException() => throw new Exception();

[Fact]
public async Task Should_pass_PolicyKey_to_execution_context_of_outer_policy_as_PolicyWrapKey()
{
Expand Down Expand Up @@ -296,11 +298,8 @@ public async Task Should_restore_PolicyKey_of_outer_policy_to_execution_context_

await policyWrap.ExecuteAsync(async () => await Task.Run(() => // Regression test for issue 510
{
throw new Exception();
#pragma warning disable 0162 // unreachable code detected
ThrowException();
return ResultPrimitive.WhateverButTooLate;
#pragma warning restore 0162

}));
}

Expand Down

0 comments on commit 2ffa02e

Please sign in to comment.