C
C#9mo 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
Angius9mo ago
You don't seem to return anything from this method
Ploot
PlootOP9mo ago
:AA_Kanna_Facepalm: its 5am
Unknown User
Unknown User9mo ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server