ImGuiNET / ImGui.NET

An ImGui wrapper for .NET.
MIT License
1.8k stars 298 forks source link

System Access Violation when using multiple modules/plugins #230

Open RoyAwesome opened 3 years ago

RoyAwesome commented 3 years ago

I'm trying to integrate imgui.net in my game engine, and I have a plugin system set up. I initialize imgui.net in my engine dll, but when I load a plugin that links to my engine, any attempt to access imgui throws an exception when calling anything imgui related.

I've got an AssemblyLoadContext set up to handle native dlls (imgui.net is not the only native backed library I use), but it doesn't appear that this library attempts to go through the AssemblyLoadContext. I suspect that there is something special going on here with loading the native dll that is causing this issue, since I can't manage the native library resolution.

I'm out of ideas on what to do on my end.

zaafar commented 3 years ago

Hi, I am a noob here but since you are out of ideas.

This repo is using ImGui.NET and have a plugin system as well. https://github.com/Qvin0000/ExileApi example plugins: https://github.com/Qvin0000/ExileApiPlugins example plugin which is calling ImGui functions: https://github.com/Qvin0000/ExileApiPlugins/blob/0af54ddb7738f08461a6bddec637c2725c1d495b/DevTree/DevTree.cs#L165

RoyAwesome commented 3 years ago

Hey, thanks for this. I'll take a look at it!