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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:18:09+00:00 2026-05-28T01:18:09+00:00

The DebuggerStepThrough attribute allows you to skip breaking into certain methods/classes/properties. In DebuggerStepThrough being

  • 0

The DebuggerStepThrough attribute allows you to skip breaking into certain methods/classes/properties.

In DebuggerStepThrough being ignored it is clarified that the c# compiler does not inherit this attribute into the compiler generated IEnumerable<T> implementation.

A trivial example of such a failure is:

static void Main(string[] args)
{
    var a = SkipMe().ToList();
}

[System.Diagnostics.DebuggerStepThrough]
static IEnumerable<int> SkipMe()
{
    // comment out line below and the throw will be stepped over.
    yield return 1;
    throw new Exception();
}

Is there a way to get the C# compiler to add the DebuggerStepThrough attribute to the auto generated type?

Is there a way to get visual studio to skip debugging into any types with the [CompilerGenerated] attribute?

—

Addendum: some illustrative screenshots

Result after pressing F5

screen 1

screen 2

Visual Studio Version:

snip 3

Our missing attribute:

the missing attribute

  • 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-28T01:18:10+00:00Added an answer on May 28, 2026 at 1:18 am

    I don’t think there is a way to achieve the effect you’re looking for.

    • There is no way to make the C# compiler copy this attribute into the generate state machine method.
    • You can’t get around this by adding DebuggerStepThrough to the class containing the iterator method. The debugger only looks at the immediate parent type not the types containing a nested type.

    The only real way I can think of to achieve this is to put all of the code you don’t want to debug into in a separate DLL. Then don’t load the PDB for that particular DLL.

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

Sidebar

Related Questions

I'd like to avoid the debugger breaking into a series of validation helper methods
When I auto-generate my client classes I get these attributes. <System.Diagnostics.DebuggerStepThroughAttribute(), _ System.CodeDom.Compiler.GeneratedCodeAttribute(System.Runtime.Serialization, 4.0.0.0),
I have a web service that returns a simple object: [System.CodeDom.Compiler.GeneratedCodeAttribute(System.Xml, 2.0.50727.4927)] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()]
I have noticed lately that the Visual Studio 2010 debugger keeps jumping into this
I have a class that takes standard address properties and stores them. The State
In the context of a click-once application that is being debugged locally with exception
I have following problem. In my view model I defined some list properties as
I have a WSDL that the consumer of my web service expects will be
I have a project that is auto generated. This project is referenced by my
I am attempting to create a wcf service that accepts any input (Action=*) and

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.