Skip to content

SendPostRequestAsync()'s retry logic causes ObjectDisposedException #26

@nshenoy

Description

@nshenoy

In .NET Framework, the HttpClient automatically disposes the HttpContent after the request is made (see dotnet/runtime#14612). In the RequestManager's SendPostRequestAsync() implementation, calling the RunWithRetries() method will call subsequent retry calls to the underlying client.PostAsync() to fail as the original HttpContent gets disposed after the initial failed call. This was found because our code is exactly hitting this issue with the following message: Cannot access a disposed object. Object name: 'System.Net.Http.StringContent'. Consider restructuring this code in such a way that the HttpContent is recreated on each retry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions