I
Ioannis Vranos
I had reported this as a bug:
Description:
Default indexed property of System::String crashes for object with stack
semantics.
int main()
{
using namespace System;
String ms= "Test string";
char c;
for(long i=0; i<ms.Length; ++i)
c=ms;
}
Actual Results:
C:\c>cl /clr:safe temp.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 14.00.41013
for Microsoft (R) .NET Framework version 2.00.41013.0
Copyright (C) Microsoft Corporation. All rights reserved.
temp.cpp
Microsoft (R) Incremental Linker Version 8.00.41013
Copyright (C) Microsoft Corporation. All rights reserved.
/out:temp.exe
temp.obj
C:\c>temp
Unhandled Exception: System.NullReferenceException: Object reference not
set to
an instance of an object.
at main()
C:\c>
Expected Results:
C:\c>cl /clr:safe temp.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 14.00.41013
for Microsoft (R) .NET Framework version 2.00.41013.0
Copyright (C) Microsoft Corporation. All rights reserved.
temp.cpp
Microsoft (R) Incremental Linker Version 8.00.41013
Copyright (C) Microsoft Corporation. All rights reserved.
/out:temp.exe
temp.obj
C:\c>temp
C:\c>
And the response:
Edited by Microsoft on 2005-01-27 at 11:03:28
Thank you for submitting this to us. We will investigate and keep you
informed.
Visual C++ Team
Resolved as By Design by Microsoft on 2005-01-28 at 17:58:13
Looking at this, the bug is actually a problem with ill-formed code.
System::String without the caret for a handle is not allowed. The
language specification is being updated to reflect this.
Thanks for the feedback!
Brandon Bray
My question is: Wouldn't be System::String objects allowed with stack
semantics?
Description:
Default indexed property of System::String crashes for object with stack
semantics.
int main()
{
using namespace System;
String ms= "Test string";
char c;
for(long i=0; i<ms.Length; ++i)
c=ms;
}
Actual Results:
C:\c>cl /clr:safe temp.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 14.00.41013
for Microsoft (R) .NET Framework version 2.00.41013.0
Copyright (C) Microsoft Corporation. All rights reserved.
temp.cpp
Microsoft (R) Incremental Linker Version 8.00.41013
Copyright (C) Microsoft Corporation. All rights reserved.
/out:temp.exe
temp.obj
C:\c>temp
Unhandled Exception: System.NullReferenceException: Object reference not
set to
an instance of an object.
at main()
C:\c>
Expected Results:
C:\c>cl /clr:safe temp.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 14.00.41013
for Microsoft (R) .NET Framework version 2.00.41013.0
Copyright (C) Microsoft Corporation. All rights reserved.
temp.cpp
Microsoft (R) Incremental Linker Version 8.00.41013
Copyright (C) Microsoft Corporation. All rights reserved.
/out:temp.exe
temp.obj
C:\c>temp
C:\c>
And the response:
Edited by Microsoft on 2005-01-27 at 11:03:28
Thank you for submitting this to us. We will investigate and keep you
informed.
Visual C++ Team
Resolved as By Design by Microsoft on 2005-01-28 at 17:58:13
Looking at this, the bug is actually a problem with ill-formed code.
System::String without the caret for a handle is not allowed. The
language specification is being updated to reflect this.
Thanks for the feedback!
Brandon Bray
My question is: Wouldn't be System::String objects allowed with stack
semantics?