Cannot watch dynamic array elements in C++ with /clr

Christian Scheffler 1 Reputation point
2020-11-09T12:47:57.12+00:00

I have a problem debugging elements of dynamic arrays in VS C++. using the watch window which obviously does not work with Windows Forms.
In the example below all array elements can be seen using arr,5 in the debugger watch window compiling a console application. However, this is not the case, for instance, in a button click event function working with Windows forms. In this case only the first element can be listed.
What's wrong?

//Example:
int* arr = new int[5];
for (int i = 0; i < 5; i++)
     arr[i] = std::rand() % 100;
return 0;
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,686 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
986 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.