[IronPython] Remoting broken in 2.0?
dinov at microsoft.com
Thu Jan 22 00:27:33 CET 2009
This is related to 470 but is slightly different. But in both cases the CLR is lying to us and telling us your object does implement the interface but it really doesn't (or I'm assuming that's the case, maybe whatever you're doing Activator.CreateInstance does implement the interface). But now we're blowing up before the interface cast on the remote side because Expression trees aren't serializable (whereas before we were blowing up on the other side of the remote call because the remote object doesn't actually implement the interface).
The workaround at the bottom of that bug should work for you. You can create a local "typed proxy" object which goes through the type object to get members instead of the instance. That should avoid the interface check and you should be able to talk to the remote object. For convenience here's the typed proxy object:
__slots__ = ['obj', 'proxyType']
def __init__(self, obj, proxyType):
self.obj = obj
self.proxyType = proxyType
def __getattribute__(self, attr):
proxyType = object.__getattribute__(self, 'proxyType')
obj = object.__getattribute__(self, 'obj')
return getattr(proxyType, attr).__get__(obj, proxyType)
test = typedproxy(System.Activator.GetObject(RemoteTest, 'http://localhost:8000/RemoteTest'), RemoteTest)
If that doesn't work let us know.
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Marc Saegesser
Sent: Wednesday, January 21, 2009 2:40 PM
Subject: [IronPython] Remoting broken in 2.0?
I've been using 2.0b3 for quite some time with good results. I just
tried to move to the final 2.0 release and ran into a fatal problem.
I use .Net Remoting and when I try to create a proxy to a well known
object using System.Activator.GetObject() I get the following error:
SystemError: Type 'Microsoft.Linq.Expressions.ParameterExpression' in
Assembly 'Microsoft.Scripting.Core, Version=0.9.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' is not marked as serializable.
The only change was going from 2.0b3 to 2.0.
I think this is the same problem reported in item 470
in June of 2006.
Any ideas on how to get around the problem?
Users mailing list
Users at lists.ironpython.com
More information about the Ironpython-users