[Boost-bugs] [Boost C++ Libraries] #4961: date_time causes "debug assertion failed" error in windows forms application, with visual c++ express 2010

Subject: [Boost-bugs] [Boost C++ Libraries] #4961: date_time causes "debug assertion failed" error in windows forms application, with visual c++ express 2010
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-12-07 23:54:35


#4961: date_time causes "debug assertion failed" error in windows forms
application, with visual c++ express 2010
---------------------------------+------------------------------------------
 Reporter: crillion@… | Owner: az_sw_dude
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: date_time
  Version: Boost 1.45.0 | Severity: Problem
 Keywords: |
---------------------------------+------------------------------------------
 Hi,

 I have a debug assertion failure which arises when I include
 boost/date_time/gregorian.hpp.

 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).

 I have currently a build of boost (both of 1.44.0 and 1.45.0)
 obtained with the command

 bjam --prefix="..\boost_1_45_0_build" install

 which has worked normally.

 In synthesis, the steps are:
 - I create a Visual C++ Windows Form Application
 - in the project properties, I set the CLR support switch for the project
 from default (/clr:pure) to /clr (used for mixed code)
 * please note that I set this switch in 2 points of the project properties
 tree:
   1) Configuration Properties/General->Common Language Runtime Support,
 and
   2) Configuration Properties/ C/C++ /General->Common Language Runtime
 Support
 - in the stdafx.h file I add the inclusion
 #include <boost/date_time/gregorian/gregorian.hpp>
 - I build the solution
 - I run the project

 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:
 -------------------
 Debug Assertion Failed!

 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

 Expression: _CrtIsValidHeapPointer(pUserData)

 For information on how your program can cause an assertion failure, see
 the Visual C++ documentation on asserts.

 (Press Retry to debug the application)
 -------------------

 Pressing retry I go to an involved system file, not even to a boost source
 code file or to one of my source files.

 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.

 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.


 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).

 So, what can be done to avoid this ?

 Please let me know if you need help to reproduce the problem.

 Many thanks,

           Marco

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4961>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:05 UTC