[Mono-list] Embedding mono/C# in a file format...

Jonathan Pryor jonpryor at vt.edu
Sat Jan 3 22:23:43 EST 2009


On Sat, 2009-01-03 at 07:46 -0800, SniperSlap wrote:
> I'm interested in creating an xml-based file format that can include code or
> if required bytecode.
...
> If I'm writing an application in mono/.NET, how do I create a sandbox within
> which I can run more mono/.NET bytecode?

Google up:

  - AppDomains
  - Code Access Security
  - System.CodeDom

AppDomains and CAS work together to create sandboxes within a process.
(The only problem is that CAS isn't fully supported by mono, though you
may look into --security=core-clr, which is what Silverlight/Moonlight
use for sandboxing purposes...).

System.CodeDom allows you to ~easily generate IL at runtime based on
C#/VB.NET/etc. code.

So you could store C# code within your XML file, and use System.CodeDom
to convert the stored C# code into IL for execution within an AppDomain
with core-clr security that you create as a sandbox.

 - Jon




More information about the Mono-list mailing list