ImGuiNET / ImGui.NET

An ImGui wrapper for .NET.
MIT License
1.85k stars 300 forks source link

1.68 crashes on initialize #115

Closed bholcomb closed 5 years ago

bholcomb commented 5 years ago

I'm using Imgui.net in a project (through nuget) and when I upgraded, my project crashes in ImGui.CreateContext(); If I downgrade to 1.67, then everything works again.

It looks like the cimgui.dll in 1.68 is identical to the one in 1.67. Not sure if that is the issue or not, but it seems unusual that the cimgui.dll didn't change at all.

Any ideas?

cheers,

bob

mellinoe commented 5 years ago

The 1.68 DLL should be different in the NuGet package. Is your project in a weird state where it is still deploying the 1.67 native DLL for some reason?

bholcomb commented 5 years ago

It's possible that there was a problem with my system, so I set up a clean environment and repulled all the packages. I'm still seeing the same problem:


Unhandled Exception: System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
   at ImGuiNET.ImGuiNative.igCreateContext(ImFontAtlas* shared_font_atlas)
   at DISSpy.ImGuiController.initialize() in C:\MAKDEV\extras\disSpy - Copy\libsrc\disSpy\imguiController.cs:line 47
   at DISSpy.DISSpyApp.OnLoad(EventArgs e) in C:\MAKDEV\extras\disSpy - Copy\libsrc\disSpy\program.cs:line 81
   at OpenTK.GameWindow.Run(Double updates_per_second, Double frames_per_second) in /home/jarl/Programming/opentk-3.0/src/OpenTK/GameWindow.cs:line 350
   at DISSpy.Program.Main(String[] args) in C:\MAKDEV\extras\disSpy - Copy\libsrc\disSpy\program.cs:line 126

I am seeing a size difference now between the two dlls, (540k for 1.67 vs 504k for 1.67).

When I look at the DLL with dependency walker, it shows it's the x86 version and not the x64 version. I'm not sure how to change that in nuget. What do you think?

cheers,

Bob

mellinoe commented 5 years ago

Can you describe how your project is set up? E.g. is it a .NET Framework app targeting any particular architecture? Are you using packages.config or PackageReference? There might be some problem with the runtime detection in some cases.

bholcomb commented 5 years ago

I'm using premake to setup my projects. I only have x64 targets in my solution. What I find the weirdest is the different behavior if I use 1.67 vs 1.68 without changing anything else.

I also get the same behavior if I setup my projects without any nuget commands in the premake script and add IMGUI.net manually through the nuget package manager in visual studio.

cheers,

Bob

mellinoe commented 5 years ago

@bholcomb Can you provide a repro project? I'm not familiar with premake. When I create a blank .NET Framework project and reference ImGui.NET 1.68, everything works as expected, regardless of how I configure my project (e.g. x86 vs x64 vs. AnyCPU, PackageReference vs. packages.config).

bholcomb commented 5 years ago

I can't provide a repo since this is an internal project, but I suspect it's because I'm using premake to generate the project files. I'm going to try setting things up with dotnet and I will let you know if I'm still seeing an issue. I'll close this report and open a new one if I encounter any more issues (that aren't mine).

Thanks for your help, and thank you for an awesome library.

cheers,

Bob

bholcomb commented 5 years ago

Just a follow up....Rebuilding my projects as .net core 2.2 and using dotnet to setup my projects fixes all my issues. Sorry for wasting your time.

Cheers,

Bob