Please help to resolve this mystic problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Please take a look at the simple console app code below:

#include "stdafx.h"

#using <mscorlib.dll>

using namespace System;

typedef struct {
unsigned long checkSum;
} DATALOG_FILE;

class CLogConfig
{
public:
CLogConfig();
~CLogConfig();

public:
DATALOG_FILE log [16];
};

CLogConfig::CLogConfig()
{
}

CLogConfig::~CLogConfig()
{
}

int _tmain()
{
CLogConfig m_LogConfig;

m_LogConfig.log[0].checkSum = 123 ;
m_LogConfig.log[5].checkSum = 456 ;
m_LogConfig.log[9].checkSum = 789 ;

return 0;
}

I set breakpoint at the beginning of main procedure, run this program in
VS.NET 2003 debugger and debug it step by step. I add
m_LogConfig.log[0].checkSum
values to watch window and observe the following:

The first statement works fine and value 123 assigned to
m_LogConfig.log[0].checkSum

However the second and third statement due to unknown reasons do not assign
values 456 and 789.

Even when I open QuickWatch window and try to change value of variable
m_LogConfig.log[5].checkSum the error dialog "Cannot Change Value" pops up.

Can anyone explain what is going wrong with this code?

Thank you
 
It looks like a bug in the debugger or build tools.

You can use tracing / console output to verify that the application
itself works correctly.

Regards,
Oleg
[VC++ MVP]
 
You are right. This is debugger bug. Tracing confirmed that all values are
set corectly.

I wonder whether someone in Microsoft will look into this problem or not?

Thanks
 
Hi Oleg,
You are right. This is debugger bug. Tracing confirmed that all values are
set corectly.

I was able to replicate your problem here. It does happen with VC .NET 2003.

I've runned it under Whidbey Beta 1 too, and the "good" news is that
apparently it has been fixed. ;-)

Fabro
 
Back
Top