Service-fabric: [.NET 5] - NotSupportedException thrown with service remoting

Created on 19 Nov 2020  路  6Comments  路  Source: microsoft/service-fabric

Service Fabric Runtime Version: 7.1.458

Environment: Must be one of these values [Standalone OR Azure OR OneBox/Dev cluster]
Local one-box, one-machine cluster

Description:
I'm aware that .NET 5 support isn't showing up until 8.0 this next spring, but I only just realized that, so I wanted to file an issue about something I'd found that's related to that effort.

Specifically, doing absolutely nothing but changing the target framework across my projects from netcoreapp3.1 to net5.0 breaks empty returns in Service Fabric remoting operations.

Observed behavior:
There's no issue sending data via Service Fabric remoting to a service, deserializing and accessing it. However, in my experience thus far, regardless of whether the return value is of Task or actually returns an object, it consistently throws the following exception:

Failed to deserialize and get remote exception  System.NotSupportedException: BinaryFormatter serialization and deserialization are disabled within this application. See https://aka.ms/binaryformatter for more information.
   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
   at Microsoft.ServiceFabric.Services.Remoting.V2.RemoteException.TryDeserializeException(Stream data, Exception& result)

Expected Behavior:
I would expect this to work just as it does when targeting .Net Core 3.1 - no exception is thrown upon returning from a remoting method invocation.

OS(Windows/Linux):
Windows

If this is a regression, which version did it regress from?
Not a regression - regarding .NET 5.0 implementation


Assignees: /cc @microsoft/service-fabric-triage

area-Remoting backlog

Most helpful comment

This is due to BinarySerializerbeing disabled by default in .net 5 since its insecure, you can enable it again by setting <EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization> in your project files

we're moving to .net 5 in our solution and everything seems to work, i'd also (for like the 100th time) encourage the SF team to be more open about what issues there are but tbh, i'm not holding my breath

All 6 comments

On related note, I urge the SF team to share information more openly. In my opinion the whole point of the issues repository is to document the known issues, gather feedback and then potentially work with the community on solving them.

SF team has stated that there are known compatibility issues https://github.com/microsoft/service-fabric/pull/1070#issuecomment-721242640. Now the issues are covered in mystery and the customers are left wondering what is going on. The process is very opaque and discourages investment in the use of product.

This is due to BinarySerializerbeing disabled by default in .net 5 since its insecure, you can enable it again by setting <EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization> in your project files

we're moving to .net 5 in our solution and everything seems to work, i'd also (for like the 100th time) encourage the SF team to be more open about what issues there are but tbh, i'm not holding my breath

I'm curious if there are any plans to switch out to a different default serializer for SF remoting purposes.

@WhitWaldo, we have filed an internal workitem to track this but currently do not have an ETA.

@PavanKunapareddyMSFT 8.0 was released with .net 5 support GAed, no mention of the BinaryFormatter in the release notes (that I can see). Is this still required?

The EnableUnsafeBinaryFormatterSerialization config is still needed if you are using Service Fabric remoting. We are currently working on the fix. I will update this thread once the fix is made available.

Was this page helpful?
0 / 5 - 0 ratings