[dotnet-sdk-9.0.100-preview.6.24325.8] JexusManager get System.PlatformNotSupportedException: BinaryFormatter serialization and deserialization have been removed.
.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.24317.13: 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: System.PlatformNotSupportedException: BinaryFormatter serialization and deserialization have been removed. See https://aka.ms/binaryformatter for more information.
Application Name: JexusManager (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/2110659 Github Link: https://github.com/jexuswebserver/JexusManager
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 and Enable BinaryFormatter.
"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"
}
],
"configProperties": {
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": true
}
- Launching JexusManager.exe.
- Click “Yes” button if it exists.
- Click “OK” menu if it exists.
- Expand “IIS Express” item.
- Double click “Global” item.
- Double click “URL Rewrite” item.
- Click “Add Rule” button.
- Click Blank rule item.
- Click the Ok button.
Expected Result: Successfully jump to the interface.
Actual Result: Pop up error window.
Exception details (Exception comes from error window):
System.InvalidOperationException: menu item Add Rule(s)... function Add
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.PlatformNotSupportedException: BinaryFormatter serialization and deserialization have been removed. See https://aka.ms/binaryformatter for more information.
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
at System.Resources.ResourceReader.<>c__DisplayClass7_0`1.<CreateUntypedDelegate>b__0(Object obj, Stream stream)
at System.Resources.ResourceReader.DeserializeObject(Int32 typeIndex)
at System.Resources.ResourceReader._LoadObjectV2(Int32 pos, ResourceTypeCode& typeCode)
at System.Resources.ResourceReader.LoadObjectV2(Int32 pos, ResourceTypeCode& typeCode)
at System.Resources.ResourceReader.LoadObject(Int32 pos, ResourceTypeCode& typeCode)
at System.Resources.RuntimeResourceSet.ReadValue(ResourceReader reader, Int32 dataPos, Boolean isString, ResourceLocator& locator)
at System.Resources.RuntimeResourceSet.GetObject(String key, Boolean ignoreCase, Boolean isString)
at System.Resources.ResourceManager.GetObject(String name, CultureInfo culture, Boolean wrapUnmanagedMemStream)
at MakarovDev.ExpandCollapsePanel.Properties.Resources.get__1downarrow1()
at MakarovDev.ExpandCollapsePanel.ExpandCollapseButton.InitializeComponent()
at MakarovDev.ExpandCollapsePanel.ExpandCollapseButton..ctor()
at MakarovDev.ExpandCollapsePanel.ExpandCollapsePanel.InitializeComponent()
at MakarovDev.ExpandCollapsePanel.ExpandCollapsePanel..ctor()
at JexusManager.Features.Rewrite.Inbound.InboundRulePage.InitializeComponent() in C:\Source\JexusManager\JexusManager.Features.Rewrite\Inbound\InboundRulePage.Designer.cs:line 42
at JexusManager.Features.Rewrite.Inbound.InboundRulePage..ctor() in C:\Source\JexusManager\JexusManager.Features.Rewrite\Inbound\InboundRulePage.cs:line 90
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
--- End of inner exception stack trace ---
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
at Microsoft.Web.Management.Client.NavigationItem.get_Page() in C:\Source\JexusManager\Microsoft.Web.Management\Client\NavigationItem.cs:line 35
at JexusManager.Services.NavigationService.NavigateToItem(NavigationItem item, Boolean initializing) in C:\Source\JexusManager\JexusManager\Services\NavigationService.cs:line 65
at JexusManager.Services.NavigationService.Navigate(Connection connection, ManagementConfigurationPath configurationPath, Type pageType, Object navigationData) in C:\Source\JexusManager\JexusManager\Services\NavigationService.cs:line 30
at JexusManager.Features.Rewrite.RewriteFeature.Add() in C:\Source\JexusManager\JexusManager.Features.Rewrite\RewriteFeature.cs:line 305
at JexusManager.Features.Rewrite.RewriteFeature.FeatureTaskList.Add() in C:\Source\JexusManager\JexusManager.Features.Rewrite\RewriteFeature.cs:line 123
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
--- End of inner exception stack trace ---
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
at Microsoft.Web.Management.Client.TaskList.InvokeMethod(String methodName, Object userData) in C:\Source\JexusManager\Microsoft.Web.Management\Client\TaskList.cs:line 23
at JexusManager.Features.TaskItemExtensions.<>c__DisplayClass3_0.<TaskItemFill>b__0(Object o, EventArgs args) in C:\Source\JexusManager\JexusManager.Shared\Features\TaskItemExtensions.cs:line 90
--- End of inner exception stack trace ---
at JexusManager.Features.TaskItemExtensions.<>c__DisplayClass3_0.<TaskItemFill>b__0(Object o, EventArgs args) in C:\Source\JexusManager\JexusManager.Shared\Features\TaskItemExtensions.cs:line 101
at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)
Known Workarounds No.
Tried the following steps:
- Turn on the AppContext Switch like
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization> - Install the System.Runtime.Serialization.Formatters nuget package (Failed. Because it is not compatible with this .NET 7.0 App. The supported .NET version of System.Runtime.Serialization.Formatters nuget package is .NET 8)
@dotnet-actwx-bot @dotnet/compat
Related: #6267
Application needs to add <EnableUnsafeBinaryFormatterSerialization>True</EnableUnsafeBinaryFormatterSerialization>.
Update for the workaround: It works well with the public Nuget package for the application. Closing this issue. We will file an new issue to notify the app owner about this change.