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: 

Addin cause the crash/shutdown of Fusion (after last update 18.1 i guess)

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
tomas.bangoA2EPZ
441 Views, 8 Replies

Addin cause the crash/shutdown of Fusion (after last update 18.1 i guess)

Hi, I would like to ask for help, during the last update changes in the API caused my addin to crash or shut down Fusion when trying to run the addin.

 

I have not been able to track down what could be causing this according to the API changes. It worked fine yesterday

8 REPLIES 8
Message 2 of 9
Phil.E
in reply to: tomas.bangoA2EPZ

Hi,

 

I'm not an add-in expert, but I do follow crash reports. I can't find any reports from this week sent by you. Are you getting a crash report dialog?





Phil Eichmiller
Software Engineer
Quality Assurance
Autodesk, Inc.


Message 3 of 9
tomas.bangoA2EPZ
in reply to: Phil.E

That's just the weird thing, after clicking OK, Fusion crashes or shuts down but without any crash report or error message. I guess problem will be somewhere in class SCbuttonOKEventHandler(adsk.core.CommandEventHandler😞

Message 4 of 9

The error occurs at lines 181 and at line 232 for an unknown reason:

importManager.importToTarget(importOptions, root)

 

Message 5 of 9
kandennti
in reply to: Phil.E

Hi.

 

Crash when using ImportManager.importToTarget in the Execute event handler.

I've attached a simple script that can reproduce the problem.

It seems that the Execute event is fired many times when importToTarget is used.

Message 6 of 9
Phil.E
in reply to: kandennti

Thanks for the examples, developers are looking at this now.





Phil Eichmiller
Software Engineer
Quality Assurance
Autodesk, Inc.


Message 7 of 9

Tomas,

 

The problem is indeed calling importToTarget in a custom Command's execute event handler. The issue is that a very small number of API functions are implemented by executing an existing command, and importToTarget is one of those. Executing a command during the execute event handler (or really any event handler) of another command will cause a problem. Starting the new command will attempt to suspend/end the current custom command, but it is blocked in the event. (In this case, it is trying to commit the current step transaction of the current command by 'executing' it, which causes another invoke of your execute, in which you call importToTarget again. Eventually this infinite recursion will blow the stack.)

 

I created issue FUS-97456 for this. But the immediate 'fix' would most likely be to increase the error handling around this case and cause nested command based APIs like importToTarget to fail in a more controlled manner. E.g. with an error like 'not allowed during command events'.

So unfortunately, you will currently need to perform the importToTarget outside of the Command. You could fire a CustomEvent to your application from the end of your Command.execute to perform the importToTarget and the remainder of the command logic outside of the command. (I understand that this means you lose the transaction boundary that the command was providing.)

 

Kris



Kris Kaplan
Message 8 of 9

Thank you for your efforts and help guys, I am working on it

Message 9 of 9

According to this message, this bug has been fixed with the latest version of Fusion 360 (2.0.12376).

 

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report