Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Question Call Stack Not Working in Visual Studio Debug Mode

Discussion in 'Testing & Automation' started by Tomi-Tukiainen, Feb 23, 2023.

  1. Tomi-Tukiainen


    Jun 8, 2013
    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) {
    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?
    Last edited: Feb 23, 2023
  2. Tomi-Tukiainen


    Jun 8, 2013
    I was able to get it working with the Unity Editor. When debugging using Play Mode in Unity Editor one must have the Debug option enabled from the bottom right corner of Unity Editor.