While hunting for an infinite loop from a large project, I’ve been trying to debug with Visual Studio by Attach Unity Debugger as well as using a Windows Standalone build. When the app is running in either environment and I hit “Break All” in Visual Studio, I’d expect to see current line of code that is being executed as well as call stack. Instead I only get the following:
Your app has entered a break state, but there is no code to show because all threads were executing external code (typically system or framework code)." .
To ensure that my own code is executing, I created an infinite loop where the process ends up right after launching it. The app window freezes so I know it’s in that infinite loop but as I Break All in Visual Studio, the same message appears instead of indication where it’s hanging in my own code.
Setup for the Windows Standalone Build:
Unity 2020.3.45f1
- Scripting Backend: Mono
Build Settings: - Target Platform: Windows
- Architecture: x86_64
- Copy PDB Files
- Create Visual Studio Solution
- Development Build
- Deep Profiling Support
- Script Debugging
Code for the infinite loop:
int loopVar = 0;
while(loopVar<1000) {
++loopVar;
if(loopVar>500) {
loopVar = 0;
}
}
I also tried to debug using VSCode but couldn’t even get the debugging started. Any hints would be very much appreciated… even some other tech to do this?