1

When converting a large project and migrating to async, one easy mistake is to forget awaiting them everywhere. Now the cs compiler will complain whenever we call a task and not await it, ONLY when this call is made from inside another async method. In synchronous methods, cs will remain silent, but you'll be bitten at runtime. I tried treating all warnings as errors, but nothing is changed, as I was not getting warnings in the first place.

So here is my question: Is there any way to make vs 2017 complain about not awaiting async Tasks from everywhere, including from non-async methods?

If you're aware of any light-weight and free add-on (not resharper, for instance), that can solve this, it would be appreciated as well.

4
  • By default VS shows it as warning "The async methods lack await" in warning panel Commented Oct 29, 2018 at 13:24
  • @Eldho Strangely, it will only show this warning when you call (but not await) an async mthod from inside another async method. No warning is shown when you call the async method from a synchronous method. Commented Oct 29, 2018 at 13:28
  • Could you add pseudo code which is easy to visualize Commented Oct 29, 2018 at 13:29
  • Oh I guess this happens when the called method returns a Task but is not known to be async. This happens a lot when you are calling the async method through an interface. Commented Oct 29, 2018 at 13:30

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.