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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:10:14+00:00 2026-05-11T05:10:14+00:00

I wrote a fairly complex method that yield-returns IEnumerable<string> , but when I inspected

  • 0

I wrote a fairly complex method that yield-returns IEnumerable<string>, but when I inspected the compiler output in Reflector, I didn’t understand a specific part of the compiler-generated implementation of IEnumerator:

void IDisposable.Dispose() {     switch (this.<>1__state)     {         case 1:         case 2:         case 3:             switch (this.<>1__state) // empty switch! why?!             {             }             break;          default:             return;             try   // What?! AFTER return?!             {             }             finally // is the try-finally block anyhow relevant?             {                 this.<>m__Finallya();             }             break;     }     this.<>m__Finally7(); } 

I’m guessing (or hoping) that Reflector misplaced the closing brace of the outer switch, and that it should be directly after the return. Still, I don’t understand why there is an empty switch in case 3, or why m__Finallya is being called in a finally block. (Is there a semantic difference between running normally and inside a finally block? Other than CER’s, which I don’t have in my code.)

For reference, here is the IL:

.method private hidebysig newslot virtual final          instance void  System.IDisposable.Dispose() cil managed {   .override [mscorlib]System.IDisposable::Dispose   // Code size       69 (0x45)   .maxstack  2   .locals init ([0] int32 CS$0$0000,            [1] int32 CS$0$0001)   IL_0000:  ldarg.0   IL_0001:  ldfld      int32 FBD.TIP.Reader.MissingMessagesReader/'<GetMissingMessages>d__0'::'<>1__state'   IL_0006:  stloc.0   IL_0007:  ldloc.0   IL_0008:  ldc.i4.1   IL_0009:  sub   IL_000a:  switch     (                          IL_001c,                         IL_001c,                         IL_001c)   IL_001b:  ret   IL_001c:  ldarg.0   IL_001d:  ldfld      int32 FBD.TIP.Reader.MissingMessagesReader/'<GetMissingMessages>d__0'::'<>1__state'   IL_0022:  stloc.1   IL_0023:  ldloc.1   IL_0024:  ldc.i4.2   IL_0025:  sub   IL_0026:  switch     (                          IL_0035,                         IL_0035)   IL_0033:  br.s       IL_003e   .try   {     IL_0035:  leave.s    IL_003e   }  // end .try   finally   {     IL_0037:  ldarg.0     IL_0038:  call       instance void FBD.TIP.Reader.MissingMessagesReader/'<GetMissingMessages>d__0'::'<>m__Finallya'()     IL_003d:  endfinally   }  // end handler   IL_003e:  ldarg.0   IL_003f:  call       instance void FBD.TIP.Reader.MissingMessagesReader/'<GetMissingMessages>d__0'::'<>m__Finally7'()   IL_0044:  ret } // end of method '<GetMissingMessages>d__0'::System.IDisposable.Dispose 
  • 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-11T05:10:15+00:00Added an answer on May 11, 2026 at 5:10 am

    That is simply reflector struggling to keep up with the IL that has been generated (since iterator blocks don’t have to relate to ‘normal’ C# as long as they are valid IL). In particular, the ret is after the finally block.

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

Sidebar

Ask A Question

Stats

  • Questions 124k
  • Answers 124k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Are you running on OS 3.0? I saw the same… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer It looks like you need to register Apache::Session::Memcached with Apache::Session::Wrapper,… May 12, 2026 at 1:19 am
  • Editorial Team
    Editorial Team added an answer Use DATENAME or DATEPART: SELECT DATENAME(dw,GETDATE()) -- Friday SELECT DATEPART(dw,GETDATE())… May 12, 2026 at 1:19 am

Related Questions

A project I'm working on at the moment involves refactoring a C# Com Object
I am trying to call out to a legacy dll compiled from FORTRAN code.
I'm starting a fairly complex Swing application that heavily graphics-oriented with about 1000 separate
I can find lots of information on how Long Polling works (For example, this

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.