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

In SDK 5, retryHandlerOption not working with ASP.NET 8 CalenderView.GetAsync #2605

Closed
arogan opened this issue Aug 1, 2024 · 2 comments
Closed
Labels

Comments

@arogan
Copy link

arogan commented Aug 1, 2024

Describe the bug

I am using the Microsoft.Identity.Web.GraphServiceClient and calling GetAsync off of CalendarView. When I add retryHandlerOption I get an error: The request was canceled due to the configured HttpClient.Timeout of 100 seconds.
As soon as I remove the retryHandlerOption the call works fine.

var retryHandlerOption = new RetryHandlerOption
{
    MaxRetry = 7,
    ShouldRetry = (delay,attempt,message) => true
};

var foundEvents = await _graphServiceClient.Users[email].CalendarView.GetAsync(requestConfiguration =>
    {                               
        requestConfiguration.QueryParameters.StartDateTime = startDate.ToString("yyyy-MM-ddT00:00:00");
        requestConfiguration.QueryParameters.EndDateTime = endDate.Value.ToString("yyyy-MM-ddT23:59:59");
       requestConfiguration.Options.Add(retryHandlerOption);  //if I remove this line the code works fine
    });

Expected behavior

If I console out in the delegate I can see retries are happening but it always times out and the getasync always fails. I expect getAsync to succeed like normal when I add the retryHandlerOption.

How to reproduce

This code was run in an asp.net web api.

SDK Version

5.56.0

Latest version known to work for scenario above?

4.40.0

Known Workarounds

Don't use retry which really isn't a work around since I want resiliency, or go back to 4.40, or maybe roll my own using Polly.

Debug output

Click to expand log The request was canceled due to the configured HttpClient.Timeout of 100 seconds
</details>


### Configuration

Development on windows 11
x64

API runs inside docker from image:
mcr.microsoft.com/dotnet/aspnet:8.0.7-bookworm-slim


### Other information

_No response_
@arogan arogan added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Aug 1, 2024
@andrueastman
Copy link
Member

Thanks for raising this @arogan

Any chance the code works if you remove the line with the delegate? I suspect since you are always returning true, even successful responses are being retried....

var retryHandlerOption = new RetryHandlerOption
{
    MaxRetry = 7,
};

@andrueastman andrueastman added status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned labels Aug 2, 2024
@arogan
Copy link
Author

arogan commented Aug 2, 2024

Thanks for raising this @arogan

Any chance the code works if you remove the line with the delegate? I suspect since you are always returning true, even successful responses are being retried....

var retryHandlerOption = new RetryHandlerOption
{
    MaxRetry = 7,
};

Yes, removing the delegate worked! GetAsync returns successfully now. Thanks.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 and removed status:waiting-for-author-feedback Issue that we've responded but needs author feedback to close labels Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants