This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, use the version selector at the top left. We recommend upgrading to Visual Studio 2019. Download it here

This interface represents a position in the address space of the machine running the program being debugged.


IDebugMemoryContext2 : IUnknown  

Notes for Implementers

The debug engine (DE) implements this interface to represent an address in memory.

Notes for Callers

A call to GetMemoryContext or GetMemoryContext returns this interface. Also, calls to Add and Subtract return new copies of this interface after the appropriate arithmetic operation has been applied.

Methods in Vtable Order

The following table shows the methods of IDebugMemoryContext2.

Method Description
GetName Gets the user-displayable name for this context.
GetInfo Gets information that describes this context.
Add Adds a specified value to the current context's address to create a new context.
Subtract Subtracts a specified value from the current context's address to create a new context.
Compare Compares two contexts in the manner indicated by compare flags.


Visual Studio's Memory window calls GetMemoryContext to obtain the IDebugMemoryContext2 interface that contains the evaluated expression used for the memory address. This context is then passed to ReadAt and WriteAt to specify the address to read or write.


Header: msdbg.h

Namespace: Microsoft.VisualStudio.Debugger.Interop

Assembly: Microsoft.VisualStudio.Debugger.Interop.dll

See Also

Core Interfaces