Hexa.NET.ImGui icon indicating copy to clipboard operation
Hexa.NET.ImGui copied to clipboard

TypeLoadException when setting Imgui Context

Open JimmyDirect opened this issue 3 months ago • 2 comments

Hello, I know this might not necessarily be a HexaNet.Imgui problem but I would need help troubleshooting the following exception, which happens only on a specific Machine but works fine on others.

The type initializer for 'Hexa.NET.ImGui.Backends.D3D11.ImGuiImplD3D11' threw an exception.
 ---> System.TypeInitializationException: The type initializer for 'Hexa.NET.ImGui.Backends.ImGuiImpl' threw an exception.
 ---> System.DllNotFoundException: Unable to load DLL 'ImGuiImpl.dll' or one of its dependencies: The specified procedure could not be found. (0x8007007F)
   at System.Runtime.InteropServices.NativeLibrary.Load(String libraryPath)
   at HexaGen.Runtime.LibraryLoader.LoadLibrary(LibraryNameCallback libraryNameCallback, LibraryExtensionCallback libraryExtensionCallback)
   at Hexa.NET.ImGui.Backends.ImGuiImpl..cctor()
   --- End of inner exception stack trace ---
   at Hexa.NET.ImGui.Backends.D3D11.ImGuiImplD3D11..cctor()
   --- End of inner exception stack trace ---
   at Hexa.NET.ImGui.Backends.D3D11.ImGuiImplD3D11.SetCurrentContext(ImGuiContextPtr ctx)

The mentioned DLL file is there for sure and this is the code that leads to that exception:

            _deviceContext = (Vortice.Direct3D11.ID3D11DeviceContext)deviceContext.DeviceContext;
            _device = (Vortice.Direct3D11.ID3D11Device)device.Device;
            
            _imGuiContext = ImGui.CreateContext();
            ImGui.SetCurrentContext(_imGuiContext);

            unsafe
            {
                var d = new ID3D11DevicePtr((ID3D11Device*)_device.NativePointer);
                var c = new ID3D11DeviceContextPtr((ID3D11DeviceContext*)_deviceContext.NativePointer);

                ImGuiImplD3D11.SetCurrentContext(_imGuiContext); // throws
                ImGuiImplD3D11.Init(d, c);
            }

I checked with a native dependency checker tool directly on the affected machine, but it says all dependencies are fulfilled.

This is on Win10 with Nvidia GPU with these versions:

  • Hexa.NET.ImGui Version="2.2.8.5"
  • Hexa.NET.ImGui.Backends Version="1.0.17.4"

Thanks for any help!

JimmyDirect avatar Sep 08 '25 06:09 JimmyDirect