共用方式為


METADATA_ADDRESS_LOCAL

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

This structure represents the address of a local variable within a scope (usually a function or method).

Syntax

typedef struct _tagMETADATA_ADDRESS_LOCAL {
    _mdToken  tokMethod;
    IUnknown* pLocal;
    DWORD     dwIndex;
} METADATA_ADDRESS_LOCAL;
public struct METADATA_ADDRESS_LOCAL {
    public int    tokMethod;
    public object pLocal;
    public uint   dwIndex;
}

Members

tokMethod
The ID of the method or function the local variable is part of.

[C++] _mdToken is a typedef for a 32-bit int.

pLocal
The token whose address this structure represents.

dwIndex
Can be the index of this local variable in the method or function, or some other value (language-specific).

Remarks

This structure is part of the union in the DEBUG_ADDRESS_UNION structure when the dwKind field of the DEBUG_ADDRESS_UNION structure is set to ADDRESS_KIND_LOCAL (a value from the ADDRESS_KIND enumeration).

Warning

[C++ only] If pLocal is not null, then you must call Release on the token pointer (addr is a field in the DEBUG_ADDRESS structure):

if (addr.dwKind == ADDRESS_KIND_METADATA_LOCAL && addr.addr.addrLocal.pLocal != NULL)
{
    addr.addr.addrLocal.pLocal->Release();
}

Requirements

Header: sh.h

Namespace: Microsoft.VisualStudio.Debugger.Interop

Assembly: Microsoft.VisualStudio.Debugger.Interop.dll

See also