Skip to content

Commit e359cc2

Browse files
Docs
1 parent ae8e77d commit e359cc2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Features/Core/Portable/Extensions/ExtensionMessageHandlerService.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ private async ValueTask<VoidResult> UnregisterExtensionInCurrentProcessAsync(
158158
var assemblyFolderPath = Path.GetDirectoryName(assemblyFilePath)
159159
?? throw new InvalidOperationException($"Unable to get the directory name for {assemblyFilePath}.");
160160

161+
// Note: unregistering is slightly expensive as we do everything under a lock, to ensure that we have a
162+
// consistent view of the world. This is fine as we don't expect this to be called very often.
161163
using (await _gate.DisposableWaitAsync(cancellationToken).ConfigureAwait(false))
162164
{
163165
if (_folderPathToExtensionFolder.TryGetValue(assemblyFolderPath, out var lazyExtensionFolder))
@@ -288,6 +290,9 @@ private static async Task<ImmutableArray<IExtensionMessageHandlerWrapper<TResult
288290

289291
private abstract class ExtensionFolder
290292
{
293+
/// <summary>
294+
/// Mapping from assembly file path to the handlers it contains. Used as its own lock when mutating.
295+
/// </summary>
291296
private readonly Dictionary<string, AsyncLazy<AssemblyHandlers>> _assemblyFilePathToHandlers = new();
292297

293298
protected abstract AssemblyHandlers CreateAssemblyHandlers(string assemblyFilePath, CancellationToken cancellationToken);

0 commit comments

Comments
 (0)