@@ -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
0 commit comments