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

  • SEARCH
  • Home
  • 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 4022036
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:25:30+00:00 2026-05-20T10:25:30+00:00

In LINQ to SQL, I get the exception The query operator ‘ElementAt’ is not

  • 0

In LINQ to SQL, I get the exception “The query operator ‘ElementAt’ is not supported.” When trying to use the ElementAt extension method on an IQueryable returned from a LINQ to SQL query.

Here is the stack trace:

at System.Data.Linq.SqlClient.QueryConverter.VisitSequenceOperatorCall(MethodCallExpression mc)
   at System.Data.Linq.SqlClient.QueryConverter.VisitMethodCall(MethodCallExpression mc)
   at System.Data.Linq.SqlClient.QueryConverter.VisitInner(Expression node)
   at System.Data.Linq.SqlClient.QueryConverter.ConvertOuter(Expression node)
   at System.Data.Linq.SqlClient.SqlProvider.BuildQuery(Expression query, SqlNodeAnnotations annotations)
   at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
   at System.Data.Linq.Table`1.System.Linq.IQueryProvider.Execute[TResult](Expression expression)
   at System.Linq.Queryable.ElementAt[TSource](IQueryable`1 source, Int32 index)

Now I realize to get rid of this exception and to use ElementAt I could call ‘.ToList()’ before using the extension method and it will work. That is fine, but I still don’t like the fact that this is a runtime exception (and what seems like LSP violation).

Is there a reason why these methods cannot be supported? Is it just because they cannot be translated easily into SQL? What other IQueryable/IEnumerable extension methods are not supported, is there a list somewhere?

It would be nice to avoid runtime exceptions.

  • 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-05-20T10:25:31+00:00Added an answer on May 20, 2026 at 10:25 am

    From MSDN, Standard Query Operator Translation (LINQ to SQL) – this article contains the full list of operators that haven’t been translated:

    • TakeWhile , SkipWhile
    • Reverse
    • Last , LastOrDefault
    • ElementAt , ElementAtOrDefault
    • DefaultIfEmpty

    Operators with No Translation

    The following methods are not
    translated by LINQ to SQL. The most
    common reason is the difference
    between unordered multisets and
    sequences.

    Operators

    Rationale

    …

    ElementAt ,
    ElementAtOrDefault

    SQL queries operate on multisets, not
    on indexable sequences.

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

Sidebar

Related Questions

I'm trying to get the following SQL query to work in LINQ: Select id
With LINQ to SQL most likely going to not get as much active development
I am trying to get LINQ to SQL to persist changes to an attached
I'm still trying to get my head around LINQ and accessing a SQL Database.
I am trying to run a Linq-to-SQL query, but when the query is evaluated,
I'm trying to inject a dynamic where clause in my Linq to SQL query
When I generate entity classes using LINQ to SQL I get what I want
When I enter an object into the DB with Linq-to-SQL can I get the
This Linq to SQL query ... Return (From t In Db.Concessions Where t.Country =
I'm using LINQ to SQL to get a search result of a FullTextSearch stored

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.