From 314842bef5c944d44890f86cd6854e9e5df87f6d Mon Sep 17 00:00:00 2001 From: Sebastien Pouliot Date: Thu, 5 May 2011 19:23:52 -0400 Subject: [PATCH] Enable some code to be included in Moonlight's S.X.S.dll SDK assembly * System.Collections/ArrayList.cs: * System.Collections/Hashtable.cs: Do not include debugger-related attributes and some interfaces when compiled outside corlib * System.Runtime.Serialization/ObjectIDGenerator.cs: Ensure this can be compiled outside corlib (needed for ML S.X.S.dll where even internals cannot be used) --- mcs/class/corlib/System.Collections/ArrayList.cs | 11 ++++------- mcs/class/corlib/System.Collections/Hashtable.cs | 16 +++++++++------- .../System.Runtime.Serialization/ObjectIDGenerator.cs | 4 ++++ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/mcs/class/corlib/System.Collections/ArrayList.cs b/mcs/class/corlib/System.Collections/ArrayList.cs index bafb76aaf91..edffa3a4de5 100644 --- a/mcs/class/corlib/System.Collections/ArrayList.cs +++ b/mcs/class/corlib/System.Collections/ArrayList.cs @@ -30,18 +30,15 @@ using System.Diagnostics; namespace System.Collections { + [Serializable] +#if INSIDE_CORLIB [ComVisible(true)] [DebuggerDisplay ("Count={Count}")] [DebuggerTypeProxy (typeof (CollectionDebuggerView))] - [Serializable] -#if INSIDE_CORLIB - public + public class ArrayList : IList, ICloneable, ICollection, IEnumerable { #else - internal + internal class ArrayList : IList { #endif - class ArrayList - : IList, ICloneable, ICollection, IEnumerable - { #region Enumerator private sealed class ArrayListEnumerator diff --git a/mcs/class/corlib/System.Collections/Hashtable.cs b/mcs/class/corlib/System.Collections/Hashtable.cs index fe922cfea17..9e297fef6d1 100644 --- a/mcs/class/corlib/System.Collections/Hashtable.cs +++ b/mcs/class/corlib/System.Collections/Hashtable.cs @@ -38,18 +38,16 @@ using System.Diagnostics; namespace System.Collections { + [Serializable] +#if INSIDE_CORLIB [ComVisible(true)] [DebuggerDisplay ("Count={Count}")] [DebuggerTypeProxy (typeof (CollectionDebuggerView))] - [Serializable] -#if INSIDE_CORLIB - public + public class Hashtable : IDictionary, ICollection, + IEnumerable, ICloneable, ISerializable, IDeserializationCallback { #else - internal + internal class Hashtable : IDictionary, ICollection, IEnumerable { #endif - class Hashtable : IDictionary, ICollection, - IEnumerable, ICloneable, ISerializable, IDeserializationCallback - { [Serializable] internal struct Slot { @@ -963,8 +961,10 @@ namespace System.Collections { } [Serializable] +#if INSIDE_CORLIB [DebuggerDisplay ("Count={Count}")] [DebuggerTypeProxy (typeof (CollectionDebuggerView))] +#endif private class HashKeys : ICollection, IEnumerable { private Hashtable host; @@ -1017,8 +1017,10 @@ namespace System.Collections { } [Serializable] +#if INSIDE_CORLIB [DebuggerDisplay ("Count={Count}")] [DebuggerTypeProxy (typeof (CollectionDebuggerView))] +#endif private class HashValues : ICollection, IEnumerable { private Hashtable host; diff --git a/mcs/class/corlib/System.Runtime.Serialization/ObjectIDGenerator.cs b/mcs/class/corlib/System.Runtime.Serialization/ObjectIDGenerator.cs index 6e4f00ccfb3..79b259f6678 100644 --- a/mcs/class/corlib/System.Runtime.Serialization/ObjectIDGenerator.cs +++ b/mcs/class/corlib/System.Runtime.Serialization/ObjectIDGenerator.cs @@ -61,7 +61,11 @@ namespace System.Runtime.Serialization int IHashCodeProvider.GetHashCode (object o) { +#if !INSIDE_CORLIB && MOONLIGHT + return o == null ? 0 : o .GetHashCode (); +#else return object.InternalGetHashCode (o); +#endif } } -- 2.11.4.GIT