I updated my project to Net5 and now I get an exception because the BinaryFormatter has been marked insecure and throws and exception https://docs.microsoft.com/nl-nl/dotnet/standard/serialization/binaryformatter-security-guide