B
Ben Voigt
Under certain circumstances I get:
First-chance exception at 0x7c812a5b (kernel32.dll) in LTMGUI.exe:
0xC0020001: The string binding is invalid.
First-chance exception at 0x7c812a5b (kernel32.dll) in LTMGUI.exe: Microsoft
C++ exception: [rethrow] at memory location 0x00000000..
Unhandled exception at 0x7c812a5b (kernel32.dll) in LTMGUI.exe: 0xC0020001:
The string binding is invalid.
Googling this exception brought me to a blog posting by Chris Brumme
indicating that this is a result of making an unmanaged->managed transition
while the CLR is shutting down
(http://blogs.msdn.com/cbrumme/archive/2003/04/15/51318.aspx)
However, on the line where the debugger stops, I do not believe the compiler
should be generating a call into managed code. I do not want this thread to
make a call to managed code. I do not want this code to crash if the CLR
shuts down. I do not want this code to stop when the CLR does a garbage
collection.
The debugger stops in the following function:
/**
** \brief Performs in-place default construction
** \param[in] length Number of elements to allocate/construct
** \return Pointer to memory containing \c length elements, default
constructed
**/
static T* init( size_t const length )
{
// would like p = new T[length]
// but can't mix and match in-place copy construction
// with array form of new, since one needs to be freed with
// :perator delete, and the other with T:perator delete[]
T* p = (T*):perator new(length * sizeof (T));
size_t left = length;
try {
while (left-- > 0)
new (p + left) T(); // 0xC0020001 thrown here
}
catch (...) {
// in case of exception, destroy any elements already created
while (++left < length)
(p + left)->~T();
throw;
}
return p;
}
T is a typename template parameter which is a pointer to native struct. The
template definition is bracketed by pragma managed(push, off). So is the
declaration of the instantiating variable. The first function on the stack
not in the template class is in a .cpp file protected by pragma unmanaged.
Why is the compiler using managed code, and how do I make it stop!?! A
placement new for a pointer type shouldn't do anything anyway.
First-chance exception at 0x7c812a5b (kernel32.dll) in LTMGUI.exe:
0xC0020001: The string binding is invalid.
First-chance exception at 0x7c812a5b (kernel32.dll) in LTMGUI.exe: Microsoft
C++ exception: [rethrow] at memory location 0x00000000..
Unhandled exception at 0x7c812a5b (kernel32.dll) in LTMGUI.exe: 0xC0020001:
The string binding is invalid.
Googling this exception brought me to a blog posting by Chris Brumme
indicating that this is a result of making an unmanaged->managed transition
while the CLR is shutting down
(http://blogs.msdn.com/cbrumme/archive/2003/04/15/51318.aspx)
However, on the line where the debugger stops, I do not believe the compiler
should be generating a call into managed code. I do not want this thread to
make a call to managed code. I do not want this code to crash if the CLR
shuts down. I do not want this code to stop when the CLR does a garbage
collection.
The debugger stops in the following function:
/**
** \brief Performs in-place default construction
** \param[in] length Number of elements to allocate/construct
** \return Pointer to memory containing \c length elements, default
constructed
**/
static T* init( size_t const length )
{
// would like p = new T[length]
// but can't mix and match in-place copy construction
// with array form of new, since one needs to be freed with
// :perator delete, and the other with T:perator delete[]
T* p = (T*):perator new(length * sizeof (T));
size_t left = length;
try {
while (left-- > 0)
new (p + left) T(); // 0xC0020001 thrown here
}
catch (...) {
// in case of exception, destroy any elements already created
while (++left < length)
(p + left)->~T();
throw;
}
return p;
}
T is a typename template parameter which is a pointer to native struct. The
template definition is bracketed by pragma managed(push, off). So is the
declaration of the instantiating variable. The first function on the stack
not in the template class is in a .cpp file protected by pragma unmanaged.
Why is the compiler using managed code, and how do I make it stop!?! A
placement new for a pointer type shouldn't do anything anyway.