scs icon indicating copy to clipboard operation
scs copied to clipboard

.NET8 Support - The BinaryFormatter type is dangerous and is not recommended for data processing.

Open downmuss opened this issue 1 year ago • 1 comments

Hello, do you have any plan to update this TCP Connector to .NET8

im trying to "Fix" this issue on .NET8 but can't complete, i try with Protobuf to Serialize and Deserialize messages.

Type is not expected, and no contract can be inferred: Scs.Framework.Communication.ScsServices.Communication.Messages.ScsRemoteInvokeMessage

downmuss avatar Jul 16 '24 17:07 downmuss

To "Add" support for .NET8 this is a Trick

Add into your .csproj and Scs.dll .csproj this line

<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>

This is my ScsNet8.csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
	<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
	<AssemblyName>Scs</AssemblyName>
	<RootNamespace>Hik</RootNamespace>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="protobuf-net" Version="3.2.30" />
  </ItemGroup>

</Project>

downmuss avatar Jul 16 '24 17:07 downmuss