Dotnet logo

.NET Tools

Essential productivity kit for .NET and game developers

How-To's

Async CTP Support in ReSharper 6.1

This post is about ReSharper 6.1. For other features in ReSharper 6 (both 6.0 and 6.1), please see previous posts introducing ReSharper 6:

If there was one feature that has received ample attention in the run-up to ReSharper 6.1, it would have to be the request for async/await support. Despite the fact that this technology has not yet been finalized, community demand as well as the timely release of a preview version of Visual Studio vNext have convinced the ReSharper team to put in the effort to provide quality support for Async CTP.

And we’re not talking just about support for the keywords, either! The following is a list of some of the features that make working with the new features easy and enjoyable.

  • Keyword completion — somewhat unsurprisingly, async and await are now keywords that ReSharper knows about:
  • Smart completion supports async methods too. In the example below, ReSharper knows that an int return type is expected, and offers appropriate suggestions.
  • ReSharper enforces naming conventions for async methods. The “Async” suffix is configurable in the Options dialog.
  • When changing your methods to become async, you can correct the return type of an async method:
  • ReSharper verifies async propagation, so if you forget to decorate an await‘ing method with async, you will be reminded to do this:

    This also works in cases where the method is anonymous (i.e., a delegate or lambda expression):
  • ReSharper will also complain about the synchronous execution of async methods that do not contain any await instructions in them:
  • Finally, ReSharper comes with a set of analyses helping you ensure correct usage of async and await constructs. For example, in the screenshot below, ReSharper would complain about the fact that ref and out parameters are not permitted in an async method, as well as the fact that null is not awaitable:

Finally, async support permeates various areas of ReSharper infrastructure such as, e.g., its support in SSR (Structured Search & Replace). Overall, the async and await-related features have established themselves in the product, where they will stay and be improved upon until the technology’s eventual release.

image description