✅ Weird ASP0016 behavior
Is there a semantic difference between these two pieces of code? the first one is fine, but the second one gives me
ASP0016 (which i don't think is correct? it's late and i'm kind of an asp noob so i might be mistaken...). the only difference is that the lambda for atomLinks.Select has async/await in the first one, but not in the second.
Code 1, async/await, no warning
Code 2, no async/await, gives ASP0016
(weirdly, the warning also goes away if i eta-reduce the lambda into just the Utils.GetFeedAsync method group/name)
(also: Compiler version: '5.0.0-2.25472.11 (b48cd5e8)'. Language version: 13.0. just in case)ASP0016: Do not return a value from RequestDelegate
Learn about analysis rule ASP0016: Do not return a value from RequestDelegate
10 Replies
There's some misunderstanding there about what await Task.WhenAll is doing firstly. As you are doing a linq select, but discarding the result. What you are doing is storing a completed task (that Task.WhenAll returns) but discarding the Select() result
Hence your warning about discarding the delegate return
How is it discarding the select result? Doesn't
.WhenAll return a Task<TResult[]> containing the results of each of the tasks?Doesn't it just retirn a single task denoting all tasks passed in have completed?
the docs say
Creates a task that will complete when all of the Task<TResult> objects in an enumerable collection have completed.and it has this signature:
Honestly I might be rambling it's 4am here 😅
I think you might be confusing it with
Task.WaitAll?
yep same timezone here, my eyes are barely staying openI'll circle back tomorrow when brain working again
I'm curious myself now
it might be an analyzer bug honestly, these asp analyzer are a lil finicky in my experience lol
Looking at that analyzer, I have no idea why it would decide to fire there
As you say, those two bits of code are effectively equivalent
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View