Skip to content

Commit c2a424b

Browse files
Correct
1 parent 44d16e9 commit c2a424b

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,9 @@ private async ValueTask<VoidResult> UnregisterExtensionInCurrentProcessAsync(
196196
{
197197
if (_extensions.TryGetValue(assemblyFolderPath, out extension))
198198
{
199+
// If loading assemblies from this folder failed earlier, don't do anything.
199200
if (extension is null)
200-
{
201-
// Loading assemblies from this folder failed earlier, so we don't need to do anything.
202-
return ValueTask.CompletedTask;
203-
}
201+
return default;
204202

205203
if (extension.RemoveAssemblyHandlers(assemblyFileName, out var assemblyHandlers))
206204
{
@@ -437,14 +435,15 @@ public async ValueTask<RegisterExtensionResponse> LoadAssemblyAsync(
437435
// We don't add assemblyHandlers to _assemblies here and instead let _extensionMessageHandlerService.RegisterAssembly do it
438436
// since RegisterAssembly can still fail if there are duplicated handler names.
439437
}
440-
catch (Exception e) when (FatalError.ReportAndCatch(exception = e, ErrorSeverity.General))
438+
catch (Exception e) when (FatalError.ReportAndPropagate(exception = e, ErrorSeverity.General))
441439
{
442440
throw ExceptionUtilities.Unreachable();
443441
}
444442
finally
445443
{
446444
// In case of exception, we cache null so that we don't try to load the same assembly again.
447-
_extensionMessageHandlerService.RegisterAssembly(this, assemblyFileName, exception is null ? assemblyHandlers : null);
445+
await _extensionMessageHandlerService.RegisterAssemblyAsync(
446+
this, assemblyFileName, exception is null ? assemblyHandlers : null, cancellationToken).ConfigureAwait(false);
448447
}
449448

450449
// The return is here, after RegisterAssembly, since RegisterAssembly can also throw an exception: the registration is not

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,7 @@ ValueTask<string> HandleExtensionDocumentMessageAsync(
4646
/// </summary>
4747
/// <param name="assemblyFilePath">The assembly to register and create message handlers from.</param>
4848
/// <returns>The names of the registered handlers.</returns>
49-
ValueTask<RegisterExtensionResponse> RegisterExtensionAsync(
50-
Workspace workspace,
51-
string assemblyFilePath,
52-
CancellationToken cancellationToken);
49+
ValueTask<RegisterExtensionResponse> RegisterExtensionAsync(string assemblyFilePath, CancellationToken cancellationToken);
5350

5451
/// <summary>
5552
/// Unregisters extension message handlers previously registered from <paramref name="assemblyFilePath"/>.

0 commit comments

Comments
 (0)