I'm designing a server-based game which will allow game creators to upload small bits of logic to the game server, while it is running, to add new functionality to the game. I've tried to implement C# scripting in the past, but always ran into trouble with how .NET worked; specifically the fact that on-the-fly compiled code would either stay resident forever, even if a newer version is loaded (which I consider a bad thing, since that's essentially a memory leak for an always-on server), or you'd have to do some funky stuff with loading/dropping appdomains and marshalling objects back and forth (a massive pain in the butt).
Now, it's been years since I last looked into this; has the situation gotten any better over the years? I know that now the Roslyn compiler is nearing completion, I'm hoping that will offer a better solution? I was initially enthusiastic to learn of the Roslyn "ScriptEngine" class to execute code dynamically, but have learned that it has since been removed from the codebase.
So is there any good C# scripting engine these days that I can run within my own C# app? The features I prefer are:
- Compile-once. I wouldn't want to recompile the code each time it's executed; only when it's updated.
- Memory-friendly. I would like to be able to drop old versions of the code from memory when the updated version is loaded.
- Easy to use. Having to use marshalling and remoting to communicate is undesirable.
EDIT: I should note that I'm running on the ASP.NET 5 platform at this point.
by mithrandirbooga via /r/csharp