Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Crash on Fusion shutdown after calling .NET code from an Addin

1 REPLY 1
Reply
Message 1 of 2
chris.monachanZWSCF
288 Views, 1 Reply

Crash on Fusion shutdown after calling .NET code from an Addin

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.

 

CallstackCallstack

 

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. 

Labels (5)
1 REPLY 1
Message 2 of 2

Interesting concept!

 

edit. The forum is very hard to use on a small mobile screen..

 

Can't say that I can help you with the problem, but here's some random thoughts:

* Fusion uses Qt5 for the GUI. I don't now if they "bypass" Qt anywhere.

* Can you make .net clean up in stop()? I guess it could mess with other. net addins.

* API monitor works like strace, but on Windows. It might tell you what fusions doing (using GDI at all?) . Don't try to trace all APIs at once though 🙂 http://www.rohitab.com/apimonitor

 

edit: clean-up: Force GC?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report