HI
I am trying to migrate some legacy code to use the .NETCore5. The code used the System.Serializable attribute a lot..but I failed to find the nuget package which contains this type definition...
any place i could find a clear mapping between the type to the nuget package containing this type?
thanks
Binary serialization isn't available in .NET Core so you don't need [Serializable] and can just remove it from your code. A good website for searching for APIs and which NuGet package they're contained in is https://packagesearch.azurewebsites.net
akoeplinger
thanks..so if binary serialization is not supported in .NET Core,any other recommendation to persist the object graph?
btw, just curiosity, the source code of this [Serializable] attribute actually is published in coreclr repo, any reason why it is not available in client code? :)
so if binary serialization is not supported in .NET Core,any other recommendation to persist the object graph?
JSON via JSON.NET or XML via XmlSerializer would be two popular options.
btw, just curiosity, the source code of this [Serializable] attribute actually is published in coreclr repo, any reason why it is not available in client code?
AFAIK, the mscorlib code in this repo is used for both Desktop .NET and .NET Core, but the latter is built with only a reduced subset of APIs.
Hi @qx-will, I am from Serialization team. As @akoeplinger pointed out, SerializableAttribute is not supported on .NET Core, neither the binary serializer.
There are 3 built-in serializers on .NET Core: DataContractSerializer, DataContractJsonSerializer and XmlSerializer. You can also choose 3rd party serializers such as JSON.NET.
@zhenlan any thoughts of why SerializableAttribute and the binary serializer, are not supported on .NET Core?
@abnerdasdores The SerializableAttribute was mostly used by binary serialization for cross AppDomain communication on full .NET Framework. The concept of AppDomain does not exist in .NET Core. This is the main reason SerializableAttribute/binary serializer is not supported on .NET Core.
@zhenlan, now I got a problem with migrating .netfx4.x projects to .netcore, now there're tons of errors occured in [System.SerializableAttribute()] in class generated by xsd.exe. you here suggested to replace it to XmlSerializer, but I cannot see any counterpart. Could you advise?
@zhenlan is NewtonSoft faster than DataContractSerializer/DataContractJsonSerializer as of .Net Core?
Binary serialization is now available in .NET Core - in upcoming 2.0
https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/dogfooding.md has instruction on how to try .NET Core 2.0 if you would like to give it a try.
Most helpful comment
Binary serialization is now available in .NET Core - in upcoming 2.0