Debugging Tip: Viewing Address of Managed Code

Ever need to write managed code that then talked to unmanaged code elsewhere?  Sometimes when debugging about why things are not working the way you expect it is useful to just inspect the values on both systems to understand the differences. One of the difference with managed code is that you rarely need to access the actual memory address, but there are times it is useful.  In Visual Studio this can be done simply by using the immediate window.

For instance if I wanted to know the address of a byte[] from the following code.


You can dereference the item to get the memory address by opening the Immediate Window & entering the following:


Now you can drop the address of the memory into the memory window to see how it is laid out.


Comments (0)

Skip to main content