[BUG]: UDF Serialization bug in .Net interactive
- Dominant language
- C#
- Stars
- 2.1k
- Forks
- 332
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 9
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:
1. Start .NET interactive session (through Jupyter lab for example)
2. Import the Microsoft.Spark and Microsoft.Spark.Extensions.DotNet.Interactive nuget packages
3. Run `DotnetRunner` in debug mode in a terminal
4. Declare a custom class and instantiate its object in a cell, mark it as serializable
5. Define a UDF in a separate cell, calling the previously defined custom object, and run that cell to see the error
Contributor guide
Assessment
This issue has not been assessed yet.