Open
Description
Describe the bug
UDF serialization in .NET interactive does not allow defining custom classes objects used in UDFs in different cells as compared to where the UDF is defined. This fails with the following error:
System.Runtime.Serialization.SerializationException: Type 'Submission#7' in Assembly 'ℛ*af5b28d4-e906-43c5-ae89-767507bdda8a#1-7, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
This is because during UDF serialization, it picks up the submission cell(Submission#7
) as the target, and expects it to be marked as serializable, which it is not since it is a compiler-generated class.
To Reproduce
Steps to reproduce the behavior:
- Start .NET interactive session (through Jupyter lab for example)
- Import the Microsoft.Spark and Microsoft.Spark.Extensions.DotNet.Interactive nuget packages
- Run
DotnetRunner
in debug mode in a terminal - Declare a custom class and instantiate its object in a cell, mark it as serializable
- Define a UDF in a separate cell, calling the previously defined custom object, and run that cell to see the error