DotNet package doesn't work in latest and release 4.15
Closed this issue · 2 comments
Tested out with the following steps:
(1) Server. Python. Used python 3.4 and installed pyro4 using pip
def main():
daemon = Pyro4.Daemon() # make a Pyro daemon
uri = daemon.register(CenterController)
print("Ready. Object uri =", uri) # print the uri so we can use it in the client later
daemon.requestLoop()
if name == 'main':
main()
(2) Client. C#. The URI string is coming from the the print out of the python based server
public class TestURI
{
public static void Run()
{
string uri = "PYRO:obj_0de46bb35aa84b729b796b9937cfe6fe@localhost:59773";
PyroURI pyURI = new PyroURI(uri);
using (PyroProxy p = new PyroProxy(pyURI))
{
dynamic result = p.call("getDst");
System.Console.WriteLine(result.toString());
}
}
}
Exception:
unhandled exception: System.InvalidCastException: Unable to cast object of type
'System.Collections.Generic.Dictionary`2[System.Object,System.Object]' to type '
System.Collections.Hashtable'.
at Razorvine.Pyro.PyroProxy._handshake() in E:\projects\PyroLite\Pyrolite-pyr
olite-4.15\dotnet\Pyrolite\Pyro\PyroProxy.cs:line 385
at Razorvine.Pyro.PyroProxy.connect() in E:\projects\PyroLite\Pyrolite-pyroli
te-4.15\dotnet\Pyrolite\Pyro\PyroProxy.cs:line 83
at Razorvine.Pyro.PyroProxy.internal_call(String method, String actual_object
Id, UInt16 flags, Boolean checkMethodName, Object[] parameters) in E:\projects\P
yroLite\Pyrolite-pyrolite-4.15\dotnet\Pyrolite\Pyro\PyroProxy.cs:line 236
at Razorvine.Pyro.PyroProxy.call(String method, Object[] arguments) in E:\pro
jects\PyroLite\Pyrolite-pyrolite-4.15\dotnet\Pyrolite\Pyro\PyroProxy.cs:line 184
at Pyrolite.TestPyroEcho.TestURI.Run() in E:\projects\PyroLite\Pyrolite-pyrol
ite-4.15\dotnet\Pyrolite.TestPyroEcho\TestURI.cs:line 23
at Pyrolite.TestPyroEcho.Program.Main(String[] args) in E:\projects\PyroLite
Pyrolite-pyrolite-4.15\dotnet\Pyrolite.TestPyroEcho\Program.cs:line 29
Fix:
PyroProxy.cs
//var response_dict = (Hashtable)handshake_response;
var response_dict = (System.Collections.Generic.Dictionary<Object, Object>)handshake_response;
//_processMetadata(response_dict["meta"] as Hashtable);
_processMetadata(response_dict["meta"] as System.Collections.Generic.Dictionary<Object, Object>);
Conclusion
The return result of functions are now returned as Dictionary type and dictionary table is no more directly castable to hash table...
Thanks for reporting this, I failed testing the previous release properly it seems. Will fix soon.
Note that the issue is only in the .NET library, the Java library works fine.
version 4.16 has been released and published to nuget.org