[BUG]: .Net Interactive: UDF use deprecated BinaryFormatter, fail in VS Code
See original GitHub issueDescribe the bug UDFs are serialized using BinaryFormatter, which is deprecated for security reasons.
In environments where BinaryFormatter
is already disabled, this causes UDFs to fail with a NotSupportedException
.
To Reproduce
Steps to reproduce the behavior:
- Use Visual Studio Code with the .Net Interactive Notebooks extension
- Follow the steps in UDFs in .NET Interactive
- Executing cell #3 (which contains the definition of the UDF) fails with:
Error: 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 Microsoft.Spark.Utils.CommandSerDe.Serialize(Delegate func, SerializedMode deserializerMode, SerializedMode serializerMode)
at Microsoft.Spark.Sql.Functions.CreateUdf(String name, Delegate execute, PythonEvalType evalType, String returnType)
at Microsoft.Spark.Sql.Functions.CreateUdf[TResult](String name, Delegate execute, PythonEvalType evalType)
at Microsoft.Spark.Sql.Functions.CreateUdf[TResult](String name, Delegate execute)
at Microsoft.Spark.Sql.Functions.Udf[T,TResult](Func`2 udf)
at Submission#11.<<Initialize>>d__0.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, StrongBox`1 exceptionHolderOpt, Func`2 catchExceptionOpt, CancellationToken cancellationToken)
Expected behavior
- Should be able to use UDFs
- The example in UDFs in .NET Interactive should work
- UDFs should not use
BinaryFormatter
Screenshots NA
Desktop (please complete the following information):
- OS: macOS 10.15.7
- .NET 5 (5.0.100)
- Apache Spark 3.0.1
- .NET for Apache Spark v1.0.0 (netcoreapp3.1, macOS)
- VS Code:
- Version: 1.53.0-insider
- Commit: 96b426ef1da0f0a51ce9ef1931cd1fd2322547e4
- Date: 2020-12-14T05:49:45.285Z
- Electron: 11.0.3
- Chrome: 87.0.4280.67
- Node.js: 12.18.3
- V8: 8.7.220.25-electron.0
- OS: Darwin x64 19.6.0
- .Net Interactive Notebooks v1.0.160901
Additional context NA
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
BinaryFormatter serialization methods are obsolete and ...
In .NET 7, the affected APIs are obsolete as error. For more information, see BinaryFormatter serialization APIs produce compiler errors.
Read more >vscode extension: deprecation warning `Buffer()`, how to ...
Here are the steps I used to help diagnose what is causing that Buffer deprecation warning. Uninstall your extension. You may have to...
Read more >C# Client Library Release Note | Download
This feature requires server version 6.3+. CLIENT-2124 Disable code that used Microsoft's deprecated BinaryFormatter. See Incompatible API change.
Read more >C# 6.0 Cookbook
Completely updated for C# 6.0, the new edition of this bestseller offers more than 150 code recipes to common and not-so-common problems.
Read more >ANSYS ACT Developer's Guide
When you are using the ACT automation API, automation methods and properties must be called in the. UI thread. Before 18.1, error messages...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks @oefe for reporting this. We will move away from
BinaryFormatter
from upcoming releases.@imback82 Is there a solution to this, now is 2023?