How to unload a C# addin dll without exiting Microstation. I have tried mdl unload and the dll does not unload.
IS there any way to unload the program without exiting Microstation?
Hi,
Unknown said:IS there any way to unload the program without exiting Microstation?
No, there is no such option avaiable officially. I think addin is also unloaded if you close a design file, but I have not tested in.
The reason of this limitation is that addins are loaded into MicroStation domain. And NET framework is designed in such way that aseembles cannot be unloaded from their domains. An alternative way is to load the addin into own domain (I remember a proper key-in was discussed in this community in the past), but it's not supported and not everything is working correctly in such case.
With regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
Unknown said:Is there any way to unload the program without exiting Microstation?
Unfortunately not. It's a characteristic of dynamic garbage-collection languages (e.g. C#, Java). A DLL cannot be reliably and deterministically removed from the host executable address space without the possibility of leaving some orphan memory. If you wish that it were otherwise, then I (and many others) would agree with you.
Related MSDN publications:
Regards, Jon Summers LA Solutions
This is possible if you load your c# add in into a different app domain in microstation.
By default microstation will load your c# add in into the microstation's global clr domain.
Try these commands:
MDL LOAD microstation.plugin.cant,,microstation.plugin.cant
clr unload domain microstation.plugin.cant
My project and dll was named microstation.plugin.cant, so you'll need to change that round to match whatever your c# dll is named.
There is a good guide here:
http://communities.bentley.com/communities/other_communities/bdn_other_communities/b/bdn-blog/archive/2011/09/14/learn-microstation-addins-step-by-step-3
The rest of that blog series is really handy to have a read through if you're developing c# plugins for Microstation