.Net 4.0 Hosting (again)

As I mentioned a while back the CLR Hosting API has changed with .Net 4.0. The new API allows you much more flexibility in loading CLR runtimes and also allows you to load and run multiple different runtimes in a single process. Whilst this is useful if you need to control which runtime runs your code and indispensable if you need to host code that really requires different versions of the runtime and can’t all run in the “latest” runtime, I think the times when a user of my CLRHosting libraries will actually need this functionality will be few and far between. Anyway, I’ve added some initial support for hosting multiple instances of the CLR and I will be building a new example server over the next few days.

I’ve found the new hosting API to be a bit of a let down really. Whilst the extra level of indirection that the ‘meta host’ gives you is essential for loading multiple different runtimes the actual runtime hosting hasn’t really improved much over what we had in .Net 2.0. There’s still no way to cleanly shutdown a runtime once you’ve loaded it (which is a shame and a pain but I can’t see it ever changing).