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

Consider making Polly easier to consume from F# and Visual Basic #2061

Open
martincostello opened this issue Apr 16, 2024 · 0 comments
Open

Comments

@martincostello
Copy link
Member

Following on from #2045 and #2046, we should consider whether it is worth adding some convenience APIs to make the use of Polly.Core's asynchronous common-case public members easier to consume in F# and VisualBasic where ValueTask/ValueTask<T> cannot be awaited.

For example, we could create a new Polly.Interop (or better named) extension package that exposes extension methods for types such as ResiliencePipeline that add Task-based overloads that wrap the usage of ValueTask from the caller, at the expense of additional allocations/performance overhead.

namespace Polly.Core;

public static class ResiliencePipelineExtensions
{
    public static Task<TResult> ExecuteAsync<TResult>(
        this ResiliencePipeline pipeline,
        Func<ResilienceContext, Task<TResult>> callback,
        ResilienceContext context)
        => pipeline.ExecuteAsync((context) => new ValueTask<TResult>(callback(context)), context).AsTask();
}

We may ultimately decide to do nothing and instead rely on documentation to help users of F# and VisualBasic consume Polly.Core APIs as they already are in version 8+.

This issue to is to collect feedback on whether people think this is worth doing, and an issue to point to decision making if we elect not to add such convenience APIs.

Appetite for this may be minimal given that it has taken 6 months for us to become aware of this usability issue.

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

No branches or pull requests

1 participant