This documentation is archived and is not being maintained.

ICorProfilerInfo3::GetThreadStaticAddress2 Method

Gets the address of the specified thread-static field that is in the scope of the specified thread and application domain.

HRESULT GetThreadStaticAddress2(
                [in] ClassID classId,
                [in] mdFieldDef fieldToken,
                [in] AppDomainID appDomainId,
                [in] ThreadID threadId,
                [out] void **ppAddress);


[in] The ID of the class that contains the requested thread-static field.


[in] The metadata token for the requested thread-static field.


[in] The ID of the application domain.


[in] The ID of the thread that is the scope for the requested static field.


[out] A pointer to the address of the static field that is within the specified thread.

The GetThreadStaticAddress2 method may return one of the following:

  • A CORPROF_E_DATAINCOMPLETE HRESULT if the given static field has not been assigned an address in the specified context.

  • The addresses of objects that may be in the garbage collection heap. These addresses may become invalid after garbage collection, so after garbage collection, profilers should not assume that they are valid.

Before a class’s class constructor is completed, GetThreadStaticAddress2 will return CORPROF_E_DATAINCOMPLETE for all its static fields, although some of the static fields may already be initialized and rooting garbage collection objects.

The ICorProfilerInfo2::GetThreadStaticAddress method is similar to the GetThreadStaticAddress2 method, but does not accept an application domain argument.

Platforms: See .NET Framework System Requirements.

Header: CorProf.idl, CorProf.h

Library: CorGuids.lib

.NET Framework Versions: 4