Hi kadorken,
Thanks for your post!!
For this issue, I have writen a sample application using unmanaged C++ in
Net Framework 1.1. I can also reproduce out this problem in .Net Framework
1.1, code snippet lists below:
#include "cor.h"
#include <stdio.h>
#include <objbase.h>
int main(int argc, TCHAR* argv[])
{
IMetaDataDispenser* _IMetaDataDispenser;
IMetaDataImport* _IMetaDataImport;
IMetaDataAssemblyImport* _IMetaDataAssemblyImport;
CoInitialize( 0 );
HRESULT hr;
// go create all the interfaces
hr = CoCreateInstance(CLSID_CorMetaDataDispenser, 0,
CLSCTX_INPROC_SERVER,
IID_IMetaDataDispenser,
(LPVOID*)&_IMetaDataDispenser );
if ( FAILED(hr) )
throw "failed on IMetaDataDispenser";
wchar_t _FileName[MAX_PATH];
mbstowcs( _FileName, argv[1], lstrlen(argv[1])+1 );
hr = _IMetaDataDispenser->OpenScope(_FileName, ofRead,
IID_IMetaDataImport,
(LPUNKNOWN *)&_IMetaDataImport );
if ( FAILED(hr) )
throw "failed on IMetaDataImport";
hr = _IMetaDataDispenser->OpenScope(_FileName, ofRead,
IID_IMetaDataAssemblyImport,
(LPUNKNOWN *)&_IMetaDataAssemblyImport);
if ( FAILED(hr) )
throw "failed on IMetaDataAssemblyImport";
HCORENUM _hCorEnum = 0;
mdTypeDef _typeDefs[2048];
ULONG _countTypeDefs = sizeof(_typeDefs);
// go get all the type defs defined in the assembly
hr = _IMetaDataImport->EnumTypeDefs(&_hCorEnum,
_typeDefs,
_countTypeDefs,
&_countTypeDefs);
for (int i=0;i<_countTypeDefs;i++)
{
mdMethodDef _methodDefs[2048];
ULONG _countMethodDefs = sizeof(_methodDefs);
// go get all the methods defined on the typedef
_hCorEnum = 0;
hr = _IMetaDataImport->EnumMethods(&_hCorEnum,
_typeDefs[i],
_methodDefs,
_countMethodDefs,
&_countMethodDefs);
// now print out the methods name
wchar_t _methodName[1024];
ULONG _countMethodName = sizeof(_methodName);
for (int j=0;j<_countMethodDefs;j++)
{
wchar_t _methodName[1024];
mdParamDef returnValue=NULL;
hr = _IMetaDataImport->GetMethodProps(_methodDefs[j], 0, _methodName,
_countMethodName, &_countMethodName, 0, 0, 0, 0, 0);
wprintf(L"%s: \n", _methodName);
hr=_IMetaDataImport->GetParamForMethodIndex(_methodDefs[j], 0,
&returnValue);
if(SUCCEEDED(hr))
{
wchar_t szParamName[1024];
ULONG countParamName=sizeof(szParamName);
hr=_IMetaDataImport->GetParamProps(returnValue, &_methodDefs[j], 0,
szParamName,
countParamName, &countParamName, NULL, NULL, NULL, NULL);
if(SUCCEEDED(hr))
{
wprintf(L"\tReturnValue %s", szParamName);
}
}
printf("\n");
}
}
return 0;
}
GetParamForMethodIndex invoking always returns 0x80131130 error result.
For this issue, I have searched internal database, and find that this is
already submited as a bug request at 2005-04-28. The public link for this
bug request is:
http://lab.msdn.microsoft.com/ProductFeedback/viewFeedback.aspx?feedbackid=3
73c87ad-44f5-4f22-b59b-de4ac3ac098a
Currently, this bug request is still in active state. Our CLR team is still
doing research on this issue. I will keep track on this issue and update
you ASAP. Thanks
=============================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights.