question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG]: .Net Interactive: UDF use deprecated BinaryFormatter, fail in VS Code

See original GitHub issue

Describe 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:

  1. Use Visual Studio Code with the .Net Interactive Notebooks extension
  2. Follow the steps in UDFs in .NET Interactive
  3. 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

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:open
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
imback82commented, Dec 15, 2020

Thanks @oefe for reporting this. We will move away from BinaryFormatter from upcoming releases.

0reactions
GeorgeS2019commented, Feb 14, 2023

We will move away from BinaryFormatter from upcoming releases.

@imback82 Is there a solution to this, now is 2023?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found