[Python.NET] Support for CLR4 .NET Remoting

pythondotnet PythonDotNet at jnpcarole.com
Thu Oct 20 13:38:28 EDT 2016

Does pythonnet-2.1.0 support .NET Remoting? When I try to get an interface, python 2.7 crashes:
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at Python.Runtime.ClassDerivedObject.ToPython(IPythonDerivedType obj)
   at Python.Runtime.Converter.ToPython(Object value, Type type)
   at Python.Runtime.MethodBinder.Invoke(IntPtr inst, IntPtr args, IntPtr kw, MethodBase info, MethodInfo[] methodinfo)
   at Python.Runtime.MethodObject.Invoke(IntPtr target, IntPtr args, IntPtr kw,MethodBase info)
   at Python.Runtime.MethodBinding.tp_call(IntPtr ob, IntPtr args, IntPtr kw)
It's getting past these lines in my script:
   import clr
   clr.Addreference(my remoting DLL)
   from MyNamespace import *
and choking on a static method in my app's remoting DLL call which returns the interface. Through logging, I can tell that the code in that static method call is successfully executing:
   (IMyInterface)Activator.GetObject(typeof(IMyInterface), url);
and returning the object back to Python.
This worked fine before when my app targeted .NET 3.5 and I used the CLR2 version of the Python for .NET package. Now  my app targets .NET 4.5.2 so I:
- Updated to Python 2.7.12
- Updated the copy of my app's remoting DLL in c:\python27\dll
- Removed the old Python for .NET package
- Executed "pip install pythonnet", which gave me version 2.1.0.
In C:\Python27\Lib\site-packages\ I see:
Python.Runtime.dll v
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20161020/433148c7/attachment.html>

More information about the PythonDotNet mailing list