[IronPython] Creating Dynamic Assemblies from IronPython 2.6

Dino Viehland dinov at microsoft.com
Sat Mar 21 01:50:44 CET 2009


It's actually a CLR bug - we can't call this method from a dynamic method.  We could probably add a workaround and force it to always be called via reflection.

From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Curt Hagenlocher
Sent: Friday, March 20, 2009 5:29 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Creating Dynamic Assemblies from IronPython 2.6

I think this is something that broke well before the 2.0 release.  To work around it in pyc.py, we added DefineDynamicAssembly to the PythonOps class in IronPython:

import clr
clr.AddReference('IronPython')
from IronPython.Runtime.Operations import PythonOps
assemblyBuilder = PythonOps.DefineDynamicAssembly(...)
2009/3/20 Jeff Hardy <jdhardy at gmail.com<mailto:jdhardy at gmail.com>>
Hi all,
I'm unable to create a Dynamic assembly from IronPython using
AppDomain.DefineDynamicAssembly. The Python file attached results in
the following error:

Traceback (most recent call last):
 File "pinvoke.py", line 5, in pinvoke.py
 File "mscorlib", line unknown, in DefineDynamicAssembly
 File "mscorlib", line unknown, in InternalDefineDynamicAssembly
 File "mscorlib", line unknown, in nCreateDynamicAssembly
 File "mscorlib", line unknown, in CheckGrantSetHelper
SystemError: Object reference not set to an instance of an object.

The equivalent C# program (also attached) works fine. I'm guessing
there's something special about IronPython's AppDomain, but I'm not
sure what it is. This is using revision 48140. Any ideas?

- Jeff

_______________________________________________
Users mailing list
Users at lists.ironpython.com<mailto:Users at lists.ironpython.com>
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20090320/6a991a69/attachment.html>


More information about the Ironpython-users mailing list