You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run Monkey365 using .NET 8, several exceptions are raised. The error message is:
[Copy-psObject] - System.Management.Automation.MethodInvocationException: Exception calling "Serialize" with "2" argument(s): "BinaryFormatter serialization and deserialization are disabled within this application. See https://aka.ms/binaryformatter for more information."
Previous behavior In .NET 7, the BinaryFormatter.Serialize(Stream, Object) and BinaryFormatter.Deserialize(Stream) methods were marked obsolete and raised an error at compile time. However, if your application suppressed the obsoletion, it could still call the methods and they functioned properly in most project types (excluding ASP.NET, WASM, and MAUI). For example, the APIs functioned correctly in a console app.
New behavior Starting in .NET 8, the affected methods throw a NotSupportedException at run time across all project types except Windows Forms and WPF. The APIs continue to remain obsolete (as error) across all project types, including Windows Forms and WPF.
How to reproduce it
Make sure your instance of Powershell is using the .NET 8 runtime:
then import and invoke the module in the usual way. The exceptions will be logged.
Expected behavior
No exceptions
Screenshots or Logs
[14:52:21:537] - [Copy-psObject] - System.Management.Automation.MethodInvocationException: Exception calling "Serialize" with "2" argument(s): "BinaryFormatter serialization and deserialization are disabled within this application. See https://aka.ms/binaryformatter for more information."
---> System.NotSupportedException: BinaryFormatter serialization and deserialization are disabled within this application. See https://aka.ms/binaryformatter for more information.
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)
at CallSite.Target(Closure, CallSite, Object, Object, Object)
--- End of inner exception stack trace ---
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame). LineNumber: - exception - debian12 -
dom34
changed the title
[Bug]: .NET version 8 causes BinaryFormatter.Serialize etc. to
[Bug]: BinaryFormatter,Serialize in Copy-psObject causes exception to be thrown when running under .NET 8
Nov 24, 2023
dom34
changed the title
[Bug]: BinaryFormatter,Serialize in Copy-psObject causes exception to be thrown when running under .NET 8
[Bug]: BinaryFormatter.Serialize in Copy-psObject causes exception to be thrown when running under .NET 8
Nov 24, 2023
What happened?
When I run Monkey365 using .NET 8, several exceptions are raised. The error message is:
This is a breaking change in .NET 8
https://learn.microsoft.com/en-us/dotnet/core/compatibility/serialization/8.0/binaryformatter-disabled
How to reproduce it
Make sure your instance of Powershell is using the .NET 8 runtime:
then import and invoke the module in the usual way. The exceptions will be logged.
Expected behavior
No exceptions
Screenshots or Logs
From where are you running Monkey365?
Please, complete the following information:
Additional context
I am using the PowerShell snap for Linux - the full package has not been fully tested on Debian 12
The text was updated successfully, but these errors were encountered: