diff options
author | Atsushi Kanamori <atsushik@microsoft.com> | 2017-01-18 20:50:44 +0300 |
---|---|---|
committer | Atsushi Kanamori <atsushik@microsoft.com> | 2017-01-18 20:50:44 +0300 |
commit | fcddeabd49c36406b561101ae25c23c48a6aa5cd (patch) | |
tree | 1720355fa16e3ba1116a423c9c268ee596c3a739 | |
parent | 812448796dce9f0372afecd2d8d4b4d5d1e66e79 (diff) |
Adding ISerializable to System.Delegate/System.MulticastDelegate
Doing this now because the lack of it is forcing us to
spam apicompat baselines with exemptions for every
delegate type in the framework.
System.Delegate.GetObjectData() just throws
NotSupportedException so that's easy to implement now.
System.MulticastDelegate.GetObjectData() is more
complicated and probably needs MethodInfo
serialization to work first. So this is a stub.
-rw-r--r-- | src/System.Private.CoreLib/src/System/Delegate.cs | 8 | ||||
-rw-r--r-- | src/System.Private.CoreLib/src/System/MulticastDelegate.cs | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/System.Private.CoreLib/src/System/Delegate.cs b/src/System.Private.CoreLib/src/System/Delegate.cs index 399fd783b..7fa5553cf 100644 --- a/src/System.Private.CoreLib/src/System/Delegate.cs +++ b/src/System.Private.CoreLib/src/System/Delegate.cs @@ -5,6 +5,7 @@ using System.Text; using System.Runtime; using System.Reflection; +using System.Runtime.Serialization; using System.Runtime.InteropServices; using System.Runtime.CompilerServices; using System.Diagnostics; @@ -19,7 +20,7 @@ namespace System // sequential layout directive so that Bartok matches it. [StructLayout(LayoutKind.Sequential)] [DebuggerDisplay("Target method(s) = {GetTargetMethodsDescriptionForDebugger()}")] - public abstract partial class Delegate : ICloneable + public abstract partial class Delegate : ICloneable, ISerializable { // This ctor exists solely to prevent C# from generating a protected .ctor that violates the surface area. I really want this to be a // "protected-and-internal" rather than "internal" but C# has no keyword for the former. @@ -707,6 +708,11 @@ namespace System return MemberwiseClone(); } + public virtual void GetObjectData(SerializationInfo info, StreamingContext context) + { + throw new NotSupportedException(); + } + internal bool IsOpenStatic { get diff --git a/src/System.Private.CoreLib/src/System/MulticastDelegate.cs b/src/System.Private.CoreLib/src/System/MulticastDelegate.cs index 7caec691c..55b550239 100644 --- a/src/System.Private.CoreLib/src/System/MulticastDelegate.cs +++ b/src/System.Private.CoreLib/src/System/MulticastDelegate.cs @@ -3,13 +3,14 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; +using System.Runtime.Serialization; using System.Runtime.CompilerServices; using Internal.Runtime.CompilerServices; namespace System { - public abstract class MulticastDelegate : Delegate + public abstract class MulticastDelegate : Delegate, ISerializable { // This ctor exists solely to prevent C# from generating a protected .ctor that violates the surface area. I really want this to be a // "protected-and-internal" rather than "internal" but C# has no keyword for the former. @@ -114,5 +115,10 @@ namespace System { return base.GetInvocationList(); } + + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { + throw new NotImplementedException(); + } } } |