4 instantiations of ReferenceCountedDisposable
Microsoft.CodeAnalysis.Workspaces (4)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\ReferenceCountedDisposable.cs (2)
45/// <para>Only use the <see cref="ReferenceCountedDisposable{T}(T)"/> constructor one time per target object. 164return new ReferenceCountedDisposable<T>(target, referenceCount);
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\ReferenceCountedDisposableCache.cs (1)
44disposable = new ReferenceCountedDisposable<Entry>(new Entry(this, key, valueCreator(key, arg)));
TemporaryStorage\TemporaryStorageService.MemoryMappedInfo.cs (1)
84streamAccessor = new ReferenceCountedDisposable<MemoryMappedViewAccessor>(rawAccessor);
42 references to ReferenceCountedDisposable
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (7)
Completion\CompletionProviders\DeclarationNameCompletionProviderTests.cs (4)
705using var workspaceFixture = GetOrCreateWorkspaceFixture(); 2354using var workspaceFixture = GetOrCreateWorkspaceFixture(); 2382using var workspaceFixture = GetOrCreateWorkspaceFixture(); 2798using var workspaceFixture = GetOrCreateWorkspaceFixture();
Completion\CompletionProviders\PartialMethodCompletionProviderTests.cs (2)
884using var workspaceFixture = GetOrCreateWorkspaceFixture(); 916using var workspaceFixture = GetOrCreateWorkspaceFixture();
TypeInferrer\TypeInferrerTests.Delegate.cs (1)
22using var workspaceFixture = GetOrCreateWorkspaceFixture();
Microsoft.CodeAnalysis.EditorFeatures.Wpf (5)
Suggestions\SuggestedActionsSource.cs (4)
70using var state = _state.TryAddReference(); 171using var state = _state.TryAddReference(); 227using var state = _state.TryAddReference(); 281using var state = _state.TryAddReference();
Suggestions\SuggestedActionsSource_Async.cs (1)
73using var state = _state.TryAddReference();
Microsoft.CodeAnalysis.Workspaces (23)
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\IReferenceCountedDisposable.cs (3)
10/// A covariant interface form of <see cref="ReferenceCountedDisposable{T}"/> that lets you re-cast an <see cref="ReferenceCountedDisposable{T}"/> 39/// <returns>A new <see cref="ReferenceCountedDisposable{T}"/> pointing to the same underlying object, if it
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\ReferenceCountedDisposable.cs (13)
18/// <para>Each instance of <see cref="ReferenceCountedDisposable{T}"/> represents a counted reference (also 30/// <para>While each instance of <see cref="ReferenceCountedDisposable{T}"/> should be explicitly disposed when 39/// <para>When using <see cref="ReferenceCountedDisposable{T}"/>, certain steps must be taken to ensure the 43/// <para>Use <see cref="ReferenceCountedDisposable{T}"/> consistently. In other words, do not mix code using 118public T Target => _instance ?? throw new ObjectDisposedException(nameof(ReferenceCountedDisposable<T>)); 127/// <returns>A new <see cref="ReferenceCountedDisposable{T}"/> pointing to the same underlying object, if it 130public ReferenceCountedDisposable<T>? TryAddReference() 140private static ReferenceCountedDisposable<T>? TryAddReferenceImpl(T? target, BoxedReferenceCount referenceCount) 221/// Represents a weak reference to a <see cref="ReferenceCountedDisposable{T}"/> which is capable of 231public WeakReference(ReferenceCountedDisposable<T> reference) 267/// <para>Unlike <see cref="ReferenceCountedDisposable{T}.TryAddReference"/>, this method is capable of 274/// <returns>A new <see cref="ReferenceCountedDisposable{T}"/> pointing to the same underlying object, 277public ReferenceCountedDisposable<T>? TryAddReference()
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\ReferenceCountedDisposableCache.cs (3)
19private readonly Dictionary<TKey, ReferenceCountedDisposable<Entry>.WeakReference> _cache = []; 26ReferenceCountedDisposable<Entry>? disposable = null; 45_cache[key] = new ReferenceCountedDisposable<Entry>.WeakReference(disposable);
TemporaryStorage\TemporaryStorageService.MemoryMappedInfo.cs (4)
46private ReferenceCountedDisposable<MemoryMappedViewAccessor>.WeakReference _weakReadAccessor; 78var streamAccessor = _weakReadAccessor.TryAddReference(); 85_weakReadAccessor = new ReferenceCountedDisposable<MemoryMappedViewAccessor>.WeakReference(streamAccessor); 143ReferenceCountedDisposable<MemoryMappedViewAccessor> accessor,
Microsoft.CodeAnalysis.Workspaces.UnitTests (7)
WorkspaceServiceTests\ReferenceCountedDisposableTests.cs (7)
63var reference2 = reference.TryAddReference(); 80var reference2 = reference.TryAddReference(); 81var reference3 = reference2.TryAddReference(); 102var reference2 = reference.TryAddReference(); 113var reference3 = weakReference.TryAddReference(); 142var secondReference = reference.TryAddReference(); 167var secondReference = reference.TryAddReference();