hoffstadt / DearPyGui

Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies
https://dearpygui.readthedocs.io/en/latest/
MIT License
13.35k stars 695 forks source link

DearPyGUI creashes and exit without any error message #2405

Open tonyzhangnxp opened 1 month ago

tonyzhangnxp commented 1 month ago
  1. PLEASE CAREFULLY READ: FAQ

  2. PLEASE CAREFULLY READ: Documentation

  3. FOR FIRST-TIME USERS ISSUES, please use the Discord server.

  4. REMOVE ALL 3RD PARTY LIBRARIES.

  5. PLEASE MAKE SURE that you have: read the FAQ; explored the examples; searched among Issues; and read the link provided in (1) (2).

  6. Be mindful that messages are being sent to the e-mail box of "Watching" users. Try to proof-read your messages before sending them. Edits are not seen by those users.

  7. Delete points 1-7 and PLEASE FILL THE TEMPLATE BELOW before submitting your issue or we will immediately close it.

Thank you!


Version of Dear PyGui

Version: 2.0 Operating System: Windows 10

My Issue/Question

In version 1.11.1, it can still work for a while. After upgrading to version 2.0, dearpygui crashes immediately after UI being displayed without any error prompts.

I was trying to debug on VS, when the UI displayed and when I step over the "dpg.render_dearpygui_frame()" again, then it crashes without any information.

Is there any way to capture and analyze error information? Since there is a relatively large amount of code, it is not very suitable for uploading.

v-ein commented 1 month ago

Does a minimal example also crash on 2.0 on your system? Like this...

import dearpygui.dearpygui as dpg

dpg.create_context()
dpg.create_viewport(title='Test', width=600, height=300)

with dpg.window(label="Example Window"):
    dpg.add_text("Hello, world")

dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
tonyzhangnxp commented 1 month ago

It's working fine.

tonyzhangnxp commented 1 month ago

And with the same codes, v1.11 could stay longer, and will crash without information as well. Is there any way to capture this issue?

crashes

v-ein commented 1 month ago

You mentioned VS - does this mean Visual Studio or is it Visual Studio Code? If you have Visual Studio installed, Windows typically offers to debug the app in VS when it crashes. If you can do that, can you post a screenshot of the call stack? It might give some clues.

Since the PyPI version was built without debug info, there's little you can pull out of it. If you really want to pursue this, you can try to build DPG yourself - and use either Debug or RelWithDebInfo configuration (I'd recommend to start with RelWithDebInfo because it has optimizations just like Release - the app behavior on Debug might be different).

v-ein commented 1 month ago

My typical approach to debugging such issues is to (1) recreate the issue with a RelWithDebInfo build, and (2) on crash, open Visual Studio and.. well, debug it :rofl:. AFAIK, DPG doesn't have any logging or something that would make it easier.

v-ein commented 1 month ago

Also: if you start your app on 1.11 and don't touch the UI, does it eventually crash as well?

tonyzhangnxp commented 1 month ago

Also: if you start your app on 1.11 and don't touch the UI, does it eventually crash as well?

Yes, but not so quick. I'm using VS code debugging the scripts. I can't see the stack info when crash happened. I will build the DPG locally and try the RelWithDebInfo . Thank you for your reply.

tonyzhangnxp commented 1 month ago

I have a question, DPG build into so, how to debug with so library?

v-ein commented 1 month ago

Well, a .so is for Linux, but your description and GIF indicate Windows. On Windows, DPG builds into a .pyd file, which is essentially a DLL, just renamed to .pyd (a .so is also like a DLL but for Linux).

I'm not sure that VS Code can debug DLLs (maybe it can, depends on extensions; I've never used it this way). Visual Studio (not Code), if you have it, might be a better choice.

tonyzhangnxp commented 1 month ago

Hi I had Visual Studio 2022. Open the dpg folder, but which of the items should be selected ? image

v-ein commented 1 month ago

When your program crashes on this system, does it show a message box suggesting to debug the program? If not, then probably Visual Studio is not selected as the default postmortem debugger. See this topic to enable such debugging.

https://stackoverflow.com/questions/197171/how-to-set-visual-studio-as-the-default-post-mortem-debugger

In theory, after you tick the "Native" checkbox, it should start offering you to debug the app. The StackOverflow topic is pretty old, but seems to still apply to later versions of VS (not sure about 2022, I have an older version).

v-ein commented 1 month ago

Also see the comment in there about WER in Windows 10.