-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding some sort of installable error handler / callback for improved diagnostics. #477
Comments
Does https://github.com/ImGuiNET/ImGui.NET?tab=readme-ov-file#debugging-native-code not work for you? This requires you to generate debug level binaries (which you can via this repo pipeline: https://github.com/ImGuiNET/ImGui.NET-nativebuild/actions/runs/9106225132) as shown in the screenshot below. once you do all of this, you can put breakpoints in C++/C code. |
you want to produce good error messages in production/user environments? Give |
We don't really want to debug native code and for our end users who use our engine as a black box, we don't want to burden them with this level of IDE configuration. What we're looking for is a simple installable error handler that we can wrap with a run-of-the-mill #if DEBUG statement. Does ImGui itself not expose a function pointer-based global C error handler like this such as is done in OpenGL? |
We don't want to use debug-built libraries if we can at all avoid them. It is important to have our engine run usably fast in debug mode as that's where most initial play testing takes place. All we need is to produce a single, simple imgui-specific error log before ImGui takes down the entire runtime with it (IE, not just a generic AccessViolationException). Ideally this wouldn't require an entirely different and significantly slower debug lib build. |
I see, fair enough, I think this question needs an answer from maintainers of imgui ( https://github.com/ocornut/imgui ) feel free to post the question there. I am curious as well. |
Currently, when anything goes wrong with ImGui.NET invocation, we end up with an AccessViolationException with no diagnostics or asserts or other clues as to what failed. This is particularly problematic for game editors because we intentionally (have to) expose the ImGui API so that it can be called by users to extend editor behavior.
The only error we ever receive when the use invokes the ImGui.NET API incorrectly is an AccessViolationException. Presumably because this is how the .NET runtime handles C++ exceptions and C asserts that might otherwise be meaningful (tho correct me if I'm wrong, maybe in this case it's just a null pointer dereference exception). What I think might be an improvement on either this wrapper API (or perhaps in imgui itself if required) is to expose an OpenGL-like error report handler. That way, we can pass in a lambda that gets called which can intercept at least some diagnostic information because the entire VM goes down from the AVE.
The text was updated successfully, but these errors were encountered: