The C# async await Workout

Sign in to queue

The Discussion

  • User profile image
    Ankit Sahu

    I need to learn async await

  • User profile image
    danschatz

    Async is a topic I was hoping to get some help with, but this really disappointed. This session was unorganized and hard to follow, and seemed to be thrown together very quickly. The single example went way off the reservation with Azure Functions, and it just didn't help me understand Async at all. Every other .Net Conf session has been great, but this one really didn't come close.

  • User profile image
    BrianB

    Very helpful. Thanks Bob.

  • User profile image
    jamesriby

    @danschatz:Version:1.0 StartHTML:000000216 EndHTML:000002513 StartFragment:000002023 EndFragment:000002477 StartSelection:000002023 EndSelection:000002477 SourceURL:https://channel9.msdn.com/Events/dotnetConf/2017/T316

    I thought it was great, the exact opposite of what you found danschatz. Sorry you found it unhelpful. It needed more time at the end, true, to go slower through the example, and hopefully Bob will upload another video on it soon. Another good video I found on async (with a perhaps simpler example) is in this LinkedIn course called 'C# and .NET: Programming' by Alexander Zanfir: https://www.linkedin.com/learning/c-sharp-dot-net-programming/next-steps

  • User profile image
    eliassal1

    Bob, I created the SimpleAsyncConsoleApp with the exact same code shown on the screen

    static async Task Main(string[] args)

    {

    Console.WriteLine("Calling..........");

    var mystring = await DoItAsync();

    .........

    }

     

    and

    private async static Task<string> DoItAsync()

    {

    var httpclient = new HttpClient();

    var message = await httpclient.GetAsync("devu.com");

    var content = await message.Content.ReadAsStringAsync();

    return content;

    }

    When I compile, I get the following error:

     

    Error CS5001 Program does not contain a static 'Main' method suitable for an entry point SimpleAsyncConsoleApp

     

    Any idea why this is happening, thanks in advance

  • User profile image
    tbertenshaw

    @eliassal1: i had the same problem. The async main is a c#7.1 feature. It seems you need to change the default settings in the project properties,build,advanced button. to Minor. It seems to be set to Major by default and thus picking up 7, not 7.1 or 7.2 for example. Think you may also need to ensure you have latest version of visual studio you need at least 2017 (15.3) i believe.

  • User profile image
    RomainFerrec

    Thanks you Bob for this introduction on asynchronous programming in C#. I was a little stuck trying to understand what the "await" is supposed to do, and you answered very well to it.

    For people who wants to learn more on this, you can follow this MOOC made by Microsoft on EDX.

    I hope we will continue to see you teaching us more on async in C#, it is an interesting topic and you teach very well, so it must happens ! :)

    Greetings from France.

  • User profile image
    AndersRask

    Sorry, but this is quite poor and not really worth watching!

    The presenter Bob Tabor does seem to be very knowledgeable and generally a great presenter. However, he seems to have been called in for this with very short notice and therefore very limited preparation. Several times he acknowledges this himself and says there should maybe be a follow-up video on a number of things.

    The video has been part of a bigger event, and of course we can all understand when something goes wrong for a planned event, and they have to call someone in to stand in for another presenter.

    But this video should not have stayed on Channel 9.

    The topic is relevant and they should have had something else, for example with Bob Tabor.

    But this video is poor, and it should be removed and replaced!

     

  • User profile image
    robauersi

    I thought this was fantastic. I agree that it was a bit rushed to fit the time frame, but frankly I don't have all day to watch a training video - so the pace was very good for me.

Add Your 2 Cents