jexuswebserver / JexusManager

Jexus Manager http://jexusmanager.com
MIT License
264 stars 59 forks source link

[dotnet-sdk-9.0.100-preview.6.24325.8] JexusManager get System.PlatformNotSupportedException: BinaryFormatter serialization and deserialization have been removed. #162

Closed Junjun-zhao closed 3 months ago

Junjun-zhao commented 4 months ago

We are doing Application compatibility testing with this application against the latest .NET 9. When run this 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.

After dev investigation, it is related to Epic- Update BinaryFormatter usage that Removing BinaryFormatter from .NET 9. This is the Official BinaryFormatter removal announcement for your reference.

Please refer to more information from https://github.com/dotnet/winforms/issues/11598 if needed.

===================== Application Name: JexusManager (WinForms) OS: Windows 10 21H2 CPU: X64 .NET Build Number: dotnet-sdk-9.0.100-preview.6.24325.8 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
    }
  1. Launching JexusManager.exe.
  2. Click “Yes” button if it exists.
  3. Click “OK” menu if it exists.
  4. Expand “IIS Express” item.
  5. Double click “Global” item.
  6. Double click “URL Rewrite” item.
  7. Click “Add Rule” button.
  8. Click Blank rule item.
  9. Click the Ok button.
  10. Expected Result:
  11. 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)
lextm commented 3 months ago

As .NET 9 doesn't at this moment give clear benefits for this project, this item won't be worked on yet.