Right now I'm looking at a bug in some C# code where I need to get a given object instance at some location. I'm sitting on a breakpoint at that location in the debugger and can jump back up the stack and view the object instance that I need to get. I suspect that there is a way to get that instance from what I have (foo.bar.baz.bla.bla.bla
or something like that) but I'm not knowledgeable enough about the code to know how to find it.
Hypothetical Example:
I'm sitting in the debugger at line 2485 in some one eases code and realize that the program needs to, right here, set the
FooBat
property on the enclosingWizBang
object (the one that the function 27 steps up the call stack was called on) but I don't have any direct references to the enclosingWizBang
object. However I suspect that one of the other object I do have access to has access to something that has access to something that does have access to the enclosingWizBang
object. But that gives me about 10K things to look through and, oh by the way, I can also access 42 differentWizBang
objects that are not the one I want so I also need to check that it really is the same object as the one 27 steps up the stack. If I can just find how to get access to it I can addSomeExp.FooBat = true;
right here on line 2485 and close this bug!
My question is: has anyone made a tool that uses reflection and bruit force to search chains of properties and members to find one that will give a desired object instance?
Yes I know this is an O(b
d
)
problem and often won't work but it's computer time, not programmer time and when it does work, it would be fantastic!
p.s. I give it less than even odd of what I want existing (now <g/>
).