Fix build breaks after moving files to shared and misc cleanup
authorJan Kotas <jkotas@microsoft.com>
Fri, 15 Sep 2017 17:06:23 +0000 (10:06 -0700)
committerJan Kotas <jkotas@microsoft.com>
Fri, 15 Sep 2017 19:52:04 +0000 (12:52 -0700)
- Delete redundant collection and dictionary debug view implementations

Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
12 files changed:
src/mscorlib/System.Private.CoreLib.csproj
src/mscorlib/shared/System.Private.CoreLib.Shared.projitems
src/mscorlib/shared/System/Collections/Generic/ICollectionDebugView.cs [new file with mode: 0644]
src/mscorlib/shared/System/Collections/Generic/IDictionaryDebugView.cs [new file with mode: 0644]
src/mscorlib/shared/System/Collections/Generic/List.cs
src/mscorlib/shared/System/Collections/ObjectModel/Collection.cs
src/mscorlib/shared/System/Collections/ObjectModel/ReadOnlyCollection.cs
src/mscorlib/shared/System/Lazy.cs
src/mscorlib/src/System/Collections/Concurrent/ConcurrentDictionary.cs
src/mscorlib/src/System/Collections/Generic/DebugView.cs [deleted file]
src/mscorlib/src/System/Collections/Generic/Dictionary.cs
src/mscorlib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs

index 53f8b98..f418f92 100644 (file)
     <Compile Include="$(BclSourcesRoot)\System\Collections\Generic\ComparerHelpers.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Collections\Generic\Dictionary.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Collections\Generic\EqualityComparer.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Collections\Generic\DebugView.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Collections\Generic\ArraySortHelper.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Collections\ObjectModel\ReadOnlyDictionary.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Collections\Concurrent\ConcurrentStack.cs" />
index af843b8..fccaa2f 100644 (file)
     <Compile Include="$(MSBuildThisFileDirectory)System\CLSCompliantAttribute.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Collections\DictionaryEntry.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Collections\Generic\ICollection.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)System\Collections\Generic\ICollectionDebugView.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Collections\Generic\IComparer.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Collections\Generic\IDictionary.cs" />
+    <Compile Include="$(MSBuildThisFileDirectory)System\Collections\Generic\IDictionaryDebugView.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Collections\Generic\IEnumerable.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Collections\Generic\IEnumerator.cs" />
     <Compile Include="$(MSBuildThisFileDirectory)System\Collections\Generic\IEqualityComparer.cs" />
