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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:47:20+00:00 2026-05-11T15:47:20+00:00

I want use a Linq IQueryable Toolkit in project on .NET Compact Framework. The

  • 0

I want use a Linq IQueryable Toolkit in project on .NET Compact Framework. The Linq capabilities in CF is little bit shapred – i.e.: IQueryable interface is not available. So I’ve found third party libraries, which implements missing functionality what I need.

Now I have problem with missing method ‘MethodBase.GetCurrentMethod()’. There is cca 100 methods, which uses this method. So I don’t need the exact clone of ‘GetCurrentMethod()’. The workaround way for this specific case is enough.

Sample of original code:

public static bool Any<TSource>( this IQueryable<TSource> source ) {     return source.Provider.Execute<bool>( Expression.Call( null, ((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod( new Type[] { typeof( TSource ) } ), new Expression[] { source.Expression } ) ); }  public static bool Any<TSource>( this IQueryable<TSource> source, Expression<Func<TSource, bool>> predicate ) {     return source.Provider.Execute<bool>( Expression.Call( null, ((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod( new Type[] { typeof( TSource ) } ), new Expression[] { source.Expression, Expression.Quote( predicate ) } ) ); } 

The posibile solution is replace ‘(MethodInfo)MethodBase.GetCurrentMethod()’ with specific method call. For example: GetMethod_Any_TSource_On_Source() and GetMethod_Any_TSource_On_Source_With_Predicate_TSource_Bool().

I search for some handy solution how to solve it.

  • 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. 2026-05-11T15:47:21+00:00Added an answer on May 11, 2026 at 3:47 pm

    See this discussion

    It is essentially impossible in plain managed code in Compact Framework 1.0.

    In 2.0 is it possible but error prone, fragile and most importantly NOT guaranteed to be correct (a serious flaw).

    I would suggest instead writing a macro which can find all instances of ‘((MethodInfo)MethodBase.GetCurrentMethod())’ and determinte the method in which they reside.

    Simply converting every line like so

    '.*\(\(MethodInfo\)MethodBase\.GetCurrentMethod\(\)\).*' 

    to throw new Exception((MethodInfo)MethodBase.GetCurrentMethod()).Name);

    • Compile for the non compact framework (fixing by hand the locations that the regex replace broke, there shouldn’t be many)
    • Run every method in the classes where replacements happened by reflection
    • catch the resulting exceptions and print the message (method name) and the first line of the stack trace.

    This then gives you a list of what you need to put in directly at each call site (probably backed up by a lazily created static field holding the MethodInfo for each one.

    This is cumbersome but might work reasonably well as a one off action pre framework update though to be honest it might be just as quick to go through and do it by hand.

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

Sidebar

Related Questions

I want to use LINQ's IQueryable that gives me the query that gets only
I'm trying to use Linq to SQL to return an IQueryable(of Project) when using
I'm using System.Data.Linq.DataContext file for accessing a mdf Database I want to use the
I want to use Powershell to write some utilities, leveraging our own .NET components
I want to use linq to sort a resultset. The resultset should contain all
I want to use LINQ to group data from a DataTable (columns: userid, chargetag,
I'm using NHibernate 2.1.2 GA. We want to use LINQ for NHibernate with it,
I have a list in my boo script and want to use System.Linq Extension
I want to use chained linq. I am having some trouble with the syntax.
I want to use LINQ to pass data from one custom collection to another.

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.