Skip to content
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

System.AccessViolationException in BeginPlot #23

Open
gsuberland opened this issue Mar 24, 2023 · 4 comments
Open

System.AccessViolationException in BeginPlot #23

gsuberland opened this issue Mar 24, 2023 · 4 comments

Comments

@gsuberland
Copy link

I created a new project in vscode and added the NuGet packages, and copied the demo code over to test the setup. However, I get the following on startup:

Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Repeat 2 times:
--------------------------------
   at DearImPlot.ImPlot+__Internal64.BeginPlot(System.String, IntPtr, DearImPlot.ImPlotFlags)
--------------------------------
   at DearImPlot.ImPlot.BeginPlot(System.String, System.Numerics.Vector2, DearImPlot.ImPlotFlags)
   at DearImPlot.ImPlot.BeginPlot(System.String)
   at TestApp.MyGameWindow.OnRenderFrame(OpenTK.Windowing.Common.FrameEventArgs)
   at OpenTK.Windowing.Desktop.GameWindow.DispatchRenderFrame()
   at OpenTK.Windowing.Desktop.GameWindow.Run()
   at TestApp.Program.Main(System.String[])

I can see from Process Hacker that the x86-64 glfw3.dll, imgui.dll, and implot.dll binaries (v1.8 / v0.14) are being loaded fine. These are the exact ones from the NuGet package.

@aybe
Copy link
Owner

aybe commented Mar 24, 2023

Without code, it's hard to tell...

Off the top of my head:

https://github.com/aybe/DearImGui/blob/develop/SampleApplication.OpenTK/MyGameWindow.cs#L42

https://github.com/aybe/DearImGui/blob/develop/SampleApplication.OpenTK/MyGameWindow.cs#L44

These are a must to call else you typically get access denied.

@gsuberland
Copy link
Author

It's a direct copy/paste of the sample app.

The fault occurs on this call:

if (ImPlot.BeginPlot("Sample plot"))

@aybe
Copy link
Owner

aybe commented Mar 24, 2023

Push your repo somewhere.

@undefinedvalue
Copy link

I'm getting this also. It works fine if I clone this repository, build, then run the sample application. But when I replace the sample application's dependency on the DearImPlot project with a dependency on the DearImPlot NuGet package, I get the AccessViolationException.

When I enable native code debugging and attach source for implot.cpp (from the commit depended on by DearImGui: 15e494b, I get the following error at implot.cpp line 2332:

Exception thrown: read access violation.
Window was 0xFFFFFFFFFFFFFF64.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants