Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7969663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:16:20+00:00 2026-06-04T07:16:20+00:00

The following code will not compile against the Async CTP in Visual Studio 2010:

  • 0

The following code will not compile against the Async CTP in Visual Studio 2010:

Enumerable.Range(1, 5).Select(async x =>
{
    await TaskEx.Delay(100);
    return 5;
});

The compilation error is as follows:

Test.cs(40,13): error CS1928: 'System.Collections.Generic.IEnumerable<int>' does not contain a definition for 'Select' and the best extension method overload 'System.Linq.Enumerable.Select<TSource,TResult>(System.Collections.Generic.IEnumerable<TSource>, System.Func<TSource,TResult>)' has some invalid arguments
Test.cs(40,49): error CS1503: Argument 2: cannot convert from 'lambda expression' to 'System.Func<int,int>'

However, by my read, the following should occur here:

  • The overload IEnumerable<TResult> Select<TSource, TResult>(this IEnumerable<TSource> source, Func<TSource, TResult> selector) should be used.
  • As the .Range(1, 5) is IEnumerable<int>, TSource is int
  • Making the lambda async, taking an int and returning an int should produce a Task<int>, which is what TResult should be.

I don’t see a syntax issue here. What is the problem?

Note that I cannot use VS11 yet because my main application requires Azure tools.

EDIT: This works fine with msbuild at the command line, but not in VS2010. It seems that at the command line, the VS11 compiler is being used even though I’m targeting .NET 4.0, whereas VS2010 uses its own in-process compiler. Does anyone know how to swap out the compiler that VS2010 uses?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:16:21+00:00Added an answer on June 4, 2026 at 7:16 am

    Works in my LINQPad (VS11 Beta installed on the machine)

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please help me to understand why the following code will not compile: #include <stdio.h>
Any idea why the following code will not compile? IEnumerable users; using (var ent
The following code using boost::asio will not compile: #ifndef _SERVER_H_ #define _SERVER_H_ #include Connection.h
Please consider the following code and comments: Console.WriteLine(1 / 0); // will not compile,
The following code will not compile with G++ 4.5 or 4.6 (snapshot). It will
I was just curious about this: the following code will not compile, because we
The following [c#] code will not compile with the error operator == cannot be
I have the following code snippet. This is a c file in visual studio
The following source file will not compile with the MSVC compiler (v15.00.30729.01): /* stest.c
In C#, the following method will not compile: public bool IsItTrue() { } The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.