Using light bulb action to refactor asynchronous method to synchronous – Visual Studio 2015

By | June 1, 2016

In Visual Studio 2015, using the light bulb action, we can simplify the refactoring a method from Asynchronous to Synchronous when it does not use any ‘await’ .  In case you don’t have an await call inside the method definition, the IDE refactoring light bulb will show an indication and will give you hints to refactor .  You can apply this refactoring to entire project or solution. IDE

Consider you have following method where you indented to make an async call to service, where as your service call is a synchronous ,


The yellow light build indicates that the method does not have any ‘await’ operator and it is suggesting to refactor it to a synchronous  method.


Refactoring Async To Sync

You can apply this for this file, project or even entire solution, so that the refactoring can be done throughout.

Related Tip : Add Using command for misspelled types using”fuzzy” matching – Visual Studio 2015

Alternatively, if you have an ‘await’ operator, but you missed the async, if you can take help of light bulb operator to change.



Hope this helps !

5 thoughts on “Using light bulb action to refactor asynchronous method to synchronous – Visual Studio 2015

  1. Pingback: Dew Drop – June 2, 2016 (#2264) | Morning Dew

  2. Pingback: Compelling Sunday – 17 Posts on Programming and QA

  3. Mladen Mihajlovic

    Hi Abhijit

    I love your .net tips but could I make a small suggestion about your blog. Whenever you show source code images, the fonts and colours make your blog look messy and therefore it’s a bit hard to follow. Could you maybe try changing the background of the images to something darker so that they stick out a bit more and therefore the eye would not try and follow the test as if it was part of the blog post. (Also choosing the dark theme in vs when taking the images would allow for the same effect)

  4. Pingback: Visual Studio – Developer Top Eleven for June 9th, 2016 - Dmitry Lyalin

  5. Abhijit Jana Post author

    Could you please share some screenshots.. on what you are looking in .. I really appreciate your feedback, and will change accordingly..
    Thank you.

Comments are closed.