Note that there are some explanatory texts on larger screens.

plurals
  1. POCan DebuggerStepThrough be inherited into the automatically generated IEnumerable implementation?
    primarykey
    data
    text
    <p>The <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.debuggerstepthroughattribute.aspx" rel="nofollow noreferrer">DebuggerStepThrough</a> attribute allows you to skip breaking into certain methods/classes/properties.</p> <p>In <a href="https://stackoverflow.com/questions/4559034/debuggerstepthrough-being-ignored">DebuggerStepThrough being ignored</a> it is clarified that the c# compiler does not inherit this attribute into the compiler generated <code>IEnumerable&lt;T&gt;</code> implementation. </p> <p>A trivial example of such a failure is: </p> <pre><code>static void Main(string[] args) { var a = SkipMe().ToList(); } [System.Diagnostics.DebuggerStepThrough] static IEnumerable&lt;int&gt; SkipMe() { // comment out line below and the throw will be stepped over. yield return 1; throw new Exception(); } </code></pre> <p>Is there a way to get the C# compiler to add the <code>DebuggerStepThrough</code> attribute to the auto generated type? </p> <p>Is there a way to get visual studio to skip debugging into any types with the <code>[CompilerGenerated]</code> attribute? </p> <p>-- </p> <p>Addendum: some illustrative screenshots </p> <p>Result after pressing <kbd>F5</kbd></p> <p><img src="https://i.stack.imgur.com/Wqbdw.png" alt="screen 1"> </p> <p><img src="https://i.stack.imgur.com/Vdprr.png" alt="screen 2"></p> <p>Visual Studio Version: </p> <p><img src="https://i.stack.imgur.com/4eqtB.png" alt="snip 3"></p> <p>Our missing attribute: </p> <p><img src="https://i.stack.imgur.com/ED5ZY.png" alt="the missing attribute"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload