C#C
C#2y ago
4 replies
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);
}

This is my first time using polly and this has me very confused
Was this page helpful?