[IronPython] XNA 4.0

Dino Viehland dinov at microsoft.com
Sat Dec 11 02:39:32 CET 2010


Mauricio  wrote:
> 
> Hi all.
> 
> I'm trying to run the XNA example posted here:
> http://www.ironpython.info/index.php/XNA_Example_-_Luminance
> 
> But i'm trying that with XNA and .NET 4.0 on IronPython 2.6.
> After changing some imports that seems to be different in XNA 4.0 version,
> the program gives me this error:
> 
> Traceback (most recent call last):
>   File "xna_test.py", line 33, in <module>
>   File "xna_test.py", line 13, in __init__
>   File "xna_test.py", line 17, in initializeComponent
> SystemError: The invoked member is not supported in a dynamic assembly.
> 
> The line 17 is this one:
> 
> self.graphics = GraphicsDeviceManager(self)

I would suggest compiling a small C# assembly which is just something
like:

	public class Maker {
		public static object MakeGraphicsDeviceManager() {
			return new GraphicsDeviceManager();
		}
	}

And then call this instead of calling GraphicsDeviceManager directly.  There's
occasionally a type which disallows being created via reflection/dynamic methods
(for whatever reason) and this is one work around.

Another possibility is that we're calling it via reflection because it hasn't
been called enough but it'll work if called via a dynamic method.  In that case you
can actually call it in a loop until we optimize the creation to a call from
a dynamic method.  I doubt this is the case this time though because of the 
error message is specifically calling out the dynamic assembly.






More information about the Ironpython-users mailing list