[IronPython] System.Reflection.Assembly finding python modules but no classes..

Matt Williams matt at geneity.co.uk
Fri Jul 27 17:15:18 CEST 2007


I'm working on an IronPython project in Visual Studio.  I'm attempting 
to use some 3rd party code that's written using Microsoft Application 
Blocks.

This code is attempting to instantiate my IronPython classes dynamically 
from Microsoft.ApplicationBlocks.UIProcess.GenericFactory.

It would appear that the factory is making calls to load the IronPython 
assembly, then using reflection to load/instantiate and return the 
specified class.

This is causing a problem.  It would appear that the IronPython assembly 
does not have any knowledge of classes contained in the python modules.

I've narrowed the code down to the following:

The project is building an assembly called 'UIPython', and it contains a 
python module 'Form1' which itself contains a python class called 'Form1'

This code throws an exception:

System.Reflection.Assembly.Load("UIPython,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null" 
)
typeInstance = assemblyInstance.GetType('Form1.Form1', True, False)
--

"Could not load type 'Form1.Form1' from assembly 'UIPython, 
Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'."
--

However, attempting to load the module appears to be fine:

System.Reflection.Assembly.Load("UIPython,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null" 
)
typeInstance = assemblyInstance.GetType('Form1', True, False)
--

Interrogating the types in the assembly (assemblyInstance.GetTypes()) 
returns the modules, but none of the classes that are defined.

I'd be very grateful for any suggestions..


Regards,

Matt




More information about the Ironpython-users mailing list