This resolves #1529 - specifically, these analyzers/refactorings become aware of custom awaitables/custom task-like types:
RCS1046/RCS1047 (async/sync method name should/should not end in Async)
RCS1090 (use/remove ConfigureAwait(false))
RCS1229/RCS1174 (use/remove async/await)
RCS1261 (dispose asynchronously)
RR0209 (remove async/await)
Remarks
RCS1090's behaviour is less obvious here - it seems there is no official stance for duck-typing ConfigureAwait (even Roslyn isn't perfectly consistent), but I'm of the opinion that if the rest of the ducks are quacking, it's better to join the flock 😄 The result is that these checks are relaxed from the Task-specific ConfiguredTaskAwaitable(`1) return type to any awaitable return type.
Description
These changes add the same logic for checking duck-typed awaitables and task-like types that is currently in Roslyn.
This resolves #1529 - specifically, these analyzers/refactorings become aware of custom awaitables/custom task-like types:
Async
)ConfigureAwait(false)
)async
/await
)async
/await
)Remarks
RCS1090's behaviour is less obvious here - it seems there is no official stance for duck-typing
ConfigureAwait
(even Roslyn isn't perfectly consistent), but I'm of the opinion that if the rest of the ducks are quacking, it's better to join the flock 😄 The result is that these checks are relaxed from theTask
-specificConfiguredTaskAwaitable(`1)
return type to any awaitable return type.I noticed there were some checks for WinRT async interfaces, these are covered as there's an extension
GetAwaiter()
method available on those types.I'm not experienced with analyzers and their edge cases so it's possible I've missed writing some obvious tests, I'd love to get your feedback.