diff options
author | Jan Kotas <jkotas@microsoft.com> | 2017-06-15 04:47:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-15 04:47:52 +0300 |
commit | 2861da59da6ff383e4620e932c2c861d468ca52b (patch) | |
tree | b71423ef3666866af5dc60133ae6545bab4f26cb | |
parent | e040c8ea6c31ff38228e9865cabaab0e39d2869d (diff) | |
parent | 83bcbe002c760b0fbff3999c6cb2c864ff430fe4 (diff) |
Merge pull request #3888 from dotnet-bot/from-tfs
Merge changes from TFS
42 files changed, 633 insertions, 14 deletions
diff --git a/src/System.Private.CoreLib/shared/System/StringComparer.cs b/src/System.Private.CoreLib/shared/System/StringComparer.cs index 4b6193c18..334ac11ba 100644 --- a/src/System.Private.CoreLib/shared/System/StringComparer.cs +++ b/src/System.Private.CoreLib/shared/System/StringComparer.cs @@ -172,7 +172,7 @@ namespace System [Serializable] [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - internal sealed class CultureAwareComparer : StringComparer + public sealed class CultureAwareComparer : StringComparer { private readonly CompareInfo _compareInfo; // Do not rename (binary serialization) private readonly bool _ignoreCase; // Do not rename (binary serialization) @@ -228,7 +228,7 @@ namespace System [Serializable] [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - internal sealed class OrdinalComparer : StringComparer + public sealed class OrdinalComparer : StringComparer { public override int Compare(string x, string y) => string.CompareOrdinal(x, y); @@ -254,7 +254,7 @@ namespace System [Serializable] [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] - internal sealed class OrdinalIgnoreCaseComparer : StringComparer + public sealed class OrdinalIgnoreCaseComparer : StringComparer { public override int Compare(string x, string y) => string.Compare(x, y, StringComparison.OrdinalIgnoreCase); diff --git a/src/System.Private.CoreLib/src/Internal/IntrinsicSupport/ComparerHelpers.cs b/src/System.Private.CoreLib/src/Internal/IntrinsicSupport/ComparerHelpers.cs index 89b821c3d..b17c98f56 100644 --- a/src/System.Private.CoreLib/src/Internal/IntrinsicSupport/ComparerHelpers.cs +++ b/src/System.Private.CoreLib/src/Internal/IntrinsicSupport/ComparerHelpers.cs @@ -156,7 +156,8 @@ namespace System.Collections.Generic // Because these are serializable, they must not be renamed //----------------------------------------------------------------------- [Serializable] - internal sealed class GenericComparer<T> : Comparer<T> where T : IComparable<T> + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public sealed class GenericComparer<T> : Comparer<T> where T : IComparable<T> { public sealed override int Compare(T x, T y) { @@ -181,7 +182,8 @@ namespace System.Collections.Generic } [Serializable] - internal sealed class NullableComparer<T> : Comparer<Nullable<T>> where T : struct, IComparable<T> + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public sealed class NullableComparer<T> : Comparer<Nullable<T>> where T : struct, IComparable<T> { public sealed override int Compare(Nullable<T> x, Nullable<T> y) { @@ -206,7 +208,8 @@ namespace System.Collections.Generic } [Serializable] - internal sealed class ObjectComparer<T> : Comparer<T> + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public sealed class ObjectComparer<T> : Comparer<T> { public sealed override int Compare(T x, T y) { diff --git a/src/System.Private.CoreLib/src/Internal/IntrinsicSupport/EqualityComparerHelpers.cs b/src/System.Private.CoreLib/src/Internal/IntrinsicSupport/EqualityComparerHelpers.cs index 025d9afce..496a3c7e0 100644 --- a/src/System.Private.CoreLib/src/Internal/IntrinsicSupport/EqualityComparerHelpers.cs +++ b/src/System.Private.CoreLib/src/Internal/IntrinsicSupport/EqualityComparerHelpers.cs @@ -180,7 +180,7 @@ namespace System.Collections.Generic // The methods in this class look identical to the inherited methods, but the calls // to Equal bind to IEquatable<T>.Equals(T) instead of Object.Equals(Object) [Serializable] - internal sealed class GenericEqualityComparer<T> : EqualityComparer<T> where T : IEquatable<T> + public sealed class GenericEqualityComparer<T> : EqualityComparer<T> where T : IEquatable<T> { public sealed override bool Equals(T x, T y) { @@ -212,7 +212,8 @@ namespace System.Collections.Generic } [Serializable] - internal sealed class NullableEqualityComparer<T> : EqualityComparer<Nullable<T>> where T : struct, IEquatable<T> + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public sealed class NullableEqualityComparer<T> : EqualityComparer<Nullable<T>> where T : struct, IEquatable<T> { public sealed override bool Equals(Nullable<T> x, Nullable<T> y) { @@ -242,7 +243,8 @@ namespace System.Collections.Generic } [Serializable] - public sealed class EnumEqualityComparer<T> : EqualityComparer<T>, ISerializable where T : struct + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public class EnumEqualityComparer<T> : EqualityComparer<T>, ISerializable where T : struct { public sealed override bool Equals(T x, T y) { @@ -268,13 +270,14 @@ namespace System.Collections.Generic } // Equals method for the comparer itself. - public sealed override bool Equals(Object obj) => obj is EnumEqualityComparer<T>; + public override bool Equals(Object obj) => obj is EnumEqualityComparer<T>; - public sealed override int GetHashCode() => typeof(EnumEqualityComparer<T>).GetHashCode(); + public override int GetHashCode() => typeof(EnumEqualityComparer<T>).GetHashCode(); } [Serializable] - internal sealed class ObjectEqualityComparer<T> : EqualityComparer<T> + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public sealed class ObjectEqualityComparer<T> : EqualityComparer<T> { public sealed override bool Equals(T x, T y) { diff --git a/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj b/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj index 330c5adb9..7204d536d 100644 --- a/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj +++ b/src/System.Private.CoreLib/src/System.Private.CoreLib.csproj @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="utf-8"?> +<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" /> <PropertyGroup> @@ -189,6 +189,7 @@ <Compile Include="System\Collections\Concurrent\LowLevelConcurrentQueue.cs" /> <Compile Include="System\Collections\Generic\ArraySortHelper.cs" /> <Compile Include="System\Collections\Generic\Comparer.cs" /> + <Compile Include="System\Collections\Generic\CompatibilityEqualityComparers.cs" /> <Compile Include="System\Collections\Generic\DebugView.cs" /> <Compile Include="System\Collections\Generic\EqualityComparer.cs" /> <Compile Include="System\Collections\Generic\EqualOnlyComparer.cs" /> @@ -197,6 +198,7 @@ <Compile Include="System\Collections\Generic\Dictionary.cs" /> <Compile Include="System\Collections\Generic\IDictionaryDebugView.cs" /> <Compile Include="System\Collections\Generic\NonRandomizedStringEqualityComparer.cs" /> + <Compile Include="System\Collections\ListDictionaryInternal.cs" /> <Compile Include="System\Collections\LowLevelListDictionary.cs" /> <Compile Include="System\Collections\LowLevelComparer.cs" /> <Compile Include="System\Collections\ObjectEqualityComparer.cs" /> diff --git a/src/System.Private.CoreLib/src/System/AggregateException.cs b/src/System.Private.CoreLib/src/System/AggregateException.cs index dac92a308..91cad4a38 100644 --- a/src/System.Private.CoreLib/src/System/AggregateException.cs +++ b/src/System.Private.CoreLib/src/System/AggregateException.cs @@ -28,6 +28,7 @@ namespace System /// </remarks> [Serializable] [DebuggerDisplay("Count = {InnerExceptionCount}")] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class AggregateException : Exception { private ReadOnlyCollection<Exception> _innerExceptions; // Complete set of exceptions. diff --git a/src/System.Private.CoreLib/src/System/Array.cs b/src/System.Private.CoreLib/src/System/Array.cs index 0d8f0f349..7f579cd2e 100644 --- a/src/System.Private.CoreLib/src/System/Array.cs +++ b/src/System.Private.CoreLib/src/System/Array.cs @@ -15,6 +15,7 @@ using System.Diagnostics.Contracts; namespace System { [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public abstract partial class Array : ICollection, IEnumerable, IList, IStructuralComparable, IStructuralEquatable, ICloneable { public static Array CreateInstance(Type elementType, params long[] lengths) diff --git a/src/System.Private.CoreLib/src/System/ArraySegment.cs b/src/System.Private.CoreLib/src/System/ArraySegment.cs index 6805e8e77..19b7e78ca 100644 --- a/src/System.Private.CoreLib/src/System/ArraySegment.cs +++ b/src/System.Private.CoreLib/src/System/ArraySegment.cs @@ -26,6 +26,7 @@ namespace System // three fields from an ArraySegment may not see the same ArraySegment from one call to another // (ie, users could assign a new value to the old location). [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public struct ArraySegment<T> : IList<T>, IReadOnlyList<T> { // Do not replace the array allocation with Array.Empty. We don't want to have the overhead of diff --git a/src/System.Private.CoreLib/src/System/Attribute.cs b/src/System.Private.CoreLib/src/System/Attribute.cs index 01f9e85a4..5f20722e2 100644 --- a/src/System.Private.CoreLib/src/System/Attribute.cs +++ b/src/System.Private.CoreLib/src/System/Attribute.cs @@ -8,6 +8,7 @@ namespace System { [AttributeUsageAttribute(AttributeTargets.All, Inherited = true, AllowMultiple = false)] [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public abstract partial class Attribute { protected Attribute() { } diff --git a/src/System.Private.CoreLib/src/System/Boolean.cs b/src/System.Private.CoreLib/src/System/Boolean.cs index efd7b53bb..cf2b3f29c 100644 --- a/src/System.Private.CoreLib/src/System/Boolean.cs +++ b/src/System.Private.CoreLib/src/System/Boolean.cs @@ -21,6 +21,7 @@ namespace System // The Boolean class provides the // object representation of the boolean primitive type. [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public struct Boolean : IComparable, IComparable<Boolean>, IEquatable<Boolean>, IConvertible { // diff --git a/src/System.Private.CoreLib/src/System/Byte.cs b/src/System.Private.CoreLib/src/System/Byte.cs index 6cc1bd7f0..eec948fd0 100644 --- a/src/System.Private.CoreLib/src/System/Byte.cs +++ b/src/System.Private.CoreLib/src/System/Byte.cs @@ -24,6 +24,7 @@ namespace System // [System.Runtime.InteropServices.StructLayout(LayoutKind.Sequential)] [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public struct Byte : IComparable, IFormattable, IComparable<Byte>, IEquatable<Byte>, IConvertible { private byte m_value; // Do not rename (binary serialization) diff --git a/src/System.Private.CoreLib/src/System/Collections/Generic/Comparer.cs b/src/System.Private.CoreLib/src/System/Collections/Generic/Comparer.cs index a90a264a8..69fa86693 100644 --- a/src/System.Private.CoreLib/src/System/Collections/Generic/Comparer.cs +++ b/src/System.Private.CoreLib/src/System/Collections/Generic/Comparer.cs @@ -9,6 +9,7 @@ using System.Diagnostics.Contracts; namespace System.Collections.Generic { [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public abstract class Comparer<T> : IComparer, IComparer<T> { protected Comparer() diff --git a/src/System.Private.CoreLib/src/System/Collections/Generic/CompatibilityEqualityComparers.cs b/src/System.Private.CoreLib/src/System/Collections/Generic/CompatibilityEqualityComparers.cs new file mode 100644 index 000000000..33aef24b9 --- /dev/null +++ b/src/System.Private.CoreLib/src/System/Collections/Generic/CompatibilityEqualityComparers.cs @@ -0,0 +1,52 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Runtime.Serialization; + +namespace System.Collections.Generic +{ + // Comparers that exist for serialization compatibility with .NET Framework + + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public sealed class ByteEqualityComparer : EqualityComparer<byte> + { + public override bool Equals(byte x, byte y) + { + return x == y; + } + + public override int GetHashCode(byte obj) + { + return obj.GetHashCode(); + } + + // Equals method for the comparer itself. + public override bool Equals(Object obj) => obj != null && GetType() == obj.GetType(); + + public override int GetHashCode() => GetType().GetHashCode(); + } + + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public sealed class SByteEnumEqualityComparer<T> : EnumEqualityComparer<T> where T : struct + { + private SByteEnumEqualityComparer(SerializationInfo information, StreamingContext context) { } + } + + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public sealed class ShortEnumEqualityComparer<T> : EnumEqualityComparer<T> where T : struct + { + private ShortEnumEqualityComparer(SerializationInfo information, StreamingContext context) { } + } + + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public sealed class LongEnumEqualityComparer<T> : EnumEqualityComparer<T> where T : struct + { + private LongEnumEqualityComparer(SerializationInfo information, StreamingContext context) { } + } +} diff --git a/src/System.Private.CoreLib/src/System/Collections/Generic/Dictionary.cs b/src/System.Private.CoreLib/src/System/Collections/Generic/Dictionary.cs index 35c42264d..fd6a246fe 100644 --- a/src/System.Private.CoreLib/src/System/Collections/Generic/Dictionary.cs +++ b/src/System.Private.CoreLib/src/System/Collections/Generic/Dictionary.cs @@ -36,6 +36,7 @@ namespace System.Collections.Generic [DebuggerTypeProxy(typeof(IDictionaryDebugView<,>))] [DebuggerDisplay("Count = {Count}")] [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class Dictionary<TKey, TValue> : IDictionary<TKey, TValue>, IDictionary, IReadOnlyDictionary<TKey, TValue>, ISerializable, IDeserializationCallback { private struct Entry diff --git a/src/System.Private.CoreLib/src/System/Collections/Generic/EqualityComparer.cs b/src/System.Private.CoreLib/src/System/Collections/Generic/EqualityComparer.cs index 45fcd2a9d..354720931 100644 --- a/src/System.Private.CoreLib/src/System/Collections/Generic/EqualityComparer.cs +++ b/src/System.Private.CoreLib/src/System/Collections/Generic/EqualityComparer.cs @@ -9,6 +9,7 @@ using System.Collections; namespace System.Collections.Generic { [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public abstract class EqualityComparer<T> : IEqualityComparer, IEqualityComparer<T> { protected EqualityComparer() diff --git a/src/System.Private.CoreLib/src/System/Collections/Generic/List.cs b/src/System.Private.CoreLib/src/System/Collections/Generic/List.cs index 191aa2a28..d1448b759 100644 --- a/src/System.Private.CoreLib/src/System/Collections/Generic/List.cs +++ b/src/System.Private.CoreLib/src/System/Collections/Generic/List.cs @@ -20,6 +20,7 @@ namespace System.Collections.Generic [DebuggerTypeProxy(typeof(ICollectionDebugView<>))] [DebuggerDisplay("Count = {Count}")] [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class List<T> : IList<T>, System.Collections.IList, IReadOnlyList<T> { private const int _defaultCapacity = 4; diff --git a/src/System.Private.CoreLib/src/System/Collections/Generic/NonRandomizedStringEqualityComparer.cs b/src/System.Private.CoreLib/src/System/Collections/Generic/NonRandomizedStringEqualityComparer.cs index 996f7e2a1..a1f3e38bd 100644 --- a/src/System.Private.CoreLib/src/System/Collections/Generic/NonRandomizedStringEqualityComparer.cs +++ b/src/System.Private.CoreLib/src/System/Collections/Generic/NonRandomizedStringEqualityComparer.cs @@ -11,7 +11,8 @@ namespace System.Collections.Generic // keep the performance not affected till we hit collision threshold and then we switch to the comparer which is using // randomized string hashing. [Serializable] - internal sealed class NonRandomizedStringEqualityComparer : EqualityComparer<string> + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public sealed class NonRandomizedStringEqualityComparer : EqualityComparer<string> { private static volatile IEqualityComparer<string> s_nonRandomizedComparer; diff --git a/src/System.Private.CoreLib/src/System/Collections/ListDictionaryInternal.cs b/src/System.Private.CoreLib/src/System/Collections/ListDictionaryInternal.cs new file mode 100644 index 000000000..8ba4bbea7 --- /dev/null +++ b/src/System.Private.CoreLib/src/System/Collections/ListDictionaryInternal.cs @@ -0,0 +1,516 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. +/*============================================================ +** +** +** +** +** +** Purpose: List for exceptions. +** +** +===========================================================*/ + +using System.Diagnostics.Contracts; + +namespace System.Collections +{ + /// This is a simple implementation of IDictionary using a singly linked list. This + /// will be smaller and faster than a Hashtable if the number of elements is 10 or less. + /// This should not be used if performance is important for large numbers of elements. + [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] + public class ListDictionaryInternal : IDictionary + { + private DictionaryNode head; // Do not rename (binary serialization) + private int version; // Do not rename (binary serialization) + private int count; // Do not rename (binary serialization) + [NonSerialized] + private Object _syncRoot; + + public ListDictionaryInternal() + { + } + + public Object this[Object key] + { + get + { + if (key == null) + { + throw new ArgumentNullException(nameof(key), SR.ArgumentNull_Key); + } + Contract.EndContractBlock(); + DictionaryNode node = head; + + while (node != null) + { + if (node.key.Equals(key)) + { + return node.value; + } + node = node.next; + } + return null; + } + set + { + if (key == null) + { + throw new ArgumentNullException(nameof(key), SR.ArgumentNull_Key); + } + Contract.EndContractBlock(); + + + version++; + DictionaryNode last = null; + DictionaryNode node; + for (node = head; node != null; node = node.next) + { + if (node.key.Equals(key)) + { + break; + } + last = node; + } + if (node != null) + { + // Found it + node.value = value; + return; + } + // Not found, so add a new one + DictionaryNode newNode = new DictionaryNode(); + newNode.key = key; + newNode.value = value; + if (last != null) + { + last.next = newNode; + } + else + { + head = newNode; + } + count++; + } + } + + public int Count + { + get + { + return count; + } + } + + public ICollection Keys + { + get + { + return new NodeKeyValueCollection(this, true); + } + } + + public bool IsReadOnly + { + get + { + return false; + } + } + + public bool IsFixedSize + { + get + { + return false; + } + } + + public bool IsSynchronized + { + get + { + return false; + } + } + + public Object SyncRoot + { + get + { + if (_syncRoot == null) + { + System.Threading.Interlocked.CompareExchange<Object>(ref _syncRoot, new Object(), null); + } + return _syncRoot; + } + } + + public ICollection Values + { + get + { + return new NodeKeyValueCollection(this, false); + } + } + + public void Add(Object key, Object value) + { + if (key == null) + { + throw new ArgumentNullException(nameof(key), SR.ArgumentNull_Key); + } + Contract.EndContractBlock(); + + + version++; + DictionaryNode last = null; + DictionaryNode node; + for (node = head; node != null; node = node.next) + { + if (node.key.Equals(key)) + { + throw new ArgumentException(SR.Format(SR.Argument_AddingDuplicate__, node.key, key)); + } + last = node; + } + if (node != null) + { + // Found it + node.value = value; + return; + } + // Not found, so add a new one + DictionaryNode newNode = new DictionaryNode(); + newNode.key = key; + newNode.value = value; + if (last != null) + { + last.next = newNode; + } + else + { + head = newNode; + } + count++; + } + + public void Clear() + { + count = 0; + head = null; + version++; + } + + public bool Contains(Object key) + { + if (key == null) + { + throw new ArgumentNullException(nameof(key), SR.ArgumentNull_Key); + } + Contract.EndContractBlock(); + for (DictionaryNode node = head; node != null; node = node.next) + { + if (node.key.Equals(key)) + { + return true; + } + } + return false; + } + + public void CopyTo(Array array, int index) + { + if (array == null) + throw new ArgumentNullException(nameof(array)); + + if (array.Rank != 1) + throw new ArgumentException(SR.Arg_RankMultiDimNotSupported); + + if (index < 0) + throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_NeedNonNegNum); + + if (array.Length - index < this.Count) + throw new ArgumentException(SR.ArgumentOutOfRange_Index, nameof(index)); + Contract.EndContractBlock(); + + for (DictionaryNode node = head; node != null; node = node.next) + { + array.SetValue(new DictionaryEntry(node.key, node.value), index); + index++; + } + } + + public IDictionaryEnumerator GetEnumerator() + { + return new NodeEnumerator(this); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return new NodeEnumerator(this); + } + + public void Remove(Object key) + { + if (key == null) + { + throw new ArgumentNullException(nameof(key), SR.ArgumentNull_Key); + } + Contract.EndContractBlock(); + version++; + DictionaryNode last = null; + DictionaryNode node; + for (node = head; node != null; node = node.next) + { + if (node.key.Equals(key)) + { + break; + } + last = node; + } + if (node == null) + { + return; + } + if (node == head) + { + head = node.next; + } + else + { + last.next = node.next; + } + count--; + } + + private class NodeEnumerator : IDictionaryEnumerator + { + private ListDictionaryInternal list; + private DictionaryNode current; + private int version; + private bool start; + + + public NodeEnumerator(ListDictionaryInternal list) + { + this.list = list; + version = list.version; + start = true; + current = null; + } + + public Object Current + { + get + { + return Entry; + } + } + + public DictionaryEntry Entry + { + get + { + if (current == null) + { + throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen); + } + return new DictionaryEntry(current.key, current.value); + } + } + + public Object Key + { + get + { + if (current == null) + { + throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen); + } + return current.key; + } + } + + public Object Value + { + get + { + if (current == null) + { + throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen); + } + return current.value; + } + } + + public bool MoveNext() + { + if (version != list.version) + { + throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion); + } + if (start) + { + current = list.head; + start = false; + } + else + { + if (current != null) + { + current = current.next; + } + } + return (current != null); + } + + public void Reset() + { + if (version != list.version) + { + throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion); + } + start = true; + current = null; + } + } + + + private class NodeKeyValueCollection : ICollection + { + private ListDictionaryInternal list; + private bool isKeys; + + public NodeKeyValueCollection(ListDictionaryInternal list, bool isKeys) + { + this.list = list; + this.isKeys = isKeys; + } + + void ICollection.CopyTo(Array array, int index) + { + if (array == null) + throw new ArgumentNullException(nameof(array)); + if (array.Rank != 1) + throw new ArgumentException(SR.Arg_RankMultiDimNotSupported); + if (index < 0) + throw new ArgumentOutOfRangeException(nameof(index), SR.ArgumentOutOfRange_NeedNonNegNum); + Contract.EndContractBlock(); + if (array.Length - index < list.Count) + throw new ArgumentException(SR.ArgumentOutOfRange_Index, nameof(index)); + for (DictionaryNode node = list.head; node != null; node = node.next) + { + array.SetValue(isKeys ? node.key : node.value, index); + index++; + } + } + + int ICollection.Count + { + get + { + int count = 0; + for (DictionaryNode node = list.head; node != null; node = node.next) + { + count++; + } + return count; + } + } + + bool ICollection.IsSynchronized + { + get + { + return false; + } + } + + Object ICollection.SyncRoot + { + get + { + return list.SyncRoot; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return new NodeKeyValueEnumerator(list, isKeys); + } + + + private class NodeKeyValueEnumerator : IEnumerator + { + private ListDictionaryInternal list; + private DictionaryNode current; + private int version; + private bool isKeys; + private bool start; + + public NodeKeyValueEnumerator(ListDictionaryInternal list, bool isKeys) + { + this.list = list; + this.isKeys = isKeys; + version = list.version; + start = true; + current = null; + } + + public Object Current + { + get + { + if (current == null) + { + throw new InvalidOperationException(SR.InvalidOperation_EnumOpCantHappen); + } + return isKeys ? current.key : current.value; + } + } + + public bool MoveNext() + { + if (version != list.version) + { + throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion); + } + if (start) + { + current = list.head; + start = false; + } + else + { + if (current != null) + { + current = current.next; + } + } + return (current != null); + } + + public void Reset() + { + if (version != list.version) + { + throw new InvalidOperationException(SR.InvalidOperation_EnumFailedVersion); + } + start = true; + current = null; + } + } + } + + [Serializable] + private class DictionaryNode + { + public Object key; + public Object value; + public DictionaryNode next; + } + } +} diff --git a/src/System.Private.CoreLib/src/System/Collections/ObjectModel/Collection.cs b/src/System.Private.CoreLib/src/System/Collections/ObjectModel/Collection.cs index c3ad1adcf..ffaf2d2da 100644 --- a/src/System.Private.CoreLib/src/System/Collections/ObjectModel/Collection.cs +++ b/src/System.Private.CoreLib/src/System/Collections/ObjectModel/Collection.cs @@ -15,6 +15,7 @@ namespace System.Collections.ObjectModel [DebuggerTypeProxy(typeof(Mscorlib_CollectionDebugView<>))] [DebuggerDisplay("Count = {Count}")] [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class Collection<T> : IList<T>, IList, IReadOnlyList<T> { private IList<T> items; // Do not rename (binary serialization) diff --git a/src/System.Private.CoreLib/src/System/Collections/ObjectModel/ReadOnlyCollection.cs b/src/System.Private.CoreLib/src/System/Collections/ObjectModel/ReadOnlyCollection.cs index 80d2bba74..17384b940 100644 --- a/src/System.Private.CoreLib/src/System/Collections/ObjectModel/ReadOnlyCollection.cs +++ b/src/System.Private.CoreLib/src/System/Collections/ObjectModel/ReadOnlyCollection.cs @@ -13,6 +13,7 @@ namespace System.Collections.ObjectModel [DebuggerTypeProxy(typeof(Mscorlib_CollectionDebugView<>))] [DebuggerDisplay("Count = {Count}")] [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class ReadOnlyCollection<T> : IList<T>, IList, IReadOnlyList<T> { private IList<T> list; // DO NOT change the field name, it's required for compatibility with desktop .NET as it appears in serialization payload. diff --git a/src/System.Private.CoreLib/src/System/Decimal.cs b/src/System.Private.CoreLib/src/System/Decimal.cs index 1532a0a13..4370ce8a6 100644 --- a/src/System.Private.CoreLib/src/System/Decimal.cs +++ b/src/System.Private.CoreLib/src/System/Decimal.cs @@ -53,6 +53,7 @@ namespace System // the range of the Decimal type. [Serializable] [StructLayout(LayoutKind.Explicit)] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public partial struct Decimal : IFormattable, IComparable, IConvertible, IComparable<Decimal>, IEquatable<Decimal>, IDeserializationCallback { // Sign mask for the flags field. A value of zero in this bit indicates a diff --git a/src/System.Private.CoreLib/src/System/Double.cs b/src/System.Private.CoreLib/src/System/Double.cs index 32cac7ecf..4ebb81827 100644 --- a/src/System.Private.CoreLib/src/System/Double.cs +++ b/src/System.Private.CoreLib/src/System/Double.cs @@ -21,6 +21,7 @@ namespace System { [StructLayout(LayoutKind.Sequential)] [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public struct Double : IComparable, IFormattable, IComparable<Double>, IEquatable<Double>, IConvertible { private double m_value; // Do not rename (binary serialization) diff --git a/src/System.Private.CoreLib/src/System/Enum.cs b/src/System.Private.CoreLib/src/System/Enum.cs index 7ee0c6980..1b80b1647 100644 --- a/src/System.Private.CoreLib/src/System/Enum.cs +++ b/src/System.Private.CoreLib/src/System/Enum.cs @@ -16,6 +16,7 @@ using Internal.Reflection.Augments; namespace System { [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public abstract class Enum : ValueType, IComparable, IFormattable, IConvertible { public int CompareTo(Object target) diff --git a/src/System.Private.CoreLib/src/System/Exception.cs b/src/System.Private.CoreLib/src/System/Exception.cs index d12451b28..079b4a685 100644 --- a/src/System.Private.CoreLib/src/System/Exception.cs +++ b/src/System.Private.CoreLib/src/System/Exception.cs @@ -15,6 +15,7 @@ using Internal.Diagnostics; namespace System { [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class Exception : ISerializable { private void Init() diff --git a/src/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs b/src/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs index ddec11a01..3a7382792 100644 --- a/src/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs +++ b/src/System.Private.CoreLib/src/System/Globalization/CompareInfo.cs @@ -34,6 +34,7 @@ namespace System.Globalization } [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public partial class CompareInfo : IDeserializationCallback { // Mask used to check if IndexOf()/LastIndexOf()/IsPrefix()/IsPostfix() has the right flags. diff --git a/src/System.Private.CoreLib/src/System/Guid.cs b/src/System.Private.CoreLib/src/System/Guid.cs index 71eb52ea8..6e3fb3ae5 100644 --- a/src/System.Private.CoreLib/src/System/Guid.cs +++ b/src/System.Private.CoreLib/src/System/Guid.cs @@ -11,6 +11,7 @@ namespace System // Represents a Globally Unique Identifier. [StructLayout(LayoutKind.Sequential)] [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public partial struct Guid : IFormattable, IComparable, IComparable<Guid>, IEquatable<Guid> { public static readonly Guid Empty = new Guid(); diff --git a/src/System.Private.CoreLib/src/System/Int16.cs b/src/System.Private.CoreLib/src/System/Int16.cs index 83baebd88..a86f9ea2a 100644 --- a/src/System.Private.CoreLib/src/System/Int16.cs +++ b/src/System.Private.CoreLib/src/System/Int16.cs @@ -21,6 +21,7 @@ namespace System { [System.Runtime.InteropServices.StructLayout(LayoutKind.Sequential)] [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public struct Int16 : IComparable, IFormattable, IComparable<Int16>, IEquatable<Int16>, IConvertible { private short m_value; // Do not rename (binary serialization) diff --git a/src/System.Private.CoreLib/src/System/Int32.cs b/src/System.Private.CoreLib/src/System/Int32.cs index 2bfb25898..c53d286c9 100644 --- a/src/System.Private.CoreLib/src/System/Int32.cs +++ b/src/System.Private.CoreLib/src/System/Int32.cs @@ -23,6 +23,7 @@ namespace System [System.Runtime.InteropServices.StructLayout(LayoutKind.Sequential)] [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public struct Int32 : IComparable, IFormattable, IComparable<Int32>, IEquatable<Int32>, IConvertible { // _value is never assigned to by any of the methods. diff --git a/src/System.Private.CoreLib/src/System/Int64.cs b/src/System.Private.CoreLib/src/System/Int64.cs index 0386dd488..fc367db17 100644 --- a/src/System.Private.CoreLib/src/System/Int64.cs +++ b/src/System.Private.CoreLib/src/System/Int64.cs @@ -21,6 +21,7 @@ namespace System { [System.Runtime.InteropServices.StructLayout(LayoutKind.Sequential)] [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public struct Int64 : IComparable, IFormattable, IComparable<Int64>, IEquatable<Int64>, IConvertible { private long m_value; // Do not rename (binary serialization) diff --git a/src/System.Private.CoreLib/src/System/IntPtr.cs b/src/System.Private.CoreLib/src/System/IntPtr.cs index 5e8f0786d..c6e784952 100644 --- a/src/System.Private.CoreLib/src/System/IntPtr.cs +++ b/src/System.Private.CoreLib/src/System/IntPtr.cs @@ -14,6 +14,7 @@ namespace System // Data Contract: Single field of type void * [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public struct IntPtr : IEquatable<IntPtr>, ISerializable { // WARNING: We allow diagnostic tools to directly inspect this member (_value). diff --git a/src/System.Private.CoreLib/src/System/Nullable.cs b/src/System.Private.CoreLib/src/System/Nullable.cs index 0dce7520e..682beaaa0 100644 --- a/src/System.Private.CoreLib/src/System/Nullable.cs +++ b/src/System.Private.CoreLib/src/System/Nullable.cs @@ -13,6 +13,7 @@ using Internal.Reflection.Core.NonPortable; namespace System { [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public struct Nullable<T> where T : struct { // Changing the name of this field will break MDbg and Debugger tests diff --git a/src/System.Private.CoreLib/src/System/Object.cs b/src/System.Private.CoreLib/src/System/Object.cs index fdba5bd00..f31ce8251 100644 --- a/src/System.Private.CoreLib/src/System/Object.cs +++ b/src/System.Private.CoreLib/src/System/Object.cs @@ -35,6 +35,7 @@ namespace System // PREFER: public class Object [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public unsafe class Object { // CS0649: Field '{blah}' is never assigned to, and will always have its default value diff --git a/src/System.Private.CoreLib/src/System/Single.cs b/src/System.Private.CoreLib/src/System/Single.cs index 183fb0de6..ab7198bce 100644 --- a/src/System.Private.CoreLib/src/System/Single.cs +++ b/src/System.Private.CoreLib/src/System/Single.cs @@ -21,6 +21,7 @@ namespace System { [System.Runtime.InteropServices.StructLayout(LayoutKind.Sequential)] [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public struct Single : IComparable, IFormattable, IComparable<Single>, IEquatable<Single>, IConvertible { private float m_value; // Do not rename (binary serialization) diff --git a/src/System.Private.CoreLib/src/System/String.cs b/src/System.Private.CoreLib/src/System/String.cs index 3d75176a4..266128822 100644 --- a/src/System.Private.CoreLib/src/System/String.cs +++ b/src/System.Private.CoreLib/src/System/String.cs @@ -74,6 +74,7 @@ namespace System [StructLayout(LayoutKind.Sequential)] [System.Runtime.CompilerServices.EagerStaticClassConstructionAttribute] [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed partial class String : IComparable, IEnumerable, IEnumerable<char>, IComparable<String>, IEquatable<String>, IConvertible, ICloneable { #if BIT64 diff --git a/src/System.Private.CoreLib/src/System/TimeZoneInfo.cs b/src/System.Private.CoreLib/src/System/TimeZoneInfo.cs index 1bc66894c..81a7279c2 100644 --- a/src/System.Private.CoreLib/src/System/TimeZoneInfo.cs +++ b/src/System.Private.CoreLib/src/System/TimeZoneInfo.cs @@ -43,6 +43,7 @@ namespace System [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] sealed public partial class TimeZoneInfo : IEquatable<TimeZoneInfo>, ISerializable, IDeserializationCallback { // ---- SECTION: members for internal support ---------* diff --git a/src/System.Private.CoreLib/src/System/Tuple.cs b/src/System.Private.CoreLib/src/System/Tuple.cs index 74a98d71f..f0ce3392b 100644 --- a/src/System.Private.CoreLib/src/System/Tuple.cs +++ b/src/System.Private.CoreLib/src/System/Tuple.cs @@ -103,6 +103,7 @@ namespace System } [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class Tuple<T1> : IStructuralEquatable, IStructuralComparable, IComparable, ITupleInternal, ITuple { private readonly T1 m_Item1; // DO NOT change the field name, it's required for compatibility with desktop .NET as it appears in serialization payload. @@ -202,6 +203,7 @@ namespace System } [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class Tuple<T1, T2> : IStructuralEquatable, IStructuralComparable, IComparable, ITupleInternal, ITuple { private readonly T1 m_Item1; // DO NOT change the field name, it's required for compatibility with desktop .NET as it appears in serialization payload. @@ -316,6 +318,7 @@ namespace System } [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class Tuple<T1, T2, T3> : IStructuralEquatable, IStructuralComparable, IComparable, ITupleInternal, ITuple { private readonly T1 m_Item1; // DO NOT change the field name, it's required for compatibility with desktop .NET as it appears in serialization payload. @@ -441,6 +444,7 @@ namespace System } [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class Tuple<T1, T2, T3, T4> : IStructuralEquatable, IStructuralComparable, IComparable, ITupleInternal, ITuple { private readonly T1 m_Item1; // DO NOT change the field name, it's required for compatibility with desktop .NET as it appears in serialization payload. @@ -577,6 +581,7 @@ namespace System } [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class Tuple<T1, T2, T3, T4, T5> : IStructuralEquatable, IStructuralComparable, IComparable, ITupleInternal, ITuple { private readonly T1 m_Item1; // DO NOT change the field name, it's required for compatibility with desktop .NET as it appears in serialization payload. @@ -724,6 +729,7 @@ namespace System } [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class Tuple<T1, T2, T3, T4, T5, T6> : IStructuralEquatable, IStructuralComparable, IComparable, ITupleInternal, ITuple { private readonly T1 m_Item1; // DO NOT change the field name, it's required for compatibility with desktop .NET as it appears in serialization payload. @@ -882,6 +888,7 @@ namespace System } [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class Tuple<T1, T2, T3, T4, T5, T6, T7> : IStructuralEquatable, IStructuralComparable, IComparable, ITupleInternal, ITuple { private readonly T1 m_Item1; // DO NOT change the field name, it's required for compatibility with desktop .NET as it appears in serialization payload. @@ -1051,6 +1058,7 @@ namespace System } [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class Tuple<T1, T2, T3, T4, T5, T6, T7, TRest> : IStructuralEquatable, IStructuralComparable, IComparable, ITupleInternal, ITuple { private readonly T1 m_Item1; // DO NOT change the field name, it's required for compatibility with desktop .NET as it appears in serialization payload. diff --git a/src/System.Private.CoreLib/src/System/UInt16.cs b/src/System.Private.CoreLib/src/System/UInt16.cs index f7bd9a720..f8e2e6ad5 100644 --- a/src/System.Private.CoreLib/src/System/UInt16.cs +++ b/src/System.Private.CoreLib/src/System/UInt16.cs @@ -22,6 +22,7 @@ namespace System [CLSCompliant(false)] [System.Runtime.InteropServices.StructLayout(LayoutKind.Sequential)] [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public struct UInt16 : IComparable, IFormattable, IComparable<UInt16>, IEquatable<UInt16>, IConvertible { private ushort m_value; // Do not rename (binary serialization) diff --git a/src/System.Private.CoreLib/src/System/UInt32.cs b/src/System.Private.CoreLib/src/System/UInt32.cs index c111f8bea..85c2b42fb 100644 --- a/src/System.Private.CoreLib/src/System/UInt32.cs +++ b/src/System.Private.CoreLib/src/System/UInt32.cs @@ -23,6 +23,7 @@ namespace System [CLSCompliant(false)] [System.Runtime.InteropServices.StructLayout(LayoutKind.Sequential)] [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public struct UInt32 : IComparable, IFormattable, IComparable<UInt32>, IEquatable<UInt32>, IConvertible { private uint m_value; // Do not rename (binary serialization) diff --git a/src/System.Private.CoreLib/src/System/UInt64.cs b/src/System.Private.CoreLib/src/System/UInt64.cs index 1a8129292..1125ba443 100644 --- a/src/System.Private.CoreLib/src/System/UInt64.cs +++ b/src/System.Private.CoreLib/src/System/UInt64.cs @@ -22,6 +22,7 @@ namespace System [CLSCompliant(false)] [System.Runtime.InteropServices.StructLayout(LayoutKind.Sequential)] [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public struct UInt64 : IComparable, IFormattable, IComparable<UInt64>, IEquatable<UInt64>, IConvertible { private ulong m_value; // Do not rename (binary serialization) diff --git a/src/System.Private.CoreLib/src/System/UIntPtr.cs b/src/System.Private.CoreLib/src/System/UIntPtr.cs index de9fdfe6d..2ec5644e7 100644 --- a/src/System.Private.CoreLib/src/System/UIntPtr.cs +++ b/src/System.Private.CoreLib/src/System/UIntPtr.cs @@ -14,6 +14,7 @@ namespace System // Data Contract: Single field of type void * [Serializable] [CLSCompliant(false)] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public struct UIntPtr : IEquatable<UIntPtr>, ISerializable { unsafe private void* _value; diff --git a/src/System.Private.CoreLib/src/System/ValueType.cs b/src/System.Private.CoreLib/src/System/ValueType.cs index 6aa5382cb..d75dd2692 100644 --- a/src/System.Private.CoreLib/src/System/ValueType.cs +++ b/src/System.Private.CoreLib/src/System/ValueType.cs @@ -18,6 +18,7 @@ namespace System // CONTRACT with Runtime // Place holder type for type hierarchy, Compiler/Runtime requires this class [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public abstract class ValueType { public override String ToString() diff --git a/src/System.Private.CoreLib/src/System/WeakReference.cs b/src/System.Private.CoreLib/src/System/WeakReference.cs index e5fda01ec..1285ef8a6 100644 --- a/src/System.Private.CoreLib/src/System/WeakReference.cs +++ b/src/System.Private.CoreLib/src/System/WeakReference.cs @@ -21,6 +21,7 @@ using Internal.Runtime.Augments; namespace System { [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class WeakReference : ISerializable { // If you fix bugs here, please fix them in WeakReference<T> at the same time. diff --git a/src/System.Private.CoreLib/src/System/WeakReferenceOfT.cs b/src/System.Private.CoreLib/src/System/WeakReferenceOfT.cs index 41fd8e31d..fbfb6d36b 100644 --- a/src/System.Private.CoreLib/src/System/WeakReferenceOfT.cs +++ b/src/System.Private.CoreLib/src/System/WeakReferenceOfT.cs @@ -23,6 +23,7 @@ namespace System { // This class is sealed to mitigate security issues caused by Object::MemberwiseClone. [Serializable] + [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed class WeakReference<T> : ISerializable where T : class { // If you fix bugs here, please fix them in WeakReference at the same time. |