tylerjensen / ServiceWire

ServiceWire is a very fast and light weight service host and dynamic client library that simplifies the development and use of high performance remote procedure call (RPC) communication between .NET processes over Named Pipes or TCP/IP.
183 stars 40 forks source link

Calls to the proxy in a WinUI application using NamedPipe client & BinaryFormatterSerializer fail. #74

Closed berk-csi closed 1 year ago

berk-csi commented 1 year ago

I am trying to use ServiceWire (NamedPipe & BinaryFormatterSerializer) with a WinUI based desktop application targeting .NET 6. I can successfully start the service, but any calls to the proxy made from the WinUI app is failing in SyncInterface method:

image

Calls to the proxy work if I don't use BinaryFormatterSerializer, or if I change the application to use WinForms rather than WinUI as the UI framework.

Attached reproducer solution has the latest ServiceWire projects along with two clients: one WinUI based and the other WinForms based. They share the code referencing ServiceWire (based on the published named pipes example) via a shared C# project. When using the default serializer, both applications can use ServiceWire without any errors. When using BinaryFormatterSerializer, only the WinForms application works.

Any help with resolving this issue is deeply appreciated!

Berk

ServiceWire.WinUI.zip

tylerje commented 1 year ago

The binary formatter between versions of .NET and operating systems is not guaranteed to be compatible. The WinUI formatter is likely different in some way that cannot be resolved. I recommend abandoning the binary formatter.