O
Olivier Matrot
Hello,
I'm working with a Managed C++ Mixed assembly that works fine on Vista, both
in debug and release mode.
Howerver this assembly fails on XPSP2 in release mode. Works fine in debug
mode. This assemby is a DLL that is loaded from a win32 service. It is
written with Visual Studio 2005 SP1.
I wrote a small test program that is run in debug mode.
With the DLL in release mode, here is the exception :
An exception of type 'System.Runtime.InteropServices.COMException' occurred
in mscorlib.dll but was not handled in user code
Additional information: Descripteur non valide (Exception from HRESULT:
0x80070006 (E_HANDLE))
The debugger stops in msilexit.cpp int the following function :
extern "C" void __clrcall _app_exit_callback(void)
{
/*
* Note that this function is called during appdomain unload.
* Thus there should be only one thread calling this function per
* appdomain. Thus this function does not need to be under lock.
*
* Note: verify that when domainUnload event is generated, there
* are no threads executing in this appdomain. If this is not the
* case then we will need to have lock around this function.
*/
_CPVFV * onexitbegin_app_domain = (_CPVFV *)
_decode_pointer(__onexitbegin_app_domain);
_CPVFV * onexitend_app_domain = (_CPVFV *)
_decode_pointer(__onexitend_app_domain);
if ((onexitbegin_app_domain != (_CPVFV *)-1) && (onexitbegin_app_domain !=
NULL) && (onexitend_app_domain != NULL)) {
__try
{
while (--onexitend_app_domain >= onexitbegin_app_domain) {
if (*onexitend_app_domain != _encoded_null()) {
(*(_CPVFV)_decode_pointer(*onexitend_app_domain))();
}
}
}
__finally
{
System::Runtime::InteropServices::Marshal::FreeHGlobal(
System::IntPtr((void *)onexitbegin_app_domain));
}
}
}
Specifically the code fails within the call to FreeHGlobal.
Thanks for your Help.
I'm working with a Managed C++ Mixed assembly that works fine on Vista, both
in debug and release mode.
Howerver this assembly fails on XPSP2 in release mode. Works fine in debug
mode. This assemby is a DLL that is loaded from a win32 service. It is
written with Visual Studio 2005 SP1.
I wrote a small test program that is run in debug mode.
With the DLL in release mode, here is the exception :
An exception of type 'System.Runtime.InteropServices.COMException' occurred
in mscorlib.dll but was not handled in user code
Additional information: Descripteur non valide (Exception from HRESULT:
0x80070006 (E_HANDLE))
The debugger stops in msilexit.cpp int the following function :
extern "C" void __clrcall _app_exit_callback(void)
{
/*
* Note that this function is called during appdomain unload.
* Thus there should be only one thread calling this function per
* appdomain. Thus this function does not need to be under lock.
*
* Note: verify that when domainUnload event is generated, there
* are no threads executing in this appdomain. If this is not the
* case then we will need to have lock around this function.
*/
_CPVFV * onexitbegin_app_domain = (_CPVFV *)
_decode_pointer(__onexitbegin_app_domain);
_CPVFV * onexitend_app_domain = (_CPVFV *)
_decode_pointer(__onexitend_app_domain);
if ((onexitbegin_app_domain != (_CPVFV *)-1) && (onexitbegin_app_domain !=
NULL) && (onexitend_app_domain != NULL)) {
__try
{
while (--onexitend_app_domain >= onexitbegin_app_domain) {
if (*onexitend_app_domain != _encoded_null()) {
(*(_CPVFV)_decode_pointer(*onexitend_app_domain))();
}
}
}
__finally
{
System::Runtime::InteropServices::Marshal::FreeHGlobal(
System::IntPtr((void *)onexitbegin_app_domain));
}
}
}
Specifically the code fails within the call to FreeHGlobal.
Thanks for your Help.