Polly Retry : System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Flurl.Http.Content.FileContent'
I'm using flurl and polly as part of my code to post asynchronously - I'm having an issue with the retry policy and the file content getting disposed, on a retry the FileContent option has been disposed. I will get the following error: System.ObjectDisposedException: Cannot access a disposed object. Object name: 'Flurl.Http.Content.FileContent'. If someone could advise where best to place the logic to ensure FileContent is available for the retry var endpoint = $"api endpoint here"; if (!File.Exists(filePath)) { return Task.CompletedTask; } var fileBytesLength = _fileSystem.FileInfo.FromFileName(filePath).Length; var httpContent = new Flurl.Http.Content.FileContent(filePath, (int)fileBytesLength); return _statusRetryPolicy .StatusAsyncRetryPolicy() .ExecuteAsync(() => endpoint .WithOAuthBearerToken(accessToken) .WithTimeout(TimeSpan.FromMinutes(timeOutMinutes)) .WithHeader("Content-Type", "appl...