diff --git a/src/mscorlib/shared/System/Collections/Generic/ICollectionDebugView.cs b/src/mscorlib/shared/System/Collections/Generic/ICollectionDebugView.cs
new file mode 100644 (file)
index 0000000..9916e85
--- /dev/null
@@ -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<T>
+    {
+        private readonly ICollection<T> _collection;
+
+        public ICollectionDebugView(ICollection<T> 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 (file)
index 0000000..4721642
--- /dev/null
@@ -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<K, V>
+    {
+        private readonly IDictionary<K, V> _dict;
+
+        public IDictionaryDebugView(IDictionary<K, V> dictionary)
+        {
+            if (dictionary == null)
+                throw new ArgumentNullException(nameof(dictionary));
+
+            _dict = dictionary;
+        }
+
+        [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
+        public KeyValuePair<K, V>[] Items
+        {
+            get
+            {
+                KeyValuePair<K, V>[] items = new KeyValuePair<K, V>[_dict.Count];
+                _dict.CopyTo(items, 0);
+                return items;
+            }
+        }
+    }
+
+    internal sealed class DictionaryKeyCollectionDebugView<TKey, TValue>
+    {
+        private readonly ICollection<TKey> _collection;
+
+        public DictionaryKeyCollectionDebugView(ICollection<TKey> 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<TKey, TValue>
+    {
+        private readonly ICollection<TValue> _collection;
+
+        public DictionaryValueCollectionDebugView(ICollection<TValue> 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;
+            }
+        }
+    }
+}
index 0db89a0..f548f8d 100644 (file)
@@ -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")]
index 75e88ec..1e1b2c7 100644 (file)
@@ -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<T> : IList<T>, IList, IReadOnlyList<T>
index f1d2a09..dbf88d8 100644 (file)
@@ -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<T> : IList<T>, IList, IReadOnlyList<T>
index 2ef3cd2..e71a37d 100644 (file)
@@ -182,7 +182,7 @@ namespace System
     /// using parameters to the type's constructors.
     /// </para>
     /// </remarks>
-    [DebuggerTypeProxy(typeof(System_LazyDebugView<>))]
+    [DebuggerTypeProxy(typeof(LazyDebugView<>))]
     [DebuggerDisplay("ThreadSafetyMode={Mode}, IsValueCreated={IsValueCreated}, IsValueFaulted={IsValueFaulted}, Value={ValueForDebugDisplay}")]
     public class Lazy<T>
     {
@@ -520,14 +520,14 @@ namespace System
 
     /// <summary>A debugger view of the Lazy&lt;T&gt; to surface additional debugging properties and 
     /// to ensure that the Lazy&lt;T&gt; does not become initialized if it was not already.</summary>
-    internal sealed class System_LazyDebugView<T>
+    internal sealed class LazyDebugView<T>
     {
         //The Lazy object being viewed.
         private readonly Lazy<T> _lazy;
 
         /// <summary>Constructs a new debugger view object for the provided Lazy object.</summary>
         /// <param name="lazy">A Lazy object to browse in the debugger.</param>
-        public System_LazyDebugView(Lazy<T> lazy)
+        public LazyDebugView(Lazy<T> lazy)
         {
             _lazy = lazy;
         }
index 4111c59..e1593e3 100644 (file)
@@ -31,7 +31,7 @@ namespace System.Collections.Concurrent
     /// All public and protected members of <see cref="ConcurrentDictionary{TKey,TValue}"/> are thread-safe and may be used
     /// concurrently from multiple threads.
     /// </remarks>
-    [DebuggerTypeProxy(typeof(Mscorlib_DictionaryDebugView<,>))]
+    [DebuggerTypeProxy(typeof(IDictionaryDebugView<,>))]
     [DebuggerDisplay("Count = {Count}")]
     internal class ConcurrentDictionary<TKey, TValue> : IDictionary<TKey, TValue>, IDictionary, IReadOnlyDictionary<TKey, TValue>
     {
diff --git a/src/mscorlib/src/System/Collections/Generic/DebugView.cs b/src/mscorlib/src/System/Collections/Generic/DebugView.cs
deleted file mode 100644 (file)
index dc487c1..0000000
+++ /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<T>
-    {
-        private ICollection<T> collection;
-
-        public Mscorlib_CollectionDebugView(ICollection<T> 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<TKey, TValue>
-    {
-        private ICollection<TKey> collection;
-
-        public Mscorlib_DictionaryKeyCollectionDebugView(ICollection<TKey> 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<TKey, TValue>
-    {
-        private ICollection<TValue> collection;
-
-        public Mscorlib_DictionaryValueCollectionDebugView(ICollection<TValue> 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<K, V>
-    {
-        private IDictionary<K, V> dict;
-
-        public Mscorlib_DictionaryDebugView(IDictionary<K, V> dictionary)
-        {
-            if (dictionary == null)
-                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.dictionary);
-
-            dict = dictionary;
-        }
-
-        [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
-        public KeyValuePair<K, V>[] Items
-        {
-            get
-            {
-                KeyValuePair<K, V>[] items = new KeyValuePair<K, V>[dict.Count];
-                dict.CopyTo(items, 0);
-                return items;
-            }
-        }
-    }
-
-}
index 0a83734..1ba1466 100644 (file)
@@ -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<TKey>, ICollection, IReadOnlyCollection<TKey>
         {
@@ -1254,7 +1254,7 @@ namespace System.Collections.Generic
             }
         }
 
-        [DebuggerTypeProxy(typeof(Mscorlib_DictionaryValueCollectionDebugView<,>))]
+        [DebuggerTypeProxy(typeof(DictionaryValueCollectionDebugView<,>))]
         [DebuggerDisplay("Count = {Count}")]
         public sealed class ValueCollection : ICollection<TValue>, ICollection, IReadOnlyCollection<TValue>
         {
index 3fd0cf8..b3eb006 100644 (file)
@@ -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<TKey, TValue> : IDictionary<TKey, TValue>, IDictionary, IReadOnlyDictionary<TKey, TValue>
     {
@@ -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<TKey>, ICollection, IReadOnlyCollection<TKey>
         {
@@ -538,7 +538,7 @@ namespace System.Collections.ObjectModel
             #endregion
         }
 
-        [DebuggerTypeProxy(typeof(Mscorlib_CollectionDebugView<>))]
+        [DebuggerTypeProxy(typeof(ICollectionDebugView<>))]
         [DebuggerDisplay("Count = {Count}")]
         public sealed class ValueCollection : ICollection<TValue>, ICollection, IReadOnlyCollection<TValue>
         {