From 984bcfb3083e1ce944e07e28d259b08ef2e21818 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Fri, 15 Sep 2017 10:06:23 -0700 Subject: [PATCH] Fix build breaks after moving files to shared and misc cleanup - Delete redundant collection and dictionary debug view implementations Signed-off-by: dotnet-bot --- src/mscorlib/System.Private.CoreLib.csproj | 1 - .../shared/System.Private.CoreLib.Shared.projitems | 2 + .../Collections/Generic/ICollectionDebugView.cs | 34 ++++++ .../Collections/Generic/IDictionaryDebugView.cs | 80 +++++++++++++ .../shared/System/Collections/Generic/List.cs | 2 +- .../System/Collections/ObjectModel/Collection.cs | 2 +- .../Collections/ObjectModel/ReadOnlyCollection.cs | 2 +- src/mscorlib/shared/System/Lazy.cs | 6 +- .../Collections/Concurrent/ConcurrentDictionary.cs | 2 +- .../src/System/Collections/Generic/DebugView.cs | 124 --------------------- .../src/System/Collections/Generic/Dictionary.cs | 6 +- .../Collections/ObjectModel/ReadOnlyDictionary.cs | 6 +- 12 files changed, 129 insertions(+), 138 deletions(-) create mode 100644 src/mscorlib/shared/System/Collections/Generic/ICollectionDebugView.cs create mode 100644 src/mscorlib/shared/System/Collections/Generic/IDictionaryDebugView.cs delete mode 100644 src/mscorlib/src/System/Collections/Generic/DebugView.cs diff --git a/src/mscorlib/System.Private.CoreLib.csproj b/src/mscorlib/System.Private.CoreLib.csproj index 53f8b98..f418f92 100644 --- a/src/mscorlib/System.Private.CoreLib.csproj +++ b/src/mscorlib/System.Private.CoreLib.csproj @@ -582,7 +582,6 @@ - diff --git a/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems b/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems index af843b8..fccaa2f 100644 --- a/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems +++ b/src/mscorlib/shared/System.Private.CoreLib.Shared.projitems @@ -54,8 +54,10 @@ + + diff --git a/src/mscorlib/shared/System/Collections/Generic/ICollectionDebugView.cs b/src/mscorlib/shared/System/Collections/Generic/ICollectionDebugView.cs new file mode 100644 index 0000000..9916e85 --- /dev/null +++ b/src/mscorlib/shared/System/Collections/Generic/ICollectionDebugView.cs @@ -0,0 +1,34 @@ +// 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.Diagnostics; + +namespace System.Collections.Generic +{ + internal sealed class ICollectionDebugView + { + private readonly ICollection _collection; + + public ICollectionDebugView(ICollection collection) + { + if (collection == null) + { + throw new ArgumentNullException(nameof(collection)); + } + + _collection = collection; + } + + [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] + public T[] Items + { + get + { + T[] items = new T[_collection.Count]; + _collection.CopyTo(items, 0); + return items; + } + } + } +} diff --git a/src/mscorlib/shared/System/Collections/Generic/IDictionaryDebugView.cs b/src/mscorlib/shared/System/Collections/Generic/IDictionaryDebugView.cs new file mode 100644 index 0000000..4721642 --- /dev/null +++ b/src/mscorlib/shared/System/Collections/Generic/IDictionaryDebugView.cs @@ -0,0 +1,80 @@ +// 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.Diagnostics; + +namespace System.Collections.Generic +{ + internal sealed class IDictionaryDebugView + { + private readonly IDictionary _dict; + + public IDictionaryDebugView(IDictionary dictionary) + { + if (dictionary == null) + throw new ArgumentNullException(nameof(dictionary)); + + _dict = dictionary; + } + + [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] + public KeyValuePair[] Items + { + get + { + KeyValuePair[] items = new KeyValuePair[_dict.Count]; + _dict.CopyTo(items, 0); + return items; + } + } + } + + internal sealed class DictionaryKeyCollectionDebugView + { + private readonly ICollection _collection; + + public DictionaryKeyCollectionDebugView(ICollection collection) + { + if (collection == null) + throw new ArgumentNullException(nameof(collection)); + + _collection = collection; + } + + [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] + public TKey[] Items + { + get + { + TKey[] items = new TKey[_collection.Count]; + _collection.CopyTo(items, 0); + return items; + } + } + } + + internal sealed class DictionaryValueCollectionDebugView + { + private readonly ICollection _collection; + + public DictionaryValueCollectionDebugView(ICollection collection) + { + if (collection == null) + throw new ArgumentNullException(nameof(collection)); + + _collection = collection; + } + + [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] + public TValue[] Items + { + get + { + TValue[] items = new TValue[_collection.Count]; + _collection.CopyTo(items, 0); + return items; + } + } + } +} diff --git a/src/mscorlib/shared/System/Collections/Generic/List.cs b/src/mscorlib/shared/System/Collections/Generic/List.cs index 0db89a0..f548f8d 100644 --- a/src/mscorlib/shared/System/Collections/Generic/List.cs +++ b/src/mscorlib/shared/System/Collections/Generic/List.cs @@ -15,7 +15,7 @@ namespace System.Collections.Generic // of the List is automatically increased as required by reallocating the // internal array. // - [DebuggerTypeProxy(typeof(Mscorlib_CollectionDebugView<>))] + [DebuggerTypeProxy(typeof(ICollectionDebugView<>))] [DebuggerDisplay("Count = {Count}")] [Serializable] [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] diff --git a/src/mscorlib/shared/System/Collections/ObjectModel/Collection.cs b/src/mscorlib/shared/System/Collections/ObjectModel/Collection.cs index 75e88ec..1e1b2c7 100644 --- a/src/mscorlib/shared/System/Collections/ObjectModel/Collection.cs +++ b/src/mscorlib/shared/System/Collections/ObjectModel/Collection.cs @@ -8,7 +8,7 @@ using System.Diagnostics; namespace System.Collections.ObjectModel { [Serializable] - [DebuggerTypeProxy(typeof(Mscorlib_CollectionDebugView<>))] + [DebuggerTypeProxy(typeof(ICollectionDebugView<>))] [DebuggerDisplay("Count = {Count}")] [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class Collection : IList, IList, IReadOnlyList diff --git a/src/mscorlib/shared/System/Collections/ObjectModel/ReadOnlyCollection.cs b/src/mscorlib/shared/System/Collections/ObjectModel/ReadOnlyCollection.cs index f1d2a09..dbf88d8 100644 --- a/src/mscorlib/shared/System/Collections/ObjectModel/ReadOnlyCollection.cs +++ b/src/mscorlib/shared/System/Collections/ObjectModel/ReadOnlyCollection.cs @@ -8,7 +8,7 @@ using System.Diagnostics; namespace System.Collections.ObjectModel { [Serializable] - [DebuggerTypeProxy(typeof(Mscorlib_CollectionDebugView<>))] + [DebuggerTypeProxy(typeof(ICollectionDebugView<>))] [DebuggerDisplay("Count = {Count}")] [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class ReadOnlyCollection : IList, IList, IReadOnlyList diff --git a/src/mscorlib/shared/System/Lazy.cs b/src/mscorlib/shared/System/Lazy.cs index 2ef3cd2..e71a37d 100644 --- a/src/mscorlib/shared/System/Lazy.cs +++ b/src/mscorlib/shared/System/Lazy.cs @@ -182,7 +182,7 @@ namespace System /// using parameters to the type's constructors. /// /// - [DebuggerTypeProxy(typeof(System_LazyDebugView<>))] + [DebuggerTypeProxy(typeof(LazyDebugView<>))] [DebuggerDisplay("ThreadSafetyMode={Mode}, IsValueCreated={IsValueCreated}, IsValueFaulted={IsValueFaulted}, Value={ValueForDebugDisplay}")] public class Lazy { @@ -520,14 +520,14 @@ namespace System /// A debugger view of the Lazy<T> to surface additional debugging properties and /// to ensure that the Lazy<T> does not become initialized if it was not already. - internal sealed class System_LazyDebugView + internal sealed class LazyDebugView { //The Lazy object being viewed. private readonly Lazy _lazy; /// Constructs a new debugger view object for the provided Lazy object. /// A Lazy object to browse in the debugger. - public System_LazyDebugView(Lazy lazy) + public LazyDebugView(Lazy lazy) { _lazy = lazy; } diff --git a/src/mscorlib/src/System/Collections/Concurrent/ConcurrentDictionary.cs b/src/mscorlib/src/System/Collections/Concurrent/ConcurrentDictionary.cs index 4111c59..e1593e3 100644 --- a/src/mscorlib/src/System/Collections/Concurrent/ConcurrentDictionary.cs +++ b/src/mscorlib/src/System/Collections/Concurrent/ConcurrentDictionary.cs @@ -31,7 +31,7 @@ namespace System.Collections.Concurrent /// All public and protected members of are thread-safe and may be used /// concurrently from multiple threads. /// - [DebuggerTypeProxy(typeof(Mscorlib_DictionaryDebugView<,>))] + [DebuggerTypeProxy(typeof(IDictionaryDebugView<,>))] [DebuggerDisplay("Count = {Count}")] internal class ConcurrentDictionary : IDictionary, IDictionary, IReadOnlyDictionary { diff --git a/src/mscorlib/src/System/Collections/Generic/DebugView.cs b/src/mscorlib/src/System/Collections/Generic/DebugView.cs deleted file mode 100644 index dc487c1..0000000 --- a/src/mscorlib/src/System/Collections/Generic/DebugView.cs +++ /dev/null @@ -1,124 +0,0 @@ -// 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: DebugView class for generic collections -** -** -** -** -=============================================================================*/ - -using System; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Diagnostics.Contracts; - -namespace System.Collections.Generic -{ - // - // VS IDE can't differentiate between types with the same name from different - // assembly. So we need to use different names for collection debug view for - // collections in mscorlib.dll and system.dll. - // - internal sealed class Mscorlib_CollectionDebugView - { - private ICollection collection; - - public Mscorlib_CollectionDebugView(ICollection collection) - { - if (collection == null) - ThrowHelper.ThrowArgumentNullException(ExceptionArgument.collection); - - this.collection = collection; - } - - [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] - public T[] Items - { - get - { - T[] items = new T[collection.Count]; - collection.CopyTo(items, 0); - return items; - } - } - } - - internal sealed class Mscorlib_DictionaryKeyCollectionDebugView - { - private ICollection collection; - - public Mscorlib_DictionaryKeyCollectionDebugView(ICollection collection) - { - if (collection == null) - ThrowHelper.ThrowArgumentNullException(ExceptionArgument.collection); - - this.collection = collection; - } - - [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] - public TKey[] Items - { - get - { - TKey[] items = new TKey[collection.Count]; - collection.CopyTo(items, 0); - return items; - } - } - } - - internal sealed class Mscorlib_DictionaryValueCollectionDebugView - { - private ICollection collection; - - public Mscorlib_DictionaryValueCollectionDebugView(ICollection collection) - { - if (collection == null) - ThrowHelper.ThrowArgumentNullException(ExceptionArgument.collection); - - this.collection = collection; - } - - [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] - public TValue[] Items - { - get - { - TValue[] items = new TValue[collection.Count]; - collection.CopyTo(items, 0); - return items; - } - } - } - - internal sealed class Mscorlib_DictionaryDebugView - { - private IDictionary dict; - - public Mscorlib_DictionaryDebugView(IDictionary dictionary) - { - if (dictionary == null) - ThrowHelper.ThrowArgumentNullException(ExceptionArgument.dictionary); - - dict = dictionary; - } - - [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] - public KeyValuePair[] Items - { - get - { - KeyValuePair[] items = new KeyValuePair[dict.Count]; - dict.CopyTo(items, 0); - return items; - } - } - } - -} diff --git a/src/mscorlib/src/System/Collections/Generic/Dictionary.cs b/src/mscorlib/src/System/Collections/Generic/Dictionary.cs index 0a83734..1ba1466 100644 --- a/src/mscorlib/src/System/Collections/Generic/Dictionary.cs +++ b/src/mscorlib/src/System/Collections/Generic/Dictionary.cs @@ -49,7 +49,7 @@ namespace System.Collections.Generic ThrowOnExisting = 2 } - [DebuggerTypeProxy(typeof(Mscorlib_DictionaryDebugView<,>))] + [DebuggerTypeProxy(typeof(IDictionaryDebugView<,>))] [DebuggerDisplay("Count = {Count}")] [Serializable] [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] @@ -1026,7 +1026,7 @@ namespace System.Collections.Generic } } - [DebuggerTypeProxy(typeof(Mscorlib_DictionaryKeyCollectionDebugView<,>))] + [DebuggerTypeProxy(typeof(DictionaryKeyCollectionDebugView<,>))] [DebuggerDisplay("Count = {Count}")] public sealed class KeyCollection : ICollection, ICollection, IReadOnlyCollection { @@ -1254,7 +1254,7 @@ namespace System.Collections.Generic } } - [DebuggerTypeProxy(typeof(Mscorlib_DictionaryValueCollectionDebugView<,>))] + [DebuggerTypeProxy(typeof(DictionaryValueCollectionDebugView<,>))] [DebuggerDisplay("Count = {Count}")] public sealed class ValueCollection : ICollection, ICollection, IReadOnlyCollection { diff --git a/src/mscorlib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs b/src/mscorlib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs index 3fd0cf8..b3eb006 100644 --- a/src/mscorlib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs +++ b/src/mscorlib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs @@ -19,7 +19,7 @@ using System.Diagnostics.Contracts; namespace System.Collections.ObjectModel { - [DebuggerTypeProxy(typeof(Mscorlib_DictionaryDebugView<,>))] + [DebuggerTypeProxy(typeof(IDictionaryDebugView<,>))] [DebuggerDisplay("Count = {Count}")] internal class ReadOnlyDictionary : IDictionary, IDictionary, IReadOnlyDictionary { @@ -428,7 +428,7 @@ namespace System.Collections.ObjectModel #endregion IReadOnlyDictionary members - [DebuggerTypeProxy(typeof(Mscorlib_CollectionDebugView<>))] + [DebuggerTypeProxy(typeof(ICollectionDebugView<>))] [DebuggerDisplay("Count = {Count}")] public sealed class KeyCollection : ICollection, ICollection, IReadOnlyCollection { @@ -538,7 +538,7 @@ namespace System.Collections.ObjectModel #endregion } - [DebuggerTypeProxy(typeof(Mscorlib_CollectionDebugView<>))] + [DebuggerTypeProxy(typeof(ICollectionDebugView<>))] [DebuggerDisplay("Count = {Count}")] public sealed class ValueCollection : ICollection, ICollection, IReadOnlyCollection { -- 2.7.4