none
How to find all the arguments name and its values from COR_PRF_FUNCTION_ARGUMENT_INFO RRS feed

  • Question

  • I using ICorProfilerCallback to profile my application. In the function enter method I'm able to find the function name. But how should I find the function attributes and its values from the struct COR_PRF_FUNCTION_ARGUMENT_INFO
    Thursday, July 5, 2018 5:49 PM

All replies

  • You cant, you need the FunctionID:

    * Pass the FunctionID into GetTokenAndMetaDataFromFunction to get the method metadata token and IMetaDataImport instance.

    * Pass the method metadata token and parameter index into GetParamForMethodIndex to get the parameter metadata token. (if the parameter has no name or attributes, then this could fail with CLDB_E_RECORD_NOTFOUND.)

    * Pass the parameter metadata token into GetParamProps to get the parameter name and non-custom attributes.

    * Pass the parameter metadata token into EnumCustomAttributes to get the metadata tokens of the custom attributes.

    * Pass the custom attribute metadata tokens into GetCustomAttributeProps to get the details of the custom attribute.

    Thursday, July 5, 2018 10:11 PM
  • Thanks.

    I don't have much experience in c++. Below is the code what I tried. The method GetParamForMethodIndex is always fails.
    IMetaDataImport* metaDataImport = NULL;
    mdMethodDef methodToken = NULL;
    HRESULT result = _corProfilerInfo2->GetTokenAndMetaDataFromFunction(functionId, IID_IMetaDataImport, (LPUNKNOWN *) &metaDataImport, &methodToken); 
    if(SUCCEEDED(result)) {
    	ULONG ulong = 0;
    	mdParamDef* parametersTokens = NULL;
    	result = metaDataImport->GetParamForMethodIndex(methodToken, ulong, parametersTokens);
    	
    	// It never enters in to success. It always fails
    	if(SUCCEEDED(result)) {
    	}
    }
    I'm not sure what I'm missing.
    • Edited by Tom Mac_2 Tuesday, July 10, 2018 6:12 PM
    Tuesday, July 10, 2018 3:23 PM
  • what is the value of result?
    Tuesday, July 10, 2018 9:45 PM