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;
Developer technologies | Visual Studio | Debugging
Developer technologies | C++
{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.