Serializing a COleDateTime object failes with VC++ 2005

I'm trying to build and run a MFC-based program with VS2005. It contains these lines of code:

m_pTime =new Dat_DateTime; // Dat_DateTime is derived from COleDateTime
m_pTime->m_status = COleDateTime::valid;
ar >> m_pTime->m_dt; // ar is of typeCArchive&

When I compile this with VC++ 2003 the Watch window looks like this (as it should):

- m_pTime 0x0af92470 Dat_DateTime*
- ATL::COleDateTime {...} ATL::COleDateTime
m_dt 38426.54724537037 double
m_status 0 ATL::COleDateTime::DateTimeStatus

But when I compile with VC++ 2005 (unchanged project settings) and test using the same input data I get this at the same break location:

- m_pTime 0x0807b968 Dat_DateTime*
- ATL::COleDateTime {...} ATL::COleDateTime
m_dt 38426.5 double
m_status error: unable to access invalid memory location ATL::COleDateTime::DateTimeStatus

and I get an exception when trying to access this variable later on. (note: the value "38426.5" is not a typo, it really looks truncated like this).

What is happening here? Is this a bug or can I do something to fix this behavior?

Thanks.
Manfred

[1264 byte] By [ManfredD] at [2008-2-27]
# 1
Well, when I run this again the time values seem to be initialized ok! But I did trace to the input of these variables because they had caused definitely an exception! Now I must confess that I'm even a bit more confused but also somewhat relieved. I apologize for the hoax Sad.

But of course the strange look of the Watch window under VS2005 remains disturbing! Should I register this as a bug?

-- Manfred

ManfredD at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 2
Hi Manfred,
We're looking into the odd change in the rounding and we'll let you know what the issue is later this week.
Thanks,
BorisJabesMS at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 3
Hi Manfred,

You have clearly identified a bug in the way we show floats/doubles in the debugger while in a managed code project. We have already begun our investigation into solving the issue and I encourage you to open a bug at http://msdn.microsoft.com/productfeedback in order to help both you and us track the bug's progress.

Thanks!

BorisJabesMS at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 4

I am sorry to interrupt that thread,

but i am having a very similar Problem.

I ported a middlesize Project from VS2003 to vs2005 (SP1) and experience some difficulties it seems also to be some floating errors as described before.

Its unmanaged code.

The funny fact is, that i am initialising 2 COleDateTimes the first one with 1902-01-01 00:00:00, thats always ok, and the second one with the current time (seconds are set to 0) and this second initialisation fails. (Additional information: that happens on PC only after some time and operations, on another it happens immidiatly) But it is 100% reproducable.

thanks in advance

Wolfgang

Wolfgang-h at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ Language...