private IEqualityComparer<TKey> _comparer;
private KeyCollection _keys;
private ValueCollection _values;
- private object _syncRoot;
// constants for serialization
private const string VersionName = "Version"; // Do not rename (binary serialization)
bool ICollection.IsSynchronized => false;
- object ICollection.SyncRoot
- {
- get
- {
- if (_syncRoot == null)
- {
- Interlocked.CompareExchange<object>(ref _syncRoot, new object(), null);
- }
- return _syncRoot;
- }
- }
+ object ICollection.SyncRoot => this;
bool IDictionary.IsFixedSize => false;
private T[] _items; // Do not rename (binary serialization)
private int _size; // Do not rename (binary serialization)
private int _version; // Do not rename (binary serialization)
- [NonSerialized]
- private object _syncRoot;
private static readonly T[] s_emptyArray = new T[0];
bool ICollection.IsSynchronized => false;
// Synchronization root for this object.
- object ICollection.SyncRoot
- {
- get
- {
- if (_syncRoot == null)
- {
- Interlocked.CompareExchange<object>(ref _syncRoot, new object(), null);
- }
- return _syncRoot;
- }
- }
+ object ICollection.SyncRoot => this;
// Sets or Gets the element at the given index.
public T this[int index]
private ICollection _values;
private IEqualityComparer _keycomparer;
- private object _syncRoot;
[Obsolete("Please use EqualityComparer property.")]
protected IHashCodeProvider hcp
}
// Returns the object to synchronize on for this hash table.
- public virtual object SyncRoot
- {
- get
- {
- if (_syncRoot == null)
- {
- System.Threading.Interlocked.CompareExchange<object>(ref _syncRoot, new object(), null);
- }
- return _syncRoot;
- }
- }
+ public virtual object SyncRoot => this;
// Returns the number of associations in this hashtable.
//
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 SyncRoot
- {
- get
- {
- if (_syncRoot == null)
- {
- System.Threading.Interlocked.CompareExchange<object>(ref _syncRoot, new object(), null);
- }
- return _syncRoot;
- }
- }
+ public object SyncRoot => this;
public ICollection Values
{
public class Collection<T> : IList<T>, IList, IReadOnlyList<T>
{
private IList<T> items; // Do not rename (binary serialization)
- [NonSerialized]
- private object _syncRoot;
public Collection()
{
{
get
{
- if (_syncRoot == null)
- {
- ICollection c = items as ICollection;
- if (c != null)
- {
- _syncRoot = c.SyncRoot;
- }
- else
- {
- System.Threading.Interlocked.CompareExchange<object>(ref _syncRoot, new object(), null);
- }
- }
- return _syncRoot;
+ return (items is ICollection coll) ? coll.SyncRoot : this;
}
}
public class ReadOnlyCollection<T> : IList<T>, IList, IReadOnlyList<T>
{
private IList<T> list; // Do not rename (binary serialization)
- [NonSerialized]
- private object _syncRoot;
public ReadOnlyCollection(IList<T> list)
{
{
get
{
- if (_syncRoot == null)
- {
- ICollection c = list as ICollection;
- if (c != null)
- {
- _syncRoot = c.SyncRoot;
- }
- else
- {
- System.Threading.Interlocked.CompareExchange<object>(ref _syncRoot, new object(), null);
- }
- }
- return _syncRoot;
+ return (list is ICollection coll) ? coll.SyncRoot : this;
}
}
{
"name": "System.Collections.Tests.Dictionary_Generic_Tests_int_int.IEnumerable_Generic_Enumerator_MoveNext_ModifiedDuringEnumeration_ThrowsInvalidOperationException",
"reason": "outdated"
- }
+ },
+ {
+ "name": "System.Collections.Tests.HashtableBasicTests.ICollection_NonGeneric_SyncRoot",
+ "reason": "waiting on corefx update"
+ },
+ {
+ "name": "System.Collections.Tests.HashtableValuesTests.ICollection_NonGeneric_SyncRoot",
+ "reason": "waiting on corefx update"
+ },
+ {
+ "name": "System.Collections.Tests.Hashtable_SyncRootTests.SyncRoot",
+ "reason": "waiting on corefx update"
+ },
+ {
+ "name": "System.Collections.Tests.HashtableBasicTests.ICollection_NonGeneric_SyncRoot",
+ "reason": "waiting on corefx update"
+ },
+ {
+ "name": "System.Collections.Tests.HashtableValuesTests.ICollection_NonGeneric_SyncRoot",
+ "reason": "waiting on corefx update"
+ },
+ {
+ "name": "System.Collections.Tests.HashtableSynchronizedTests.ICollection_NonGeneric_SyncRoot",
+ "reason": "waiting on corefx update"
+ },
+ {
+ "name": "System.Collections.Tests.DictionaryBaseTests.SyncRoot",
+ "reason": "waiting on corefx update"
+ },
+ {
+ "name": "System.Collections.Tests.HashtableKeysTests.ICollection_NonGeneric_SyncRoot",
+ "reason": "waiting on corefx update"
+ },
+ {
+ "name": "System.Collections.Tests.Dictionary_IDictionary_NonGeneric_Tests.ICollection_NonGeneric_SyncRoot",
+ "reason": "waiting on corefx update"
+ },
+ {
+ "name": "System.Collections.Tests.Dictionary_Generic_Tests_Keys_AsICollection.ICollection_NonGeneric_SyncRoot",
+ "reason": "waiting on corefx update"
+ },
+ {
+ "name": "System.Collections.Tests.Dictionary_Generic_Tests_Values_AsICollection.ICollection_NonGeneric_SyncRoot",
+ "reason": "waiting on corefx update"
+ },
+ ]
+ }
+ },
+ {
+ "name": "System.Collections.Specialized.Tests",
+ "enabled": true,
+ "exclusions": {
+ "namespaces": null,
+ "classes": null,
+ "methods": [
+ {
+ "name": "System.Collections.Specialized.Tests.StringDictionarySyncRootTests.SyncRoot",
+ "reason": "waiting on corefx update"
+ },
+ {
+ "name": "System.Collections.Specialized.Tests.HybridDictionaryValuesTests.ICollection_NonGeneric_SyncRoot",
+ "reason": "waiting on corefx update"
+ },
+ {
+ "name": "System.Collections.Specialized.Tests.HybridDictionaryKeysTests.ICollection_NonGeneric_SyncRoot",
+ "reason": "waiting on corefx update"
+ },
]
}
},
},
]
}
- },
+ },
{
"name": "System.Linq.Expressions.Tests",
"enabled": true,