Prev: error C2679: binary '<<' : no operator found which takes a right-handoperand of type 'std::string' (or there is no acceptable conversion)
Next: STL Vector - pass by reference?
From: Scott McPhillips [MVP] on 20 Jun 2007 12:13 Art wrote: > Hi, > > I am getting _CrtIsValidHeapPointer Assertion in C++/CLI Application > Debug mode in VS 2005. > Expression: _CrtIsValidHeapPointer(pUserData) > > ****************************** > It is breaking in dgbheap.c. > > Here are steps: > > 1) I created application in VS2005 : > Project type - VC++ > Visual Studio Installed Template - WindowsFormsApplication. > I added a dialog resource to this project and a class to the dialog > which is MFC dialog class. > I also changed the following project properties and their values: > a) CLR - /clr > b) Use MFC as Shared DLL > c) Linker ->advanced -> CLR Unmanaged Code Check - Apply Unmanaged > Code Check (/CLRUNMANAGEDCODECHECK) > > > When I run this app in the debug mode I get the assertion with > Expression: _CrtIsValidHeapPointer(pUserData). > > Any help/url is appreciated. > > > Thanks a lot, > Arti When it hits this have a look at the debugger stack window and double click on lines that look like your classes. This will often take you to the exact pointer and code that is causing the problem. -- Scott McPhillips [MVP VC++]
From: Art on 21 Jun 2007 01:33 Hi SvenC, I am using C++ project properties: Code Generation : Runtime library= Multi-threaded Debug DLL (/MDd) Here is the call stack: msvcr80d.dll!_msize_dbg(void * pUserData=0xfb9606fc, int nBlockUse=2) Line 1473 + 0x30 bytes C++ msvcr80d.dll!_dllonexit_nolock(int (void)* func=0xfbd69d8c, void (void)* * * pbegin=0x0013eab8, void (void)* * * pend=0x0013eab0) Line 295 + 0xd bytes C msvcr80d.dll!__dllonexit(int (void)* func=0xfbd69d8c, void (void)* * * pbegin=0x0013eab8, void (void)* * * pend=0x0013eab0) Line 273 + 0x11 bytes C > ManagedC++.exe!_onexit(int (void)* func=0x00409b70) Line 110 + 0x1b bytes C ManagedC++.exe!atexit(void (void)* func=0x00409b70) Line 127 + 0x9 bytes C ManagedC++.exe!`dynamic initializer for 'g_Allocator''() Line 23 + 0x17 bytes C++ [Managed to Native Transition] ManagedC++.exe!_initterm(void** pfbegin = 0x0040A384, void pfend = ) Line 130 C++ ManagedC++.exe! <CrtImplementationDetails>::LanguageSupport::InitializeNative() Line 534 C++ ManagedC++.exe! <CrtImplementationDetails>::LanguageSupport::_Initialize() Line 680 C+ + ManagedC++.exe! <CrtImplementationDetails>::LanguageSupport::Initialize() Line 824 + 0x9 bytes C++ ManagedC++.exe!?.cctor@@$$FYMXXZ() Line 871 + 0x9 bytes C++ On Jun 20, 9:47 pm, "SvenC" <S...(a)community.nospam> wrote: > Hi, > > > > > I am getting _CrtIsValidHeapPointer Assertion in C++/CLI Application > > Debug mode in VS 2005. > > Expression: _CrtIsValidHeapPointer(pUserData) > > > 1) I created application in VS2005 : > > Project type - VC++ > > Visual Studio Installed Template - WindowsFormsApplication. > > I added a dialog resource to this project and a class to the dialog > > which is MFC dialog class. > > I also changed the following project properties and their values: > > a) CLR - /clr > > b) Use MFC as Shared DLL > > c) Linker ->advanced -> CLR Unmanaged Code Check - Apply Unmanaged > > Code Check (/CLRUNMANAGEDCODECHECK) > > > When I run this app in the debug mode I get the assertion with > > Expression: _CrtIsValidHeapPointer(pUserData). > > In this articlehttp://msdn.microsoft.com/msdnmag/issues/06/05/MixAndMatch/ > it is explained that the DLL CRT must be used. > Please check your C++ project properties: Code Generation : Runtime library: > Multi-threaded [Debug] DLL (/MD or /MDd) > > -- > SvenC
From: Ben Voigt [C++ MVP] on 21 Jun 2007 18:48 "Art" <artami2006(a)gmail.com> wrote in message news:1182404002.683337.212070(a)n2g2000hse.googlegroups.com... > Hi SvenC, > I am using C++ project properties: Code Generation : Runtime library= > Multi-threaded Debug DLL (/MDd) > > Here is the call stack: Is this the first function called in your DLL? Or have some other functions already had a chance to corrupt the heap? Maybe some other DLL using the C++ runtime has done some damage. > > msvcr80d.dll!_msize_dbg(void * pUserData=0xfb9606fc, int > nBlockUse=2) Line 1473 + 0x30 bytes C++ > msvcr80d.dll!_dllonexit_nolock(int (void)* func=0xfbd69d8c, void > (void)* * * pbegin=0x0013eab8, void (void)* * * pend=0x0013eab0) Line > 295 + 0xd bytes C > msvcr80d.dll!__dllonexit(int (void)* func=0xfbd69d8c, void (void)* * > * pbegin=0x0013eab8, void (void)* * * pend=0x0013eab0) Line 273 + > 0x11 bytes C >> ManagedC++.exe!_onexit(int (void)* func=0x00409b70) Line 110 + 0x1b >> bytes C > ManagedC++.exe!atexit(void (void)* func=0x00409b70) Line 127 + 0x9 > bytes C > ManagedC++.exe!`dynamic initializer for 'g_Allocator''() Line 23 + > 0x17 bytes C++ > [Managed to Native Transition] > ManagedC++.exe!_initterm(void** pfbegin = 0x0040A384, void pfend = ) > Line 130 C++ > ManagedC++.exe! > <CrtImplementationDetails>::LanguageSupport::InitializeNative() Line > 534 C++ > ManagedC++.exe! > <CrtImplementationDetails>::LanguageSupport::_Initialize() Line 680 C+ > + > ManagedC++.exe! > <CrtImplementationDetails>::LanguageSupport::Initialize() Line 824 + > 0x9 bytes C++ > ManagedC++.exe!?.cctor@@$$FYMXXZ() Line 871 + 0x9 bytes C++ > > On Jun 20, 9:47 pm, "SvenC" <S...(a)community.nospam> wrote: >> Hi, >> >> >> >> > I am getting _CrtIsValidHeapPointer Assertion in C++/CLI Application >> > Debug mode in VS 2005. >> > Expression: _CrtIsValidHeapPointer(pUserData) >> >> > 1) I created application in VS2005 : >> > Project type - VC++ >> > Visual Studio Installed Template - WindowsFormsApplication. >> > I added a dialog resource to this project and a class to the dialog >> > which is MFC dialog class. >> > I also changed the following project properties and their values: >> > a) CLR - /clr >> > b) Use MFC as Shared DLL >> > c) Linker ->advanced -> CLR Unmanaged Code Check - Apply Unmanaged >> > Code Check (/CLRUNMANAGEDCODECHECK) >> >> > When I run this app in the debug mode I get the assertion with >> > Expression: _CrtIsValidHeapPointer(pUserData). >> >> In this >> articlehttp://msdn.microsoft.com/msdnmag/issues/06/05/MixAndMatch/ >> it is explained that the DLL CRT must be used. >> Please check your C++ project properties: Code Generation : Runtime >> library: >> Multi-threaded [Debug] DLL (/MD or /MDd) >> >> -- >> SvenC > >
From: Art on 22 Jun 2007 01:21
Hi Ben, It is a Windows Form Application. I am not using any DLL. Added a MFC Dialog class after which I started getting this assertion in the debug mode This assertion comes before executing the code in Main(). The Application works fine in the RELEASE MODE. Thanks, Art |