locked
async await... get lost... RRS feed

  • Question

  • Hello,

    I'm tring to follow the samples I've found in TPLDataflow.docx but I got an error when I define async wait..... it says for example

     

         private async Task Consumer()
            {
                       int item = m_buffer.ReceiveAsync();
            }

     

    ; expected...

     

    what am I doing wrong?

    Thanks

    Wednesday, July 6, 2011 1:40 PM

Answers

  • Hi Ponzano-

    There should be an 'await' keyword before the m_buffer.ReceiveAsync() line; if that's missing in the document, it's an error in the document and we'll fix that.  The snippet would actually be:

    private async Task Consumer()
    {
        int item = await m_buffer.ReceiveAsync();
    }

    If that still doesn't work, it may be that the Async CTP didn't install correctly.  Are the "async" and "await" keywords getting correctly color coded in the IDE in blue as other keywords are (like "private")?

    -Stephen

    Wednesday, July 6, 2011 2:48 PM