From 2db04d85c7ce563d49407246b5afc86dafd3c779 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 16 Jan 2026 03:25:50 +0000 Subject: [PATCH] Add COM exception handling for RPC_E_CANTCALLOUT_ININPUTSYNCCALL in OnResize Co-authored-by: emako <24737061+emako@users.noreply.github.com> --- .../PreviewHandlerHost.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/PreviewHandlerHost.cs b/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/PreviewHandlerHost.cs index aeca29b..24c513b 100644 --- a/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/PreviewHandlerHost.cs +++ b/QuickLook.Plugin/QuickLook.Plugin.OfficeViewer/PreviewHandlerHost.cs @@ -77,8 +77,19 @@ public class PreviewHandlerHost : Control { base.OnResize(e); - var r = ClientRectangle; - _mCurrentPreviewHandler?.SetRect(ref r); + try + { + var r = ClientRectangle; + _mCurrentPreviewHandler?.SetRect(ref r); + } + catch (COMException ex) when (ex.HResult == unchecked((int)0x8001010D)) + { + // RPC_E_CANTCALLOUT_ININPUTSYNCCALL + // This exception occurs when an outgoing call cannot be made because + // the application is dispatching an input-synchronous call. + // It's safe to ignore this exception as the preview handler will be + // resized on the next resize event. + } } ///