Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix debugger proxies #1384

Merged
merged 1 commit into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions src/Polly.Core/ResilienceStrategy.DebuggerProxy.cs

This file was deleted.

1 change: 0 additions & 1 deletion src/Polly.Core/ResilienceStrategy.TResult.Async.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace Polly;
/// Resilience strategy supports various types of callbacks of <typeparamref name="TResult"/> result type
/// and provides a unified way to execute them. This includes overloads for synchronous and asynchronous callbacks.
/// </remarks>
[DebuggerTypeProxy(typeof(ResilienceStrategy<>.DebuggerProxy))]
public partial class ResilienceStrategy<TResult>
{
internal ResilienceStrategy(ResilienceStrategy strategy) => Strategy = strategy;
Expand Down
14 changes: 0 additions & 14 deletions src/Polly.Core/ResilienceStrategy.TResult.DebuggerProxy.cs

This file was deleted.

1 change: 0 additions & 1 deletion src/Polly.Core/ResilienceStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace Polly;
/// Resilience strategy supports various types of callbacks and provides a unified way to execute them.
/// This includes overloads for synchronous and asynchronous callbacks, generic and non-generic callbacks.
/// </remarks>
[DebuggerTypeProxy(typeof(DebuggerProxy))]
public abstract partial class ResilienceStrategy
{
/// <summary>
Expand Down
14 changes: 14 additions & 0 deletions src/Polly.Core/Utils/ResilienceStrategyPipeline.DebuggerProxy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Polly.Utils;

internal partial class ResilienceStrategyPipeline
{
internal sealed class DebuggerProxy
{
private readonly ResilienceStrategyPipeline _resilienceStrategy;

public DebuggerProxy(ResilienceStrategyPipeline resilienceStrategy) => _resilienceStrategy = resilienceStrategy;

[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public IEnumerable<ResilienceStrategy> Strategies => _resilienceStrategy.Strategies;
}
}
3 changes: 2 additions & 1 deletion src/Polly.Core/Utils/ResilienceStrategyPipeline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ namespace Polly.Utils;
/// A pipeline of strategies.
/// </summary>
[DebuggerDisplay("ResilienceStrategyPipeline, Strategies = {Strategies.Count}")]
internal sealed class ResilienceStrategyPipeline : ResilienceStrategy
[DebuggerTypeProxy(typeof(DebuggerProxy))]
internal sealed partial class ResilienceStrategyPipeline : ResilienceStrategy
{
private readonly ResilienceStrategy _pipeline;

Expand Down
7 changes: 1 addition & 6 deletions test/Polly.Core.Tests/ResilienceStrategyTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Moq;
using Polly.Utils;

namespace Polly.Core.Tests;
Expand Down Expand Up @@ -39,12 +38,8 @@ public void DebuggerProxy_Ok()
new TestResilienceStrategy(),
new TestResilienceStrategy()
});
var reloadable = new ReloadableResilienceStrategy(pipeline, () => default, () => pipeline, TestUtilities.CreateResilienceTelemetry(Mock.Of<DiagnosticSource>()));

new ResilienceStrategy.DebuggerProxy(NullResilienceStrategy.Instance).Strategies.Should().HaveCount(1);
new ResilienceStrategy.DebuggerProxy(pipeline).Strategies.Should().HaveCount(2);
new ResilienceStrategy.DebuggerProxy(reloadable).Strategies.Should().HaveCount(3);
new ResilienceStrategy<string>.DebuggerProxy(NullResilienceStrategy<string>.Instance).Strategies.Should().HaveCount(1);
new ResilienceStrategyPipeline.DebuggerProxy(pipeline).Strategies.Should().HaveCount(2);
}

public class ExecuteParameters<T> : ExecuteParameters
Expand Down