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 8650589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:51:33+00:00 2026-06-12T13:51:33+00:00

After upgrading from Visual Studio 2010 to 2012 code started throwing ArgumentOutOfRangeException – Index

  • 0

After upgrading from Visual Studio 2010 to 2012 code started throwing “ArgumentOutOfRangeException – Index was out of range. Must be non-negative and less than the size of the collection.Parameter name: index” on Linq queries using Joins.

The following simple example made in LINQPad (using an EF data model) gives me the ArgumentOutOfRangeException:

void Main()
{
    var iq1 = Customers.Select(ap => ap.ID);
    var iq2 = iq1.Join(Customers.Select(ap => ap.ID),
                    a => a,
                    b => b,
                    (a, b) => new { a });

    iq2.Dump(); 
}

Changing the previous example to return an anonymous object containing both sides of the join doesn’t give the ArgumentOutOfRangeException and gives results as expected:

void Main()
{
    var iq1 = ActionPlans.Select(ap => ap.ID);
    var iq2 = iq1.Join(ActionPlans.Select(ap => ap.ID),
                    a => a,
                    b => b,
                    (a, b) => new { a, b });

    iq2.Dump(); 
}

Ok, so for some reason I had to return both sides of the join, but then I tried the following example using a dummy value instead, that also executed without a problem:

void Main()
{
    var iq1 = ActionPlans.Select(ap => ap.ID);
    var iq2 = iq1.Join(ActionPlans.Select(ap => ap.ID),
                    a => a,
                    b => b,
                    (a, b) => new { a, x = 1 });

    iq2.Dump(); 
} 

Taking the first example and adding a ToList() to the first query also makes it execute without a problem:

void Main()
{
    var iq1 = ActionPlans.Select(ap => ap.ID).ToList();
    var iq2 = iq1.Join(ActionPlans.Select(ap => ap.ID),
                    a => a,
                    b => b,
                    (a, b) => new { a });

    iq2.Dump(); 
}

Important: Trying the first query on a workstation without the Visual Studio 2012 upgrade works fine!

Can anyone confirm/explain this new “feature”? 🙂

  • 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-12T13:51:35+00:00Added an answer on June 12, 2026 at 1:51 pm

    Erwin, just to close the loop on this: We have confirmed that it is a bug we introduced recently in LINQ to Entities and we are looking at ways to get a fix out. Thanks a lot for reporting it!

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

Sidebar

Related Questions

After installing Visual Studio 2012 and opening/upgrading a Visual Studio 2010 solution from Team
We've recently upgraded from Oracle 10 to Oracle 11.2. After upgrading, I started seeing
After upgrading from EF 4.2 and Migration to EF 4.3 and enabling migration,restarting Visual
Problems started after upgrading from VWD2005 to VWD2008. In VWD2008 the App_Code does not
After upgrading from TFS 2008 to 2010 and running crazy having the build to
After upgrading from Spring 3.0.0.M4 to 3.0.0.RC1 and Spring Security 3.0.0.M2 to 3.0.0.RC1, I've
I noticed after upgrading from 4.2 to 4.3.1 that there is no longer a
After upgrading to a newer hibernate version (guess it came with the switch from
After upgrading to ReSharper5 it gives me even more useful tips on code improvements.
I have a Visual Studio 2010 C# webforms solution with various projects in it.

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.