4 writes to _items
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (4)
src\Compilers\Core\Portable\InternalUtilities\WeakList.cs (4)
22_items = Array.Empty<WeakReference<T>>(); 67_items = newItems; 84_items = newItems; 208_weakList._items = Array.Empty<WeakReference<T>>();
32 references to _items
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (32)
src\Compilers\Core\Portable\InternalUtilities\WeakList.cs (32)
27Debug.Assert(_size == _items.Length); 28Debug.Assert(_items.Length == 0 || _items.Length >= MinimalNonEmptySize); 30int alive = _items.Length; 32for (int i = 0; i < _items.Length; i++) 34if (!_items[i].TryGetTarget(out _)) 45if (alive < _items.Length / 4) 51else if (alive >= 3 * _items.Length / 4) 55var newItems = new WeakReference<T>[GetExpandedSize(_items.Length)]; 63Array.Copy(_items, 0, newItems, 0, _items.Length); 64Debug.Assert(_size == _items.Length); 73Compact(firstDead, _items); 76Debug.Assert(_items.Length > 0 && _size < 3 * _items.Length / 4, "length: " + _items.Length + " size: " + _size); 82var newItems = (newSize == _items.Length) ? _items : new WeakReference<T>[newSize]; 95/// Copies all live references from <see cref="_items"/> to <paramref name="result"/>. 100Debug.Assert(_items[firstDead].IsNull()); 102if (!ReferenceEquals(_items, result)) 104Array.Copy(_items, 0, result, 0, firstDead); 111var item = _items[i]; 122if (ReferenceEquals(_items, result)) 126_items[j++] = null!; 147return _items[index]; 152if (_size == _items.Length) 157Debug.Assert(_size < _items.Length); 158_items[_size++] = new WeakReference<T>(item); 188if (_weakList._items[currentIndex].TryGetTarget(out var item)) 211else if (_alive < _weakList._items.Length / 4) 226internal WeakReference<T>[] TestOnly_UnderlyingArray { get { return _items; } }