ImGui.NET
ImGui.NET copied to clipboard
Access Violation when using Nuget package
Trying Veldrid/ImGui example:
class Program
{
static void Main(string[] args)
{
VeldridStartup.CreateWindowAndGraphicsDevice(
new WindowCreateInfo(50, 50, 1280, 720, WindowState.Normal, "ImGui.NET Sample Program"),
new GraphicsDeviceOptions(true, null, true, ResourceBindingModel.Improved, true, true),
out var window,
out var gd);
var imguiRenderer = new ImGuiRenderer(gd, gd.MainSwapchain.Framebuffer.OutputDescription, window.Width, window.Height);
window.Resized += () =>
{
gd.MainSwapchain.Resize((uint)window.Width, (uint)window.Height);
imguiRenderer.WindowResized(window.Width, window.Height);
};
var cl = gd.ResourceFactory.CreateCommandList();
while (window.Exists)
{
var input = window.PumpEvents();
if (!window.Exists) { break; }
imguiRenderer.Update(1f / 60f, input); // Compute actual value for deltaSeconds.
// Draw stuff
ImGui.Text("Hello World");
cl.Begin();
cl.SetFramebuffer(gd.MainSwapchain.Framebuffer);
cl.ClearColorTarget(0, RgbaFloat.Black);
imguiRenderer.Render(gd, cl);
cl.End();
gd.SubmitCommands(cl);
gd.SwapBuffers(gd.MainSwapchain);
}
}
}
Crashes on line:
var imguiRenderer = new ImGuiRenderer(gd, gd.MainSwapchain.Framebuffer.OutputDescription, window.Width, window.Height);
With error:
System.AccessViolationException: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.'
Packages (just the veldrid/imgui ones listed here):
<package id="Veldrid" version="4.9.0-beta1" targetFramework="net472" />
<package id="Veldrid.ImGui" version="5.72.0" targetFramework="net472" />
<package id="Veldrid.MetalBindings" version="4.9.0-beta1" targetFramework="net472" />
<package id="Veldrid.OpenGLBindings" version="4.9.0-beta1" targetFramework="net472" />
<package id="Veldrid.SDL2" version="4.9.0-beta1" targetFramework="net472" />
<package id="Veldrid.StartupUtilities" version="4.9.0-beta1" targetFramework="net472" />
<package id="ImGui.NET" version="1.87.2" targetFramework="net472" />
<package id="ImGui.NET.Docking" version="1.75.0" targetFramework="net472" />
Thoughts?