Runtime: which nuget package I should add in my json file to use System.Serializable attribute?

Created on 3 Jul 2015  路  10Comments  路  Source: dotnet/runtime

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

documentation question

Most helpful comment

Binary serialization is now available in .NET Core - in upcoming 2.0

All 10 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bencz picture bencz  路  3Comments

v0l picture v0l  路  3Comments

jzabroski picture jzabroski  路  3Comments

iCodeWebApps picture iCodeWebApps  路  3Comments

yahorsi picture yahorsi  路  3Comments