Pryaxis / orion-core

The next generation Terraria Server API.
https://pryaxis.github.io/orion-core
GNU General Public License v3.0
31 stars 12 forks source link

Proper Plugin Sandboxing #3

Closed Ijwu closed 8 years ago

Ijwu commented 9 years ago

I don't know if 'sandboxing' is the right term, but one thing that's been an issue in TShock is that once plugins are loaded they're stuck. You can't unload nor reload a plugin. Since the method we use to load plugins has been to load the plugin types out of third party assemblies into the TShock AppDomain we can't really unload or reload them.

This issue highlights development made towards the progress of loading plugins in a way which allows their types to be disposed of and reloaded. The way to do this would be to load the types into a separate AppDomain. This can be done manually or facilitated with the System.AddIn namespace.

tylerjwatson commented 9 years ago

Please be aware that types loaded in a separate AppDomain cannot be shared with eachother, even in the static GCRoot. Marshalling types between app domains have to be done by a marshaller by inheriting from MarhsalByRefObject