From cea1fcfe47229848df6ed694108cf0a158cae4a6 Mon Sep 17 00:00:00 2001 From: Hongtao Zhang Date: Thu, 16 May 2024 22:24:24 -0500 Subject: [PATCH] skip if method not found --- Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs b/Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs index 9b094e315..8eb5c4459 100644 --- a/Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs +++ b/Flow.Launcher.Core/Plugin/JsonRPCPluginV2.cs @@ -5,6 +5,7 @@ using System.IO.Pipelines; using System.Threading; using System.Threading.Tasks; using Flow.Launcher.Core.Plugin.JsonRPCV2Models; +using Flow.Launcher.Infrastructure.Logger; using Flow.Launcher.Plugin; using Microsoft.VisualStudio.Threading; using StreamJsonRpc; @@ -141,7 +142,20 @@ namespace Flow.Launcher.Core.Plugin public virtual async ValueTask DisposeAsync() { - await RPC.InvokeAsync("close"); + try + { + await RPC.InvokeAsync("close"); + } + catch (RemoteMethodNotFoundException e) + { + } + catch (Exception e) + { + Log.Exception( + $"Exception when calling close method for plugin <{Context.CurrentPluginMetadata.Name}>", + e); + } + RPC?.Dispose(); ErrorStream?.Dispose(); }