Can I programatically get hold of the Autos/local variables that is shown when debugging?

Posted by Stefan on Stack Overflow See other posts from Stack Overflow or by Stefan
Published on 2010-03-09T00:20:10Z Indexed on 2010/03/09 0:21 UTC
Read the original article Hit count: 545

Filed under:
|
|
|

Im trying to build an error-logger that loggs running values that is active in the function that caused the error. (just for fun so its not a critical problem)

When going in break-mode and looking at the locals-tab and autos-tab you can see all active variables (name, type and value), it would be useful to get hold of that for logging purposes when an error occur and on some other occasions.

For my example, I just want to find all local variables that are of type string and integer and store the name and value of them.

Is this possible with reflection? Any tips or pointers that get me closer to my goal would be very appreciated.

I have toyed with using expression on a specifik object (a structure) to create an automapper against a dataset, but I have not done anything like what I ask for above, so please make me happy and say its possible.

Thanks.

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about reflection