[Ironpython-users] Loading python compiled with clr.CompileModule

Josiah Kiehl jkiehl at riotgames.com
Tue Apr 3 17:15:02 EDT 2018

I'm trying to execute this example code:

I realize the posted question is a few years old at this point... has
something changed in how python, compiled to a DLL via clr.CompileModule,
is loaded?

I'm getting this error when I run the code in the example at the above link:
Unhandled Exception: System.TypeLoadException: Could not load type
'System.Runtime.CompilerServices.Closure' from assembly 'System.Core,
Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
   at DLRCachedCode.test$1(CodeContext $globalContext, FunctionCode
   at IronPython.Compiler.OnDiskScriptCode.Run()

(full stack:

My ipy.exe, which did the compilation, is and my embedded
IronPython is, though I get the same error on

Am I missing something obvious or is there a better example to use?

My end goal is to be able to take a python module defined in a file
(foo.py) with some functions defined, compile it into a dll via
CompileModule, then load it directly from the dll via ImportModule to skip
the performance hit of interpreting the Python at runtime.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20180403/3657b808/attachment.html>

More information about the Ironpython-users mailing list