问题描述
老实说,这可能是,但没有答案,我有更多的细节。最近将我们的代码库从VS2010移植到目标v4.0到VS2015,目标是v4.6。我们有一个托管C ++ DLL来提供.NET访问我们的C ++代码库。引用它的所有.NET应用程序在启动时都会崩溃。在出口处似乎正在崩溃登记静态破坏。
这是调试调用堆栈:
ntdll.dll!RtlValidateHeap()未知
KernelBase.dll!_HeapValidate@12()未知
ucrtbased.dll!_CrtIsValidHeapPointer(const void * block)行1385 C ++
ucrtbased.dll!_msize_dbg(void * block,int block_use)行1037 C ++
ucrtbased.dll!_msize(void * block)行30 C ++
ucrtbased.dll!_recalloc_dbg(void * block,unsigned int count,unsigned int element_size,int block_use,const char * file_name,int line_number)行771 C ++
ucrtbased.dll!_register_onexit_function :: __ l23 ::< lambda>()行112 C ++
ucrtbased.dll (void),void(< lambda>(void)&,void<(void)>(__ acrt_lock_and_call :: __ l3 :: void < lambda(void)&& setup,_register_onexit_function :: __ l23 :: int< lambda>(void)& action,__acrt_lock_and_call :: __ l4 :: void< lambda>(void)&&清除)行199 C ++
ucrtbased.dll!__ acrt_lock_and_call< int< lambda>(void)>(const __acrt_lock_id lock_id,_register_onexit_function :: __ l23 :: int< lambda>(void)&&行882 C ++
ucrtbased.dll!_register_onexit_function(_onexit_table_t * table,int(void)* function)行148 C ++
zwrappers.dll!_onexit(int(void)* function)行268 C ++
zwrappers.dll!atexit(void(void)* function)行276 C ++
zwrappers.dll!__ scrt_initialize_thread_safe_statics()行107 C ++
[外部代码]
clrjit.dll!编译器:: impResolveToken(unsigned char const *,struct CORINFO_RESOLVED_TOKEN *,枚举CorInfoTokenKind)未知
clrjit.dll!Compiler :: impImportBlockCode(struct BasicBlock *)未知
clrjit.dll!Compiler :: impImportBlock(struct BasicBlock *)未知
clrjit.dll!编译器:: impImport(struct BasicBlock *)未知
clrjit.dll!编译器:: compCompile(void * *,unsigned long *,unsigned int)未知
clrjit。 DLL!的COM piler :: compCompileHelper(struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int,enum CorInfoInstantiationVerification)未知
clrjit.dll!Compiler :: compCompile(struct CORINFO_METHOD_STRUCT_ *,struct CORINFO_MODULE_STRUCT_ *,类ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int)未知
clrjit.dll!jitNativeCode(struct CORINFO_METHOD_STRUCT_ *,struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int,void *)未知
clrjit.dll!CILJit :: compileMethod(class ICorJitInfo *,struct CORINFO_METHOD_INFO *,unsigned int,unsigned char * *,unsigned long *)未知
[外部代码]
clrjit.dll!编译器:: impResolveToken(unsigned char const *,struct CORINFO_RESOLVED_TOKEN *,枚举CorInfoTokenKind)未知
clrjit.dll!编译器:: impImportBlockCode(struct BasicBlock *)未知
clrjit.dll!Compiler :: impImport块(struct BasicBlock *)未知
clrjit.dll!编译器:: impImport(struct BasicBlock *)未知
clrjit.dll!编译器:: compCompile(void * *,unsigned long *,unsigned int)未知
clrjit.dll!Compiler :: compCompileHelper(struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int,enum CorInfoInstantiationVerification)未知
clrjit.dll!编译器: :compCompile(struct CORINFO_METHOD_STRUCT_ *,struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int)未知
clrjit.dll!jitNativeCode(struct CORINFO_METHOD_STRUCT_ *,struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int,void *)未知
clrjit.dll!CILJit :: compileMethod(ICorJitInfo *,struct CORINFO_METHOD_INFO *,unsigned int,unsigned char * * ,unsigned long *)未知
[外部代码]
user32.dll!__ InternalCallWinP roc @ 20()未知
user32.dll!UserCallWinProcCheckWow()未知
user32.dll!DispatchMessageWorker()未知
user32.dll !_DispatchMessageW@4()未知
WindowsBase。 ni.dll!53fee59c()未知
[下面的框可能不正确和/或丢失,本机调试器尝试走管理调用堆栈]
[外部代码]
发行版callstack看起来是一样的:
ntdll.dll !_RtlReportCriticalFailure@8()未知
ntdll.dll!_RtlpHeapHandleError@4()未知
ntdll.dll!_RtlpLogHeapFailure@24()未知
ntdll.dll!RtlSizeHeap()未知
ucrtbase.dll!_register_onexit_function()未知
zwrappers.dll!_onexit(int(void)* function)行268 C ++
zwrappers.dll!atexit(void(void)* function)Line 276 C ++
zwrappers.dll!__ scrt_initialize_thread_safe_statics()行107 C ++
[外部代码]
clrjit.dll!编译器:: impResolveToken(unsigned char const *,struct CORINFO_RES未知
clrjit.dll编译器:: impImportBlockCode(struct BasicBlock *)未知
clrjit.dll!编译器:: impImportBlock(struct BasicBlock *)未知
clrjit.dll编译器:: impImport(struct BasicBlock *)未知
clrjit.dll!编译器:: compCompile(void * *,unsigned long *,unsigned int)未知
clrjit.dll!Compiler :: compCompileHelper CORINFO_MODULE_STRUCT_ *,类ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int,enum CorInfoInstantiationVerification)未知
clrjit.dll!Compiler :: compCompile(struct CORINFO_METHOD_STRUCT_ *,struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo * ,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int)未知
clrjit.dll!jitNativeCode(struct CORINFO_METHOD_STRUCT_ *,struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long * ,unsigned int,void *)未知
clrjit.dll!CILJit :: compileMethod(clas s ICorJitInfo *,struct CORINFO_METHOD_INFO *,unsigned int,unsigned char * *,unsigned long *)未知
[外部代码]
clrjit.dll!编译器:: impResolveToken(unsigned char const *,struct CORINFO_RESOLVED_TOKEN * ,枚举CorInfoTokenKind)未知
clrjit.dll!编译器:: impImportBlockCode(struct BasicBlock *)未知
clrjit.dll!编译器:: impImportBlock(struct BasicBlock *)未知
clrjit.dll!编译器:: impImport(struct BasicBlock *)未知
clrjit.dll!编译器:: compCompile(void * *,unsigned long *,unsigned int)未知
clrjit.dll!编译器:: compCompileHelper(struct CORINFO_MODULE_STRUCT_ * ,类ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int,enum CorInfoInstantiationVerification)未知
clrjit.dll!Compiler :: compCompile(struct CORINFO_METHOD_STRUCT_ *,struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int)未知
clrjit.dll!jitNativeCode(st CORINFO_METHOD_STRUCT_ *,struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int,void *)未知
clrjit.dll!CILJit :: compileMethod(class ICorJitInfo *,struct CORINFO_METHOD_INFO *,unsigned int,unsigned char * *,unsigned long *)未知
[外部代码]
user32.dll!__ InternalCallWinProc @ 20()未知
user32.dll!UserCallWinProcCheckWow()未知
user32.dll!DispatchMessageWorker()未知
user32.dll !_DispatchMessageW@4()未知
WindowsBase.ni.dll!53fee59c()未知
[下列框架可能不正确, /或缺少,本机调试器尝试走管理调用堆栈]
[外部代码]
我有完全相同的问题。至少在我的情况下,问题是链接器开关中附加选项中的/ NOENTRY开关。在链接器设置中选择所有选项时,这只是 。删除/ NOENTRY也删除了这个问题。
我的原始(2013)项目文件确实有这个开关;然而,2013年的版本工作正常。所以在2013年这个切换被忽略了,或者整个链接过程已经改变了。 (从看起来我认为它有相当多的)。
Honestly, this is may be a dupe of VS2015: Migrated project compiles, but won't run ("Debug Assertion Failed!") but that has no answer and I have more details.
Recently ported our codebase from VS2010 targeting v4.0 to VS2015 targeting v4.6. We have a managed C++ DLL to provide .NET access to our C++ codebase. All .NET applications which reference it crash on startup. It seems to be crashing registering statics for destruction at exit.
Here is the debug callstack:
ntdll.dll!RtlValidateHeap() Unknown
KernelBase.dll!_HeapValidate@12() Unknown
ucrtbased.dll!_CrtIsValidHeapPointer(const void * block) Line 1385 C++
ucrtbased.dll!_msize_dbg(void * block, int block_use) Line 1037 C++
ucrtbased.dll!_msize(void * block) Line 30 C++
ucrtbased.dll!_recalloc_dbg(void * block, unsigned int count, unsigned int element_size, int block_use, const char * file_name, int line_number) Line 771 C++
ucrtbased.dll!_register_onexit_function::__l23::<lambda>() Line 112 C++
ucrtbased.dll!__crt_seh_guarded_call<int>::operator()<void <lambda>(void),int <lambda>(void) &,void <lambda>(void) >(__acrt_lock_and_call::__l3::void <lambda>(void) && setup, _register_onexit_function::__l23::int <lambda>(void) & action, __acrt_lock_and_call::__l4::void <lambda>(void) && cleanup) Line 199 C++
ucrtbased.dll!__acrt_lock_and_call<int <lambda>(void) >(const __acrt_lock_id lock_id, _register_onexit_function::__l23::int <lambda>(void) && action) Line 882 C++
ucrtbased.dll!_register_onexit_function(_onexit_table_t * table, int (void) * function) Line 148 C++
zwrappers.dll!_onexit(int (void) * function) Line 268 C++
zwrappers.dll!atexit(void (void) * function) Line 276 C++
zwrappers.dll!__scrt_initialize_thread_safe_statics() Line 107 C++
[External Code]
clrjit.dll!Compiler::impResolveToken(unsigned char const *,struct CORINFO_RESOLVED_TOKEN *,enum CorInfoTokenKind) Unknown
clrjit.dll!Compiler::impImportBlockCode(struct BasicBlock *) Unknown
clrjit.dll!Compiler::impImportBlock(struct BasicBlock *) Unknown
clrjit.dll!Compiler::impImport(struct BasicBlock *) Unknown
clrjit.dll!Compiler::compCompile(void * *,unsigned long *,unsigned int) Unknown
clrjit.dll!Compiler::compCompileHelper(struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int,enum CorInfoInstantiationVerification) Unknown
clrjit.dll!Compiler::compCompile(struct CORINFO_METHOD_STRUCT_ *,struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int) Unknown
clrjit.dll!jitNativeCode(struct CORINFO_METHOD_STRUCT_ *,struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int,void *) Unknown
clrjit.dll!CILJit::compileMethod(class ICorJitInfo *,struct CORINFO_METHOD_INFO *,unsigned int,unsigned char * *,unsigned long *) Unknown
[External Code]
clrjit.dll!Compiler::impResolveToken(unsigned char const *,struct CORINFO_RESOLVED_TOKEN *,enum CorInfoTokenKind) Unknown
clrjit.dll!Compiler::impImportBlockCode(struct BasicBlock *) Unknown
clrjit.dll!Compiler::impImportBlock(struct BasicBlock *) Unknown
clrjit.dll!Compiler::impImport(struct BasicBlock *) Unknown
clrjit.dll!Compiler::compCompile(void * *,unsigned long *,unsigned int) Unknown
clrjit.dll!Compiler::compCompileHelper(struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int,enum CorInfoInstantiationVerification) Unknown
clrjit.dll!Compiler::compCompile(struct CORINFO_METHOD_STRUCT_ *,struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int) Unknown
clrjit.dll!jitNativeCode(struct CORINFO_METHOD_STRUCT_ *,struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int,void *) Unknown
clrjit.dll!CILJit::compileMethod(class ICorJitInfo *,struct CORINFO_METHOD_INFO *,unsigned int,unsigned char * *,unsigned long *) Unknown
[External Code]
user32.dll!__InternalCallWinProc@20() Unknown
user32.dll!UserCallWinProcCheckWow() Unknown
user32.dll!DispatchMessageWorker() Unknown
user32.dll!_DispatchMessageW@4() Unknown
WindowsBase.ni.dll!53fee59c() Unknown
[Frames below may be incorrect and/or missing, native debugger attempting to walk managed call stack]
[External Code]
The release callstack looks about identical:
ntdll.dll!_RtlReportCriticalFailure@8() Unknown
ntdll.dll!_RtlpHeapHandleError@4() Unknown
ntdll.dll!_RtlpLogHeapFailure@24() Unknown
ntdll.dll!RtlSizeHeap() Unknown
ucrtbase.dll!_register_onexit_function() Unknown
zwrappers.dll!_onexit(int (void) * function) Line 268 C++
zwrappers.dll!atexit(void (void) * function) Line 276 C++
zwrappers.dll!__scrt_initialize_thread_safe_statics() Line 107 C++
[External Code]
clrjit.dll!Compiler::impResolveToken(unsigned char const *,struct CORINFO_RESOLVED_TOKEN *,enum CorInfoTokenKind) Unknown
clrjit.dll!Compiler::impImportBlockCode(struct BasicBlock *) Unknown
clrjit.dll!Compiler::impImportBlock(struct BasicBlock *) Unknown
clrjit.dll!Compiler::impImport(struct BasicBlock *) Unknown
clrjit.dll!Compiler::compCompile(void * *,unsigned long *,unsigned int) Unknown
clrjit.dll!Compiler::compCompileHelper(struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int,enum CorInfoInstantiationVerification) Unknown
clrjit.dll!Compiler::compCompile(struct CORINFO_METHOD_STRUCT_ *,struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int) Unknown
clrjit.dll!jitNativeCode(struct CORINFO_METHOD_STRUCT_ *,struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int,void *) Unknown
clrjit.dll!CILJit::compileMethod(class ICorJitInfo *,struct CORINFO_METHOD_INFO *,unsigned int,unsigned char * *,unsigned long *) Unknown
[External Code]
clrjit.dll!Compiler::impResolveToken(unsigned char const *,struct CORINFO_RESOLVED_TOKEN *,enum CorInfoTokenKind) Unknown
clrjit.dll!Compiler::impImportBlockCode(struct BasicBlock *) Unknown
clrjit.dll!Compiler::impImportBlock(struct BasicBlock *) Unknown
clrjit.dll!Compiler::impImport(struct BasicBlock *) Unknown
clrjit.dll!Compiler::compCompile(void * *,unsigned long *,unsigned int) Unknown
clrjit.dll!Compiler::compCompileHelper(struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int,enum CorInfoInstantiationVerification) Unknown
clrjit.dll!Compiler::compCompile(struct CORINFO_METHOD_STRUCT_ *,struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int) Unknown
clrjit.dll!jitNativeCode(struct CORINFO_METHOD_STRUCT_ *,struct CORINFO_MODULE_STRUCT_ *,class ICorJitInfo *,struct CORINFO_METHOD_INFO *,void * *,unsigned long *,unsigned int,void *) Unknown
clrjit.dll!CILJit::compileMethod(class ICorJitInfo *,struct CORINFO_METHOD_INFO *,unsigned int,unsigned char * *,unsigned long *) Unknown
[External Code]
user32.dll!__InternalCallWinProc@20() Unknown
user32.dll!UserCallWinProcCheckWow() Unknown
user32.dll!DispatchMessageWorker() Unknown
user32.dll!_DispatchMessageW@4() Unknown
WindowsBase.ni.dll!53fee59c() Unknown
[Frames below may be incorrect and/or missing, native debugger attempting to walk managed call stack]
[External Code]
I had the exact same problem. At least in my case, the problem was the /NOENTRY switch in "Additional Options" in the linker switches. This is only visible when "All Options" is selected in the linker settings. Removing /NOENTRY also removed the problem.
My original (2013) project file did have this switch; however, the 2013 build did work. So either that switch was ignored in 2013, or the whole linking process has changed. (which from the looks i assume it has quite a bit.)
这篇关于C ++ / CLI DLL在端口加载到VS2015 / .NET 4.6之后崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!