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

SniperSlap atrauzzi at gmail.com
Sun Jan 4 15:15:10 EST 2009




Jonathan Pryor wrote:
> 
> 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
> 
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
> 
> 

I noticed after writing my initial message that Mono 2.2 is going to have
the "C# Evaluation API (Mono.CSharp.Evaluator)".
How does this compare to the ideas you mentioned?  If this is going to be in
the mono namespace, I'd assume this is not something supported by any MS
.NET runtimes...

Is there any way to pre-compile the IL code and include it in an XML file?

Ultimately I'd like to have my data be capable of including some scripts
that can be triggered after being loaded.

Thank you for your help!
-- 
View this message in context: http://www.nabble.com/Embedding-mono-C--in-a-file-format...-tp21258659p21280664.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list