Why is Async Code Hard to Debug?

Play Why is Async Code Hard to Debug?

The Discussion

  • User profile image
    Thank you Leslie and Isadora, this is valuable information. I've been struggling with trying to figure out how to use Async/Await in the constructor of a class. We're writing some WPF apps using .NET 4.5.2. Async/await isn't allowed in class constructors (ViewModels in our WPF code). Unfortunately, the architect of the application requires that we get all records out of a table (and maybe one of two related tables) when the class is instantiated. Since all our tables use longs for the ID, that could be a LOT of data. When there's 40K or more records, it takes an awfully long time to bring that down. I hope that you'll discuss this.
  • User profile image
    @RodAtWork: I would say your architect is a fool! Only minimal work sould be done in the constructor. You should not block the app just because you instanciate an object.

    More info:

Add Your 2 Cents