There was a very similar thread recently (with open file or open dir dialog / though I believe Win11).
It turned out to be a bug in the FpDebug in 2.2.4.
If you are affected by the same issue, then you have 2 options:
1) Use Lazarus 2.3 (git main branch)
2) Use the gdb based debugger (Tools > Options > Debugger > Debugger Backend)
If using gdb, ensure not to use "Dwarf 3", instead use "Dwarf with sets"