Crash on Fusion shutdown after calling .NET code from an Addin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This may be in the wrong forum, apologies if it is.
When calling a C++/CLI WinForm from a Fusion add-in with the Visual Studio debugger attached everything works, and my Add-in shows UI and closes without error. Fusion then continues to work normally. However when I then shut down Fusion there is a crash (access violation) that comes from the GC Finalizer Thread. From the callstack, it looks like it is trying to delete a font, but it hits a deadlock.
Callstack
Now I'm aware that Fusion may not have even had a GC Finalizer Thread to crash if I hadn't started .NET in my code, but I suspect it's a bug in Fusion's shutdown (possibly GDIPlus being Initialized by .NET and Fusion and Fusion not shutting down with the right token or something).
I do nothing in my code, aside from launch a WinForm. For a repro, just do exactly what is described here:
https://modthemachine.typepad.com/my_weblog/2016/02/fusion-add-in-with-net-c-clr.html
If I don't launch a WinForm, but instead Console::WriteLine() or some other C# command, then Fusion exits cleanly. This may have gone unnoticed as you only really see it if you have a debugger attached to Fusion while it's shutting down.
Any advice on anything I'm doing wrong, or suggestions would be very welcome.