debugging - Can I have Visual Studio stop on unhandled exceptions inside Task code? -
debugging - Can I have Visual Studio stop on unhandled exceptions inside Task code? -
visual studio has feature makes debugging unhandled exceptions lot easier: stops on offending line of code , shows exception.
it seems task
class designed in such way feature suppressed: catches every exception, , rethrows different exception when task wait
ed or finalized.
i know can have stop on first-chance exceptions, doesn't help: imagine number of handled exceptions of same type occur prior unhandled one. in case vs stop on every non-problematic exception in add-on 1 causes problem.
another alternative less acceptable: looking @ stack trace of innerexception
: means while know line caused exception, cannot access of local state, if programme stopped there.
can somehow best of both worlds, using task
class not having live degraded exception debugging feature set?
bonus question: mean null reference exception within await
block not cause visual studio stop right there, instead stop somewhere else altogether?
the task
type wrap exceptions aggregateexception
. however, if you're using async
/await
functionality, when await
task
, inner exception unwrapped , re-thrown, preserving original stack trace.
vs11 have improve async
debugging support, don't think it's possible go far you're hoping. task
concurrent , asynchronous code, , that's why don't think ever work.
consider, example, if have task
running on thread pool thread you're going await
. can await
in try
block grab exception task
... or can await
outside of try
block, leaving task
's exception unhandled.
the point illustration when exception thrown, debugger doesn't know if exception will be unhandled. synchronous code, exception thrown, stack checked - , if it's unhandled, debugger knows unhandled , can take special action right away (before stack unwound).
so, don't think it's possible want. can pretty close intellitrace, though (only in vs ultimate).
visual-studio-2010 debugging
Comments
Post a Comment