Skip to content

TypeLoadException when setting Imgui Context #88

@JimmyDirect

Description

@JimmyDirect

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions