Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BinFmt] Usage of BinaryFormatter in tests #9051

Closed
rokonec opened this issue Jul 19, 2023 · 1 comment
Closed

[BinFmt] Usage of BinaryFormatter in tests #9051

rokonec opened this issue Jul 19, 2023 · 1 comment
Labels

Comments

@rokonec
Copy link
Member

rokonec commented Jul 19, 2023

During migrating to new arcade using dotnet8 we have encounter few errors related to usage of deprecated BinaryFormatter,

It seems we are using BinFmt in some tests:

  • AssemblyNameEx_Tests - we probably do no longer need binaryformatting of AssemblyNameEx
  • /// <summary>
    /// Verify a whidbey project started event can be deserialized, the whidbey event is stored in a serialized base64 string.
    /// </summary>
    [Fact]
    public void TestDeserialization()
    {
    string base64OldProjectStarted = "AAEAAAD/////AQAAAAAAAAAMAgAAAFxNaWNyb3NvZnQuQnVpbGQuRnJhbWV3b3JrLCBWZXJzaW9uPTIuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49YjAzZjVmN2YxMWQ1MGEzYQUBAAAAMU1pY3Jvc29mdC5CdWlsZC5GcmFtZXdvcmsuUHJvamVjdFN0YXJ0ZWRFdmVudEFyZ3MHAAAAC3Byb2plY3RGaWxlC3RhcmdldE5hbWVzFkJ1aWxkRXZlbnRBcmdzK21lc3NhZ2UaQnVpbGRFdmVudEFyZ3MraGVscEtleXdvcmQZQnVpbGRFdmVudEFyZ3Mrc2VuZGVyTmFtZRhCdWlsZEV2ZW50QXJncyt0aW1lc3RhbXAXQnVpbGRFdmVudEFyZ3MrdGhyZWFkSWQBAQEBAQAADQgCAAAABgMAAAALcHJvamVjdEZpbGUGBAAAAAt0YXJnZXROYW1lcwYFAAAAB21lc3NhZ2UGBgAAAAtoZWxwS2V5d29yZAYHAAAAB01TQnVpbGQBl5vjTYvIiAsAAAAL";
    BinaryFormatter bf = new BinaryFormatter();
    MemoryStream ms = new MemoryStream();
    byte[] binaryObject = Convert.FromBase64String(base64OldProjectStarted);
    ms.Write(binaryObject, 0, binaryObject.Length);
    ms.Position = 0;
    ProjectStartedEventArgs pse = (ProjectStartedEventArgs)bf.Deserialize(ms);

    whidbey seems to be VS2005 - I don't think we need it anymore, if VS still uses it they shall fix it soon - we don't need test for it
  • public void SerializeDeserialize2()
    {
    LoggerException e = new LoggerException("message");
    using (MemoryStream memstr = new MemoryStream())
    {
    BinaryFormatter frm = new BinaryFormatter();
    frm.Serialize(memstr, e);

    I thing this has been addressed in recent Jan changes in SerializationContractInitializer and we do no longer need to BinFmt LoggerException and whole LoggerExceptionTests class can be deleted

NOTE: @JanKrivanek FYI

@JanKrivanek
Copy link
Member

Dupe of #8925

@JanKrivanek JanKrivanek closed this as not planned Won't fix, can't repro, duplicate, stale Jul 24, 2023
@AR-May AR-May added the triaged label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants