.net - Track an instance in C#? -


this question has answer here:

is there way track single instace in c#/.net in visual studio while debugging? find useful sometimes.

another way @ breakpoints on instances rather code. therefore, every time instance accessed and/or modified execution stops , presented line of code accesses/modifies instance.

in c++ equivalence monitoring piece of memory instance located, or pointer instance. approach doesn't work managed code objects in .net moved around, therefore need equivalence pointers in c++.

i aware of weakreferences in c# not sure if of use while debugging?

edit1: question different "when debugging, there way tell if object different instance? " not interested in comparing 2 references, want access single object.

there's nothing i'm aware of out of box, vs support conditional breakpoints. 1 option to:

  1. place breakpoints on of methods on class you're interested in
  2. debug code through until first of these hit
  3. find hashcode of instance
  4. make of breakpoints coditional on gethashcode() == hash code retrieved
  5. let application run on until breakpoint hit again
  6. look in call stack window see line of code calling method

a little clunky, work...


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -