c# - DebuggerStepThrough, DebuggerHidden don't work in an async-await method -
when turn on "break when exception thrown" feature in visual studio debugger breaks everywhere selected exception types. way tell not break in specific method decorate these methods debuggerstepthrough attribute (or debuggerhidden).
this, evidently, doesn't work async method reason. here's snippet reproduces issue. debugger will break within testasync though it's marked attributes , not break within test excepted ( difference between them first marked async keyword):
public class attributes { public async task run() { await testasync(); await test(); } [debuggerhidden] [debuggerstepthrough] public async task testasync() { seek { throw new exception("async"); } grab { } await task.delay(100); } [debuggerhidden] [debuggerstepthrough] public task test() { seek { throw new exception("sync"); } grab { } homecoming task.delay(100); } } so, behavior intended? bug? there workaround?
attributes don't play async/await since async methods re-written under covers--and attributes not follow. see http://stackoverflow.com/a/22412597/495262 similar situation.
c# .net debugging exception-handling async-await
No comments:
Post a Comment