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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:35:54+00:00 2026-05-29T07:35:54+00:00

I have an error log from a user with a stack trace that I

  • 0

I have an error log from a user with a stack trace that I don’t fully understand. Here’s how it looks

Stack Trace:
   at ...Presenters.Forms.PresenterHome.<GetCounts>b__f(IActivityItem activityItem)
   at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source, Func`2 predicate)
   at ...Presenters.Forms.PresenterHome.GetCounts(Int32& completeCount, Int32& incompleteCount)
   at ...Presenters.Forms.PresenterHome.UpdateSummaryPanel()
   .....

(I have removed the start of some namespaces to protect client’s identity)

The part I don’t understand is <GetCounts>b__f(...) and why it is called after Enumerable.Count[...](...). I assume it has something to do with the Count predicate but I can’t quite decipher this.

If it helps the exception is an InvalidCastException. Here is some of the code involved (slightly modified to protect identity).

void UpdateSummaryPanel()
{
    int completeCount;
    int incompleteCount;
    GetCounts(out completeCount, out incompleteCount);
    ...
}

private void GetCounts(
    out int completeCount, 
    out int incompleteCount)
{
    incompleteCount = _applicationContext.ActivityItems.Count(
        activityItem => activityItem.ActivityType == ActivityTypes.Foo
                        && ((FooActivity) activityItem).Status != CaptureStatus.Bar);

    // similar code for other count
}

For what it’s worth I’m pretty sure I know what’s causing the error (ie where the bad cast is) but what I’m really curious about is that <GetCounts>b__f(...) member in the stack trace.

  • 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-29T07:35:57+00:00Added an answer on May 29, 2026 at 7:35 am

    If you open up your assembly with Reflector, dotPeek etc, you’ll see that the compiler has put the logic for your lambda expression inside GetCounts into another method – in this case <GetCounts>b__f. This is entirely normal for lambda expressions and anonymous methods – and some other C# features (iterator blocks, anonymous types, automatically implemented methods etc) also create members for you automatically.

    The angle-brackets in the name are a good indication of it being compiler-generated: the compiler uses an unspeakable name – one which isn’t a valid identifier – to make sure that not only will there not be any collisions with your other members, but you’ll also never be able to refer to these “hidden” members within your code.

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

Sidebar

Related Questions

I have a file called error.log on my server that I need to frequently
We have an error that we can't seem to find and don't have the
I have this error that is keeping me from moving forward. I basically have
I have a log file that has lines that look like this: 1,2546857-23541,f_last,user,4:19 P.M.,11/02/2009,START,27,27,3,c2546857-23541,
Advance New Year Wishes to All. I have an error log file with the
this is my code and have a error: $('#map_canvas').mouseover(function(e){ console.log(e.offset().left+' '+e.offset().top) }) thanks i
I have an error occuring frequently from our community server installation whenever the googlesitemap.ashx
You have an error in your SQL syntax; check the manual that corresponds to
I have created a database that stores data from the internet.When there is internet
I have a Silverlight 4 user control that calls a WCF service residing within

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.