[Python.NET] System.InvalidProgramException: Invalid IL code

Count László de Almásy calmasy at gmail.com
Sat Jun 20 23:26:53 CEST 2009

Cheers, László
-------------- next part --------------


I'm attempting to use Python.NET on my Linux/Mono 2.4 system as a replacement for IronPython, which is not an easy system to use under Linux. e.g, the interactive interpreter doesn't understand Ctrl^D or Ctrl^C and has no command-line history, and I lose many of the standard Python modules I'm used to working with. Problem is, some code that works fine under IronPython is blowing up under Python.NET and I'm not able to figure out why. I'm hoping someone here could offer some insight into the following System.InvalidProgramException.


Traceback (most recent call last):
  File "./invite", line 24, in <module>
    groupmgr.Invite(GroupKey, roles, target)
System.InvalidProgramException: Invalid IL code in (wrapper runtime-invoke) OpenMetaverse.GroupManager:runtime_invoke_void__this___UUID_List`1<UUID>_UUID (object,intptr,intptr,intptr): IL_0031: call      0x00000006

  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] 


My Python code that produces this, looks like the following:

from OpenMetaverse import *
from System import *
from System.Collections.Generic import *

GroupKey = UUID("44652c3f-2b9b-b926-308e-387639434ab4")
target = UUID("ba36e228-1de0-460a-9219-c34c592e0ee1")
everyone = UUID("00000000-0000-0000-0000-000000000000")

roles = List[UUID]()

groupmgr = GroupManager(client)
groupmgr.Invite(GroupKey, roles, target)


seems to be the "groupmgr.Invite(GroupKey, roles, target)" line that is causing the System.InvalidProgramException. Any thoughts?

More information about the PythonDotNet mailing list