Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ELI5 Why to unsubscribe events on shutdown

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
H.echeva
186 Views, 2 Replies

ELI5 Why to unsubscribe events on shutdown

Hello,

 

I am watching a Revit API course and in one lesson he says that we should unsubscribe Onshutdown from the event that he created (document changed).

Can someone explain why this is necessary? If Revit is closed, it cannot longer run that code right?

2 REPLIES 2
Message 2 of 3
ricaun
in reply to: H.echeva

Yes, you should unsubscribe in the Onshutdown, that's a good practice.

 

Before Revit finishes closing every application Onshutdown is called and at this time Revit still running anything could happen.

 

And imagine if you could load/unload an application with Revit open. If you do not unsubscribe, the event gonna stay forever in Revit until you close.

 

With the AppLoader you can load/unload an application with Revit open, and here is why you should unsubscribe in the Onshutdown.

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

Message 3 of 3
H.echeva
in reply to: ricaun

Thanks, I imagined there would be a good reason. Cheers

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

Post to forums  

Autodesk Design & Make Report