From ebb258e867fdd9a6c55b10692fefa5c2847fc177 Mon Sep 17 00:00:00 2001 From: Lucas Meijer Date: Sat, 12 Mar 2011 00:30:41 +0100 Subject: [PATCH] Implmement a private BinaryFormatter.DefaultSurrogateSelector, which enables embedders who want to make a sandbox, to specify a default surrogate selector, which is required to get System.Serialization be able to operate within a CoreCLR environment. --- .../BinaryFormatter.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs index 57f770516d2c..bb42a36a69ba 100644 --- a/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs +++ b/mcs/class/corlib/System.Runtime.Serialization.Formatters.Binary/BinaryFormatter.cs @@ -48,7 +48,7 @@ public sealed class BinaryFormatter : IRemotingFormatter, IFormatter public BinaryFormatter() { - surrogate_selector=null; + surrogate_selector=DefaultSurrogateSelector; context=new StreamingContext(StreamingContextStates.All); } @@ -57,7 +57,9 @@ public BinaryFormatter(ISurrogateSelector selector, StreamingContext context) surrogate_selector=selector; this.context=context; } - + + static ISurrogateSelector DefaultSurrogateSelector { get; set; } + public FormatterAssemblyStyle AssemblyFormat { get {