question

Serge A avatar image
0 Likes"
Serge A asked Serge A commented

Interrupting debug of the User Interface

If there is a debug() statement in some nodefunction of a GUI, the code editor window is opened upon reaching the breakpoint. The editor window points to the instance of the UI, not the prototype. That's fine, but the is a usability issue if the user closes the GUI first while still in debug.

  • code editor remains in debug mode, but the node function, which it was connected to, ceases to exist
  • normal user interface functionality of Flexsim becomes inaccessible:
    • views become non-responsive to mouse events
    • the model cannot be saved
    • it's impossible to execute commands in Script console (if it happens to be open)
  • it's impossible to quit Flexsim normally
    • on clicking Windows close button, Flexsim asks to save the model, but no matter what option the user chooses, the program doesn't close
  • sometimes this leads to eventually crashing Flexsim altogether
  • the most recent changes to the model will be lost

I suggest to implement a keyboard shortcut to interrupt all debug activity anytime, and stop debugging automatically in related code editor windows when the GUI is closed (or probably close these windows as well). This would avoid possible loss of data and confusion of having orphaned code windows.

Maybe I miss something, and interrupting debug from keyboard is possible? (As indicated above, the views are not responding to the mouse, though it's possible to switch between the views).

Steps to reproduce:

  1. Open a new model
  2. In Toolbox, add a new custom Graphical User Interface
  3. Add a button to the GUI
  4. In the button's >OnPress add debug(); statement
  5. Right-click on the GUI in the Toolbox and choose Show GUI
  6. Click the button
  7. Close GUI
FlexSim 17.0.2
bugguidebug
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Sam Stubbs avatar image Sam Stubbs ♦ commented ·

I'll let the developers know about the issue. Thank you for pointing this out.

0 Likes 0 ·

1 Answer

Matt Long avatar image
4 Likes"
Matt Long answered Serge A commented

The debugger built into FlexSim is quite the complicated beast. We don't restrict where you can create debug points, even though it certain places it can cause big issues (ie in the OnDraw trigger of an object).

When you're trying to debug view code, you can run into a number of issues as the process of opening the debugger changes the views in FlexSim. In this case you're closing a view that is in the middle of being debugged. Though FlexSim ought to handle this better, currently it does not and it's not high on our development list to fix it. My suggesiton would be, don't close a window/view you're trying to debug.

· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Serge A avatar image Serge A commented ·

Thank you for suggesting a workaround. My problem is that even if I know about this bug, I keep triggering it again and again (and even losing some work occasionally). Probably, it is related to the fact that there is no global visible indicator that debug is in progress. So if the upper part of the code window with an active breakpoint is not visible at the moment (or another tab is currently active), there is absolutely no visual clue that warns to thread lightly...

1 Like 1 ·