我有一个C#程序来测试一个C ++ / CLI组件(该组件是一个包装到一个本地C ++ DLL)和我得到以下错误消息:
Unhandled exception at 0x50f8fd85 (msvcr90d.dll) in TestKeyManagerApp.exe: 0xC0000005: Access violation writing location 0x00000000.
在调试模式下的最后一个位置:dbgheap.c(Visual Studio 2008的输出)
if (pHead == NULL)
{
*errno_tmp = ENOMEM; <----- ACCESS VIOLATION
RTCCALLBACK(_RTC_FuncCheckSet_hook,(1));
}
我创建了组装类的对象一次(我的C#程序的私有成员),在构造函数中我加载本地C ++的dll,现在如果我使用装配对象第二次(一testfunction的第二个电话)我得到这个错误的消息!
调用堆栈的输出:
msvcr90d.dll!_heap_alloc_dbg_impl(unsigned int nSize=532, int nBlockUse=2, const char * szFileName=0x50ec24a8, int nLine=588, int * errno_tmp=0x00000000) Line 431 + 0x3 bytes C++
msvcr90d.dll!_nh_malloc_dbg_impl(unsigned int nSize=532, int nhFlag=0, int nBlockUse=2, const char * szFileName=0x50ec24a8, int nLine=588, int * errno_tmp=0x00000000) Line 239 + 0x19 bytes C++
msvcr90d.dll!_calloc_dbg_impl(unsigned int nNum=1, unsigned int nSize=532, int nBlockUse=2, const char * szFileName=0x50ec24a8, int nLine=588, int * errno_tmp=0x00000000) Line 593 + 0x20 bytes C++
msvcr90d.dll!_getptd_noexit() Line 588 + 0x1a bytes C
msvcr90d.dll!_errno() Line 281 + 0x5 bytes C
msvcr90d.dll!_calloc_dbg(unsigned int nNum=1, unsigned int nSize=532, int nBlockUse=2, const char * szFileName=0x50ec20a4, int nLine=373) Line 646 + 0x11 bytes C++
msvcr90d.dll!__CRTDLL_INIT(void * hDllHandle=0x50ec0000, unsigned long dwReason=2, void * lpreserved=0x00000000) Line 373 + 0x18 bytes C
msvcr90d.dll!_CRTDLL_INIT(void * hDllHandle=0x50ec0000, unsigned long dwReason=2, void * lpreserved=0x00000000) Line 214 + 0x11 bytes C
ntdll.dll!77c68968()
[Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]
ntdll.dll!77c73820()
ntdll.dll!77c735bc()
我希望你将有提示或提示吗?
谢谢!