Identifier expected; 'async' is a keyword - Compiling sample

May 22, 2011 at 7:35 PM

I had a compile error in the samples related to the use of a variable named “async”.  

Identifier expected; 'async' is a keyword

 I have the Async CTP installed which makes the compiler see “async” as a C# keyword. Simply renaming the variable (“asyncX”) was all I had to do:

\Samples\Libraries\System.Data.Services.Client\System\Data\Services\Client\DataServiceContext.cs – Line 3092:

 internal SaveResult(DataServiceContext context, string method, DataServiceRequest[] queries, SaveChangesOptions options, AsyncCallback callback, object state, bool asyncX)

Gary Davis

Coordinator
May 22, 2011 at 7:50 PM

Interesting, thanks for the info.  We'll look into it and potentially add it in our troubleshooting section.

May 22, 2011 at 9:51 PM

Just rename your sample source code variable then you don’t need to worry about your users encountering the error and no need to update the troubleshooting.

Gary

From: wwegner [email removed]
Sent: Sunday, May 22, 2011 2:50 PM
To: gary@webguild.com
Subject: Re: Identifier expected; 'async' is a keyword - Compiling sample [watoolkitwp7:258554]

From: wwegner

Interesting, thanks for the info. We'll look into it and potentially add it in our troubleshooting section.

Coordinator
May 23, 2011 at 4:17 PM

Yep, that's what we'll do.  We'll rename the async variable to execAsync to avoid troubles with the Visual Studio Async CTP component.

Nov 9, 2011 at 5:33 AM

We have a similar issue, except that this async is part of an external assembly FreeThreadedDOMDocument40Class.async.  At a loss as to how to handle this one.