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

RetryDelegatingHandler breaking change between Microsoft.Rest.ClientRuntime.2.3.12 and Microsoft.Rest.ClientRuntime.2.3.15 #4876

Closed
saguiitay opened this issue Oct 16, 2018 · 2 comments
Assignees

Comments

@saguiitay
Copy link

In Microsoft.Rest.ClientRuntime.2.3.12, when you create a new RetryDelegatingHandler using the default CTOR, everything worked fine, and you could then assign the InnerHandler (which is of type HttpMessageHandler):

var handler = new RetryDelegatingHandler();
handler.RetryPolicy = retryPolicy;
handler.InnerHandler = new WebRequestHandler();

In Microsoft.Rest.ClientRuntime.2.3.15, this results in an ArgumentNullException, and you much provide a DelegatingHandler instance yourself. Notice, that since the CTOR requires a DelegatingHandler, you can't pass an WebRequestHandler instance like I did in the above code, and I now need to jump thru some hoops:

var handler = new RetryDelegatingHandler(retryPolicy, new SendableHandler(new WebRequestHandler()));

private class SendableHandler : DelegatingHandler
{
    public SendableHandler(HttpMessageHandler innerHandler) : base(innerHandler) { }

    public new Task<HttpResponseMessage> SendAsync(
        HttpRequestMessage request,
        CancellationToken cancellationToken)
    {
        return base.SendAsync(request, cancellationToken);
    }
}
@shahabhijeet
Copy link
Member

@saguiitay we will have an update most probably today.
Will update this issue once I publish the fix.

@shahabhijeet
Copy link
Member

New ClientRuntime has been published with the fix #4906

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

No branches or pull requests

2 participants