I have a confusing problem in my code, in which one object gets initialized properly, but when I look at it through a parent reference, its properties arent initialized anymore.
I assigned id’s for my objects, and I am perfectly sure that there are no duplicate objects lying around. When looking through the parent, the child is not initialized, but
This is something I don’t understand. Shoudn’t C# references point to the same memory space, and therefore show the correct values even when another reference changed something in that memory space?
EDIT:
I don’t need the problem above solved.
Just a reminder that this is the question which I’m interested in:
So back to the headline question:
For easier debugging, I would like to look behind all those abstracted references like I could do in C++. I think it would be immediately clear to me what went wrong when I could do that.
If you want to keep track of which object a particular reference is pointing at while debugging, then you can right click on a reference in a Watch window and select ‘Make Object ID’. Any other references to the same object will now show the same ID in the debugger (e.g. {1#}), and you can add the ID as a value to watch even if there are no references on the current stack frame.
See here for an example