Open merriemcgaw opened 2 years ago
whats the replacement for BinaryFormatter in clipboard/drag'n'drop data exchange? anything been announced yet?
[edit] found it myself, #6269, sorry for the noise, will follow that issue as it evolves.
At this stage we don't have any formed plans or announcements. Binary formatters are used in multiple scenarios - e.g. the clipboard and resources. We are fully aware this deprecation will likely have far reaching impact, and we need to plan accordingly.
@JeremyKuhne Is there anything you think should be included in this epic that I haven't already added?
@JeremyKuhne some of these things may go away entirely with your new PRs. I want to capture your work here for Preview 5 and break out a .NET 9 follow up set of items to track separately.
why is this only Prio 2 if BinaryFormatter gets removed in .NET9? I think this should be critical issue for .net 9 milestone @merriemcgaw
@MagicAndre1981 It was pri 2 for the .NET 8 release 😄 , thanks for pointing that out - I'll adjust now!
After build our apps with .Net8 we see such warnings for autogenerated typed datasets (actually typed DataTables):
DS.Designer.cs: warning SYSLIB0051: 'DataSet.DataSet(SerializationInfo, StreamingContext, bool)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)
DS.Designer.cs: warning SYSLIB0051: 'TypedTableBase
.TypedTableBase(SerializationInfo, StreamingContext)' is obsolete: 'This API supports obsolete formatter-based serialization. It should not be called or extended by application code.' (https://aka.ms/dotnet-warnings/SYSLIB0051)
What will happen with all of this in .Net9? We have some of these legacy typed datasets generated by designer 😳 Also time to time we use designer to edit generated datasets.
/cc @merriemcgaw @JeremyKuhne
@KlausLoeffelmann this is something we'll want to investigate.
@kirsan31 at worst, you'll have to reference a new NuGet package to get this to work. We're working on making sure embedded resources just work (as they're considered trusted). I'm not sure what the BinaryFormatter
workflow is for data sets, but we'll look to make sure we're fully clear how it might be impacted.
Yes, this is definitely something we need to test intensively.
What is the current state now that BinaryFormatter was removed from runtime and moved to System.Runtime.Serialization.Formatters nuget?
Do you use this nuget now for Winforms if you can't removed BF until deadline for .net9? What impact will this have to WinForm Devs? Do we also need to enable it in the csproj of the winforms project?
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
Marking as 10 for remaining work.
@JeremyKuhne and what happens in .NET9? Will the nuget be referenced automatically when UseWinForms
is set in csproj?
@MagicAndre1981 the package will not be referenced automatically. Anything that could be moved away from the BinaryFormatter has been. Remaining (.NET 10) work is to improve diagnostics for guidance when you're potentially hitting BinaryFormatter paths and adding of new API to reduce risk when you're using the BinaryFormatter with custom types on the clipboard and with drag/drop.
More detailed guidance documents are being finalized and will be posted soon. @lonitra
Official BinaryFormatter removal announcement: https://github.com/dotnet/runtime/issues/98245
BinaryFormatter is an inherently unsafe serliazer. WinForms used it quite a bit in early versions and now we should remove as much of this as possible.
This is part of the dotnet/planning/issues/27 theme
Related:
6269
4649