c# - How to programatically add watch in debugger -


you can programatically add break (debugger.break()) , in places means has gone wrong (instead of, or in addition throwing exceptions).

in cases, programatically add watch variables. can done somehow? @ present best can come is

object foo = someobjectiwanttowatch; 

this way, @ least have reference object want watch in code, can mouseover object see contents. hack , i'm hoping find better way.

question edited:

i have big application, asynchronous threads driven various system events, when goes wrong, want browse data structures in whole application, looking clues went wrong. @ top level, application launched (main()) creates object contain else hierarchically, , main() goes infinite loop.

while (true) {     thread.sleep(100); } 

so if application begins misbehaving reason, can put breakpoint there, , voila. can browse data structures in whole application. if have reference top level container object. can mouseover object , browse way - it's more convenient have object appear in autos or watch. like

debugger.watch(thetoplevelobject); 

yes can browse , find top level object, , right-click it, , add watch. actual declaration nearby, hard find when you're on breakpoint.

i know not answer question, i'd point out can debug.writeline(someobjectiwanttowatch), , in output tab see value was. also, use tool debugview watch debug.writeline output without being in debugger.

there may api in visual studio debugger extensibility api or visual studio sdk adding watch variables, didn't see one.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -