Debug evaluator fails to evaluate

Godot Version

Godot 4.5.1.stable.mono

Question

Sometimes when I’m using the debugger, when I try to evaluate an expression it just doesn’t work. Either it kicks me back to the stack trace tab without doing anything, or it continues execution of the code for some reason. It’s not related to what expression I’m evaluating, even something like “1+2” will do this.

Am I missing something, or is the evaluator just buggy?

Missing something, though you haven’t provided enough detail to figure out what that may be.

I think I’ve found what causes it, it seems to happen specifically in static functions. Can recreate it as follows:

  1. Create a new project
  2. Add a new node and attach a script to it
  3. Add a static function to the script and call it from _ready()
  4. Put a breakpoint in the static function and run the scene
  5. In the debugger, try evaluating anything in the evaluator

I replicated the behavior you are seeing with this code:

extends Node2D

static func test_func():
  var test1 = 4
  test1 = 5
  print(test1)

func _ready() → void:
  test_func()

However, I am not convinced this is a bug. Yes, evaluating an expression causes code execution to resume, but it appears expression evaluation is outside the debug flow.