C
C#11mo ago
Ploot

✅ [Solved] [Polly] Not all code paths return a value

I have a method here that claims not all paths return a value despite not having an branches?
public async Task<Stream> GetAsync(Uri remoteAddress, string path, CancellationToken cancellationToken = default)
{
ResiliencePipeline<HttpResponseMessage> pipeline = resiliencePipeline.GetPipeline<HttpResponseMessage>("get-pipeline");
UriBuilder endpoint = new(remoteAddress) { Path = path };
HttpResponseMessage reqResp = await pipeline.ExecuteAsync(async token => await _httpClient.GetAsync(endpoint.Uri, token), cancellationToken);
await reqResp.Content.ReadAsStreamAsync(cancellationToken);
}
public async Task<Stream> GetAsync(Uri remoteAddress, string path, CancellationToken cancellationToken = default)
{
ResiliencePipeline<HttpResponseMessage> pipeline = resiliencePipeline.GetPipeline<HttpResponseMessage>("get-pipeline");
UriBuilder endpoint = new(remoteAddress) { Path = path };
HttpResponseMessage reqResp = await pipeline.ExecuteAsync(async token => await _httpClient.GetAsync(endpoint.Uri, token), cancellationToken);
await reqResp.Content.ReadAsStreamAsync(cancellationToken);
}
This is my first time using polly and this has me very confused
3 Replies
Angius
Angius11mo ago
You don't seem to return anything from this method
Ploot
PlootOP11mo ago
:AA_Kanna_Facepalm: its 5am
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?