How cool would it be if I could just add something like [DebuggerStepThrough] (see https://msdn.microsoft.com/en-us/library/system.diagnostics.debuggerstepthroughattribute.aspx) on a method without littering the source code with defines (more info http://www.codeproject.com/Articles/111965/Tips-on-Debugging-Using-DebuggerStepThrough-attrib).

How cool would it be if I could just add something like [DebuggerStepThrough] (see https://msdn.microsoft.com/en-us/library/system.diagnostics.debuggerstepthroughattribute.aspx) on a method without littering the source code with defines (more info http://www.codeproject.com/Articles/111965/Tips-on-Debugging-Using-DebuggerStepThrough-attrib).

Why? So I could easily exclude all one-liner getters and setters to prevent jumping into them half the time without cluttering up the code.

Comments

  1. ...but then you would need several debug info options to control whether or not those NoDebugInfo methods have debug info or not after all :)

    Given this is an interactive debugger-level issue, might be simpler to just be able to ignore a method in the interactive debugger, same way you can ignore some exception classes.

    Debug info can serve other purposes beyond interactive debugging, like crash reports, profiling, etc.

    ReplyDelete
  2. Eric Grange You are right. I changed the post (might not see that in notifications) to make clear what I actually mean.

    ReplyDelete
  3. I just "step over" those cases. But I do like Eric's suggestion.

    ReplyDelete
  4. Asbjørn Heid There is no "step over" if you have code like this

    DoSomething(SomeValue);

    SomeValue backed by a getter. It usually results in F7/Shift+F8 galore.

    ReplyDelete
  5. Stefan Glienke True but I try to avoid writing that if DoSomething is non-trivial as well.

    ReplyDelete
  6. I don't litter up my code with unnecessary temp variables just because the debugger is stupid.

    ReplyDelete
  7. Stefan Glienke It's also because I like to see what is actually going into the call before the call happens. Still, it would be nice to avoid trivial getters.

    ReplyDelete

Post a Comment