visual studio debugger tips & tricks .net
i've operative years vs's debugger, nonetheless each following i opposing underline i have never beheld before, cruise "damn! i have missed that? it's so useful!"
[disclaimer: tips work vs 2005 c# project, guarantees comparison incarnations vs languages]
keep lane vigilant instances
working churned instances given class? tell apart?
in pre-garbage collection programming days, easy keep lane references - only feeling during memory address. .net, can't - objects changed around.
fortunately, watches perspective lets right-click watch name 'make vigilant id'.
this appends {1#}, {2#} etc. after instance's value, effectively giving instance unparalleled label. looks this:
the tag persisted lifetime object.
meaningful values watched variables
by default, watched variable's value it's type. wish the fields, have enhance it, take enlarged (or even timeout!) there fields something complicated.
however, predefined forms arrangement some-more revealing information :
- strings arrangement tangible contents
- lists dictionaries arrangement elements count etc.
wouldn't good have possess types?
hmm...
...some peculiarity .net reflection shows simply achieved debuggerdisplay charge tradition type:
[system.diagnostics.debuggerdisplay("employee: '{name}'")]
public category worker {
open twine name { { ... } }
...
}
... re-run, and...
there's lot some-more info theme here:
break exceptions
... even ones burnished code!
i know, i'm such n00b meaningful ever given i born, nonetheless here goes anyway - maybe assistance someone someday:
you force debugged slight smack debug mode any an difference thrown. ever went bug hunt hours wholly opposing square formula this?
try {
runstrangecontraption();
} catch(exception ex) {
/* todo: hoop blunder after */
}
catching exceptions unequivocally permitted cases.
this enabled debug > exceptions... (ctrl-alt-e). parasite boxes 'thrown' buttress any form difference need.
those few forehead-slapping moments me.
would caring share yours?
Comments
Post a Comment