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

[dotnet-sdk-9.0.100-preview.6.24325.8] mRemote launch failed with an exception : PlatformNotSupportedException: BinaryFormatter serialization and deserialization have been removed." #11599

Open
Junjun-zhao opened this issue Jun 27, 2024 · 2 comments
Labels
area-Serialization-BinaryFormatter untriaged The team needs to look at this issue in the next triage

Comments

@Junjun-zhao
Copy link
Member

Junjun-zhao commented Jun 27, 2024

.NET version

Dotnet Info:

.NET SDK:
 Version:           9.0.100-preview.6.24325.8
 Commit:            89054b0c37
 Workload version:  9.0.100-manifests.29b7987d
 MSBuild version:   17.11.0-preview-24318-05+4a45d5633

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19045
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\9.0.100-preview.6.24325.8\

.NET workloads installed:
Configured to use loose manifests when installing new manifests.
There are no installed workloads to display.

Host:
  Version:      9.0.0-preview.6.24321.8
  Architecture: x64
  Commit:       static

.NET SDKs installed:
  9.0.100-preview.6.24325.8 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 9.0.0-preview.6.24324.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 9.0.0-preview.6.24321.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 9.0.0-preview.6.24322.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Did it work in .NET Framework?

Not tested/verified

Did it work in any of the earlier releases of .NET Core or .NET 5+?

Yes
Verify Scenarios:
1). Windows 10 21H2 AMD64 + dotnet-sdk-9.0.100-preview.6.24314.10: Pass
2). Windows 10 21H2 AMD64 + dotnet-sdk-9.0.100-preview.6.24325.8: Fail
3). Windows 10 21H2 AMD64 + dotnet-sdk-9.0.100-preview.7.24321.3: Fail

Issue description

When run the 3rd party application with the latest .NET 9 build "dotnet-sdk-9.0.100-preview.6.24325.8", it failed to launch with error:
"The type initializer for 'BrightIdeasSoftware.ObjectListView' threw an exception."
After debugging the source code, we found this exception is caused by "PlatformNotSupportedException: BinaryFormatter serialization and deserialization have been removed.".

Application Name: mRemoteNG(WinForms)
OS: Windows 10 21H2
CPU: X64
.NET Build Number: dotnet-sdk-9.0.100-preview.6.24325.8
App & Source checking at: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/2100188
Github Link: https://github.com/mRemoteNG/mRemoteNG

Steps to reproduce

  1. Change the runtime.config file to let the app run against with dotnet-sdk-9.0.100-preview.6.24325.8.
 "frameworks": [
      {
        "name": "Microsoft.NETCore.App",
        "version": "9.0.0-preview.6.24321.8"
      },
      {
        "name": "Microsoft.WindowsDesktop.App",
        "version": "9.0.0-preview.6.24322.3"
      }
    ],
  1. Turn on EnableUnsafeBinaryFormatterSerialization switch in runtime.config file:
"configProperties": {
      "System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
      "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": true
    }
  1. Launch mRemoteNG.exe.

Expected Result:
Launch successfully.

Actual Result:
Launch failed with error:
image
mRemotingNG_BugReproSteps

The type initializer for 'BrightIdeasSoftware.ObjectListView' threw an exception.
StackTrace:
at BrightIdeasSoftware.ObjectListView.get_IsVistaOrLater()
   at BrightIdeasSoftware.VirtualObjectListView.get_ShowGroups()
   at BrightIdeasSoftware.VirtualObjectListView.BuildList(Boolean shouldPreserveSelection)
   at BrightIdeasSoftware.VirtualObjectListView.set_VirtualListDataSource(IVirtualListDataSource value)
   at BrightIdeasSoftware.VirtualObjectListView..ctor()
   at BrightIdeasSoftware.TreeListView..ctor()
   at mRemoteNG.UI.Controls.ConnectionTree.ConnectionTree..ctor() in C:\Source\mRemoteNG\mRemoteNG\UI\Controls\ConnectionTree\ConnectionTree.cs:line 69
   at mRemoteNG.UI.Window.ConnectionTreeWindow.InitializeComponent() in C:\Source\mRemoteNG\mRemoteNG\UI\Window\ConnectionTreeWindow.Designer.cs:line 24
   at mRemoteNG.UI.Window.ConnectionTreeWindow..ctor(DockContent panel) in C:\Source\mRemoteNG\mRemoteNG\UI\Window\ConnectionTreeWindow.cs:line 45
   at mRemoteNG.UI.Window.ConnectionTreeWindow..ctor() in C:\Source\mRemoteNG\mRemoteNG\UI\Window\ConnectionTreeWindow.cs:line 36
   at mRemoteNG.App.Windows.get_TreeForm() in C:\Source\mRemoteNG\mRemoteNG\App\Windows.cs:line 23
   at mRemoteNG.UI.Forms.FrmMain.SetMenuDependencies() in C:\Source\mRemoteNG\mRemoteNG\UI\Forms\frmMain.cs:line 289
   at mRemoteNG.UI.Forms.FrmMain.FrmMain_Load(Object sender, EventArgs e) in C:\Source\mRemoteNG\mRemoteNG\UI\Forms\frmMain.cs:line 171
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Control.CreateControl(Boolean ignoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at mRemoteNG.UI.Forms.FrmMain.WndProc(Message& m) in C:\Source\mRemoteNG\mRemoteNG\UI\Forms\frmMain.cs:line 598
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)

Inner Exception when debugging code:

PlatformNotSupportedException: BinaryFormatter serialization and deserialization have been removed. See https://aka.ms/binaryformatter for more information.

Known Workarounds
No.
Tried the following steps:

  1. Turn on the AppContext Switch like <EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
  2. Install the System.Runtime.Serialization.Formatters nuget package (Failed. Because it is not compatible with this .NET 6.0 App. The supported .NET version of System.Runtime.Serialization.Formatters nuget package is .NET 8)

@dotnet-actwx-bot @dotnet/compat

@Junjun-zhao Junjun-zhao added the untriaged The team needs to look at this issue in the next triage label Jun 27, 2024
@elachlan
Copy link
Contributor

Related: #6267

@elachlan
Copy link
Contributor

Application needs to add <EnableUnsafeBinaryFormatterSerialization>True</EnableUnsafeBinaryFormatterSerialization> and/or BrightIdeasSoftware.ObjectListView will need to be updated to use a different form of serialization or add a typeconverter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Serialization-BinaryFormatter untriaged The team needs to look at this issue in the next triage
Projects
None yet
Development

No branches or pull requests

2 participants