1
votes

Is it possible to do some CLR hosting from a managed application?

As the hosting API is exposed through COM the plumbing should be possible.

Moreover, from the 4.0 version of the runtime, it's possible to host more than one CLR in the same process.

But I'm not sure about bootstrapping a CLR from another CLR; if possible in a way as simple as the bootstrapping from native C++, without using any unmanaged code.

Any pointer is welcome, thanks.

1
Have you checked if app domains could help achieve the same goal as you try to achieve with CLR hosting? - dtb
may I ask you why do you need this? What is the problem you are trying to solve? - VladL
Is something like this what you're looking for? - ispiro
@dtb: this is purely educational. :) - Pragmateek
@VladL: same remark. :) - Pragmateek

1 Answers

3
votes

Limited hosting support is provided for managed code via System.AppDomainManager class. This way, you can customize some CLR behavior, such as AppDomainCreation or Security, using only C# code.

Jeffrey Richter briefly talks about this in his book CLR via C#. http://my.safaribooksonline.com/book/programming/csharp/9780735639959/clr-hosting-and-appdomains/advanced_host_control

Check the msdn page for AppDomainManager http://msdn.microsoft.com/en-us/library/system.appdomainmanager(v=vs.110).aspx

Some other links with useful info: http://blogs.msdn.com/b/shawnfa/archive/2004/11/12/256550.aspx http://blogs.msdn.com/b/shawnfa/archive/2004/11/17/259105.aspx