[IronPython] Application Domains and IronPython
fuzzyman at voidspace.org.uk
Tue Apr 17 00:11:46 CEST 2007
I'm trying to experiment with using AppDomains from IronPython - and not
getting very far.
I've created a simple assembly in C#, containing the following :
public class GoodbyeWorld
public void test()
This is saved as 'goodbye.dll' and I can use it fine from IronPython.
The initial code to create the AppDomain is as follows:
from System import AppDomain, AppDomainSetup, MarshalByRefObject
from System.Environment import CurrentDirectory
from System.IO import Path, Directory
from System.Reflection import Assembly
ads = AppDomainSetup()
ads.ApplicationBase = Directory.GetCurrentDirectory()
ads.DisallowBindingRedirects = False
ads.DisallowCodeDownload = True
appDomain = AppDomain.CreateDomain("newAppDomain", None, ads)
asmPath = Path.Combine(Directory.GetCurrentDirectory(), "goodbye.dll")
So far so good.
If I try *either* of the following lines to *use* the appdomain, then it
testClass = appDomain.CreateInstanceAndUnwrap(asmPath,
The error is:
Traceback (most recent call last):
File C:\Python Projects\modules in progress\ironpython\appDomain.py,
File , line 0, in Load##97
File mscorlib, line unknown, in Load
IOError: Could not load file or assembly 'C:\\Python Projects\\modules
ss\\ironpython\\goodbye.dll' or one of its dependencies. The given
or codebase was invalid. (Exception from HRESULT: 0x80131047)
I've also tried loading the assembly and using the assembly name, which
is obviously wrong because it then fails to find the assembly.
Anyone got any clues as to what I am doing wrong ?
All the best,
More information about the Ironpython-users