Boost C++ Libraries: Ticket #4961: date_time causes "debug assertion failed" error in windows forms application, with visual c++ express 2010 https://svn.boost.org/trac10/ticket/4961 <p> Hi, </p> <p> I have a debug assertion failure which arises when I include boost/date_time/gregorian.hpp. </p> <p> I had found this problem in a complex windows forms project, using visual c++ express 2010 (everything worked fine with visual c++ express 2008). I have been able to reduce the problem to a simple case. I've seen this problem happening with boost 1.44.0 and boost 1.45.0 (I didn't test it with previous versions). </p> <p> I have currently a build of boost (both of 1.44.0 and 1.45.0) obtained with the command </p> <p> bjam --prefix="..\boost_1_45_0_build" install </p> <p> which has worked normally. </p> <p> In synthesis, the steps are: </p> <ul><li>I create a Visual C++ Windows Form Application </li><li>in the project properties, I set the CLR support switch for the project from default (/clr:pure) to /clr (used for mixed code) </li><li>please note that I set this switch in 2 points of the project properties tree: 1) Configuration <a class="missing wiki">Properties/General</a>-&gt;Common Language Runtime Support, and 2) Configuration Properties/ C/C++ /General-&gt;Common Language Runtime Support </li><li>in the stdafx.h file I add the inclusion </li></ul><p> #include &lt;boost/date_time/gregorian/gregorian.hpp&gt; </p> <ul><li>I build the solution </li><li>I run the project </li></ul><p> Without even running a line of code (I cannot even debug it, although I'm in debug mode), a dialog box appears with the following error message: </p> <hr /> <p> Debug Assertion Failed! </p> <p> Program: ...epository1\applications\test_vc2010_4\Debug\test_vc2010_4.exe File: f:\dd\vctools\crt_bld\self_x86\crt\src\dbgheap.c Line: 1516 </p> <p> Expression: _CrtIsValidHeapPointer(pUserData) </p> <p> For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts. </p> <p> (Press Retry to debug the application) </p> <hr /> <p> Pressing retry I go to an involved system file, not even to a boost source code file or to one of my source files. </p> <p> It seems that the error rises in a part of windows / C++ / .NET runtime, provoked by something in the date_time library which is examined by the runtime before running the program. </p> <p> I've searched a lot, but while this error message is common, the correlation with boost seems to be less known. I'm also sure about the CLR switch, in the project properties, which is to be set as /clr (if no /clr support is given, I cannot use windows forms, and if I use /clr:pure, every other project I use will have to be compiled as pure). That is, the error gets bypassed if I switch to /clr:pure, but that would force me to convert any other projects to this format, which at a certain point becomes impossibile with projects containing native c++ classes. </p> <p> I've been able to see that the same project settings work with a CLR Console application (so it doesn't seem to be .NET itself the cause of the problem). </p> <p> So, what can be done to avoid this ? </p> <p> Please let me know if you need help to reproduce the problem. </p> <p> Many thanks, </p> <blockquote> <p> Marco </p> </blockquote> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/4961 Trac 1.4.3 Vicente Botet <vicente.botet@…> Wed, 08 Dec 2010 06:50:03 GMT <link>https://svn.boost.org/trac10/ticket/4961#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4961#comment:1</guid> <description> <p> I would not say this is a bug on <a class="missing wiki">DateTime</a>. What about changing this to a support request on Building Boost? </p> </description> <category>Ticket</category> </item> <item> <author>Marco Pappalepore <crillion@…></author> <pubDate>Wed, 08 Dec 2010 12:59:59 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4961#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4961#comment:2</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/4961#comment:1" title="Comment 1">Vicente Botet &lt;vicente.botet@…&gt;</a>: </p> <blockquote class="citation"> <p> I would not say this is a bug on <a class="missing wiki">DateTime</a>. What about changing this to a support request on Building Boost? </p> </blockquote> <p> yes, but the fact is that boost builds, and the program compiles; it seems that this error is raised at runtime, before the real program itself starts, just when the runtime makes some checks before calling it. So it is appearently a runtime problem: perhaps not of the library failing by itself, but not passing a runtime check. So I'm doing this way: I wait still for some hours, for seeing any answer, then I switch it to build-boost. </p> </description> <category>Ticket</category> </item> <item> <author>Marco Pappalepore <crillion@…></author> <pubDate>Thu, 09 Dec 2010 08:02:37 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/4961#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4961#comment:3</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/4961#comment:2" title="Comment 2">Marco Pappalepore &lt;crillion@…&gt;</a>: </p> <blockquote class="citation"> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/4961#comment:1" title="Comment 1">Vicente Botet &lt;vicente.botet@…&gt;</a>: </p> <blockquote class="citation"> <p> I would not say this is a bug on <a class="missing wiki">DateTime</a>. What about changing this to a support request on Building Boost? </p> </blockquote> <p> yes, but the fact is that boost builds, and the program compiles; it seems that this error is raised at runtime, before the real program itself starts, just when the runtime makes some checks before calling it. So it is appearently a runtime problem: perhaps not of the library failing by itself, but not passing a runtime check. So I'm doing this way: I wait still for some hours, for seeing any answer, then I switch it to build-boost. </p> </blockquote> <p> ok, switched "component" to "build". do I have to do anything else to transfer this bug ? </p> <p> thanks, Marco </p> </description> <category>Ticket</category> </item> <item> <author>Marco Pappalepore <crillion@…></author> <pubDate>Thu, 09 Dec 2010 20:55:14 GMT</pubDate> <title>component changed https://svn.boost.org/trac10/ticket/4961#comment:4 https://svn.boost.org/trac10/ticket/4961#comment:4 <ul> <li><strong>component</strong> <span class="trac-field-old">date_time</span> → <span class="trac-field-new">Building Boost</span> </li> </ul> Ticket Vladimir Prus Sat, 25 Dec 2010 11:31:51 GMT <link>https://svn.boost.org/trac10/ticket/4961#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/4961#comment:5</guid> <description> <p> I am not entirely sure this is a problem with Boost. For starters, I am not even sure if using Boost with CLR is supposed to work, and if it is supposed to work, I'd imagine Boost shall be build with the same /clr options as the rest of the application. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Vladimir Prus</dc:creator> <pubDate>Tue, 01 Feb 2011 09:32:52 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/4961#comment:6 https://svn.boost.org/trac10/ticket/4961#comment:6 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">invalid</span> </li> </ul> <p> Lacking further discussion to justify this is supposed to work, and there's any problem in the way date_time is built, I am closing this ticket. Please reopen if new information is available. </p> Ticket