Tôi gặp sự cố với DLL chế độ hỗn hợp C++/CLI mà tôi đã tạo. Nó là một ngoại lệ khi dỡ bỏ như ứng dụng .NET sử dụng nó thoát. Sau DLL_PROCESS_DETACH
được thực thi, các DLL không runtime sạch-up sử dụng tự động đăng ký atexit()/__onexit()
chức năng và ném ngoại lệ sau đây:Chế độ hỗn hợp C++/CLI DLL ném ngoại lệ khi thoát
Unhandled exception at 0x752bb9bc (KernelBase.dll) in psstestm.exe:
0xC0020001: The string binding is invalid.
Tôi đã bắt nguồn từ các vấn đề để một atexit()
cuộc gọi mà được đăng ký bởi một sự thúc đẩy tĩnh ngoại lệ đối tượng get_static_exception_object()
.
function_to_call 0x0f560410 [email protected][email protected][email protected][email protected][email protected]@@@[email protected]@@[email protected]@[email protected]@[email protected]@YAXXZ void (void)*
Tôi đang sử dụng boost_1_47 liên kết tĩnh cho hầu hết các phần ngoại trừ tăng :: chuỗi được liên kết động để tránh loaderlock. Tôi cũng đã cố gắng tự động liên kết tất cả các tăng mà không giúp đỡ. Ngoài ra tất cả các tăng bao gồm được bao quanh bởi #pragma unmanaged
khối.
Tôi hy vọng ai đó đã gặp sự cố tương tự hoặc biết giải pháp?
Cảm ơn, Mark
Dưới đây là các cuộc gọi stack ngay trước khi ngoại lệ xảy ra:
psscorem.dll!_CRT_INIT(void * hDllHandle=0x0f4b0000, unsigned long dwReason=0, void * lpreserved=0x00000001) Line 413 C
psscorem.dll!__DllMainCRTStartup(void * hDllHandle=0x0f4b0000, unsigned long dwReason=0, void * lpreserved=0x00000001) Line 526 + 0x11 bytes C
psscorem.dll!_DllMainCRTStartup(void * hDllHandle=0x0f4b0000, unsigned long dwReason=0, void * lpreserved=0x00000001) Line 476 + 0x11 bytes C
[email protected]() + 0xde bytes
[email protected]() + 0xad bytes
[email protected]() + 0x14 bytes
[email protected]() + 0x141 bytes
[email protected]() + 0x74 bytes
kernel32.dll!749479f5()
mscoreei.dll!RuntimeDesc::ShutdownAllActiveRuntimes() + 0xc8 bytes
mscoreei.dll!CLRRuntimeHostInternalImpl::ShutdownAllRuntimesThenExit() + 0x15 bytes
clr.dll!EEPolicy::ExitProcessViaShim() + 0x66 bytes
clr.dll!SafeExitProcess() + 0x99 bytes
clr.dll!DisableRuntime() - 0x1146bb bytes
clr.dll!EEPolicy::HandleExitProcess() + 0x57 bytes
[email protected]() + 0x11c bytes
[email protected]() + 0x1c bytes
[email protected]() + 0x38 bytes
[email protected]() + 0x227 bytes
[email protected]() + 0x8 bytes
[email protected]@12() + 0x12 bytes
[email protected]() + 0x27 bytes
[email protected]() + 0x1b bytes
CẢM ƠN BẠN !!! Tôi đã theo dõi điều này mãi mãi. Tôi không biết C++ cũng đủ để hiểu làm thế nào mà gây ra một cuộc gọi để atexit. – pedz