Freigeben über


ICorProfilerInfo2::GetFunctionFromTokenAndTypeArgs Method

Gets the FunctionID of a function by using the specified metadata token, containing class, and ClassID values of any type arguments.

HRESULT GetFunctionFromTokenAndTypeArgs(
    [in] ModuleID moduleID,
    [in] mdMethodDef funcDef,
    [in] ClassID classId,
    [in] ULONG32 cTypeArgs,
    [in, size_is(cTypeArgs)] ClassID typeArgs[],
    [out] FunctionID* pFunctionID);

Parameters

Parameter Description

moduleID

[in] The ID of the module in which the function resides.

funcDef

[in] An mdMethodDef metadata token that references the function.

classId

[in] The ID of the function's containing class.

cTypeArgs

[in] The number of type parameters for the given function. This value must be zero for non-generic functions.

typeArgs

[in] An array of ClassID values, each of which is an argument of the function. The value of typeArgs can be NULL if cTypeArgs is set to zero.

pFunctionID

[out] A pointer to the FunctionID of the specified function.

Remarks

Calling the GetFunctionFromTokenAndTypeArgs method with an mdMethodRef metadata instead of an mdMethodDef metadata token can have unpredictable results. Callers should resolve the mdMethodRef to an mdMethodDef when passing it.

If the function is not already loaded, calling GetFunctionFromTokenAndTypeArgs will cause loading to occur, which is a dangerous operation in many contexts. For example, calling this method during loading of modules or types could lead to an infinite loop as the runtime attempts to circularly load things.

In general, use of GetFunctionFromTokenAndTypeArgs is discouraged. If profilers are interested in events for a particular function, they should store the ModuleID and mdMethodDef of that function, and use ICorProfilerInfo2::GetFunctionInfo2 Method to check whether a given FunctionID is that of the desired function.

Requirements

Platforms: Windows 2000, Windows XP, Windows Server 2003 family

Header: CorProf.idl

Library: CorGuids.lib

.NET Framework Version: 2.0

See Also

Reference

ICorProfilerInfo Interface
ICorProfilerInfo2 Interface