char* str = "hello, World";
System::String* sys_str = new System::String(str);
Compile my c++ project in Release mode:
if I compile the above code with 'Program Database (/Zi)',
then it works fine.
if I disable 'Debug Information Format' (set
to 'Disable'), then it results in corrupted sys_str once
in a while. E.g. If I ran the above code in a loop, it
corrupts it on 972 iteration, i.e. resulting sys_str = '
llo, World'.
Is this a bug in .Net Framework? Has anyone experienced
similar problem?
thank you,
-Boris
Zach Kramer - 17 Nov 2003 04:15 GMT
Boris,
Is this on the 1.1 or 1.0 version of the .NET Framework??
I ran the following code on the 1.0 and 1.1 and did not see the problem
that you are describing:
int _tmain(void)
{
Console::WriteLine(S"Start");
// TODO: Please replace the sample code below with your own.
for(int i = 0; i< 1500; i++)
{
char* str = "hello, World";
System::String* sys_str = new System::String(str);
Console::WriteLine(sys_str);
}
Console::WriteLine(S"Hello World");
return 0;
}
I made sure that when I built the release build that Debug Infomation under
C/C++ was set to Disabled.
How were you detecting the corruption?? Could you post the code that you
were using to reproduce the problem.
Thanks,
Zach
Microsoft PSS