Skip to content

Commit

Permalink
switch
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsitnik committed May 17, 2024
1 parent 39dd889 commit 00608e4
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.ComponentModel;
using System.IO;
using System.Resources.Extensions.BinaryFormat;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;

Expand All @@ -12,11 +13,6 @@ public partial class DeserializingResourceReader
{
private bool _assumeBinaryFormatter;

// Issue https://github.com/dotnet/runtime/issues/39292 tracks finding an alternative to BinaryFormatter
#pragma warning disable SYSLIB0011
private BinaryFormatter? _formatter;
#pragma warning restore SYSLIB0011

private bool ValidateReaderType(string readerType)
{
// our format?
Expand All @@ -41,12 +37,13 @@ private bool ValidateReaderType(string readerType)
#pragma warning disable SYSLIB0011
private object ReadBinaryFormattedObject()
{
_formatter ??= new BinaryFormatter()
{
Binder = new UndoTruncatedTypeNameSerializationBinder()
};
BinaryFormattedObject binaryFormattedObject = new BinaryFormattedObject(_store.BaseStream,
new BinaryFormattedObject.Options()
{
Binder = new UndoTruncatedTypeNameSerializationBinder()
});

return _formatter.Deserialize(_store.BaseStream);
return binaryFormattedObject.Deserialize();
}
#pragma warning restore SYSLIB0011

Expand Down

0 comments on commit 00608e4

Please sign in to comment.