QL-Win / QL-Win/QuickLook

System.ArgumentException (Invalid Parameter) when switching away from a loading PPTX file

Open
#1,892 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
24.7k
Forks
1.3k
Avg merge
4d 7h
Merged PRs (30d)
1

Description

For all's convenience, please use English to fill this issue.

Please search within existing issues before the submission. Has this issue already been reported?

Describe the bug
The OfficeViewer plugin throws a System.ArgumentException when the user switches to a different file while a large .pptx file is still loading and converting. The exception occurs because the delayed UI rendering task attempts to execute after the viewer control has been hidden or removed, resulting in an invalid rendering dimension (width/height = 0) being passed to System.Drawing.Bitmap.

To Reproduce
Steps to reproduce the behavior:

  1. Select a large .pptx file (e.g., >10MB) to preview it via QuickLook.
  2. While the file is still loading/converting (before the actual preview is rendered), quickly switch to preview another file (e.g., using arrow keys).
  3. The background conversion of the initial .pptx file finishes and triggers the delayed Dispatcher.BeginInvoke rendering task.
  4. See error in the exception log due to invalid UI control dimensions.

Expected behavior
The plugin should gracefully handle rapid file switching. It should either cancel the background .pptx to .pdf conversion process when the user selects a different file, or add a safety check before rendering to ensure the viewer control's dimensions are valid (width > 0 and height > 0), rather than throwing an unhandled exception.

Desktop (please complete the following information):

  • OS Version: Windows 11 25H2
  • QuickLook Version: 4.4.0.0

Screenshots and Exception Log

QuickLook - 目标幻灯片.pptx v4.4.0.0
2026/3/15 15:00:02 Windows 10.0.26200.2

System.ArgumentException: 参数无效。
   在 System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
   在 PdfiumViewer.PdfDocument.Render(Int32 page, Int32 width, Int32 height, Single dpiX, Single dpiY, PdfRotation rotate, PdfRenderFlags flags, Boolean drawFormFields)
   在 QuickLook.Plugin.PDFViewer.PdfPageExtension.Render(PdfDocumentWrapper doc, Int32 page, Double factor, Boolean fixDpi)
   在 QuickLook.Plugin.PDFViewer.PdfViewerControl.ReRenderCurrentPage()
   在 QuickLook.Plugin.PDFViewer.PdfViewerControl.UpdatePageViewWhenSelectionChanged(Object sender, SelectionChangedEventArgs e)
   在 System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   在 System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   在 System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   在 System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   在 System.Windows.Controls.ListBox.OnSelectionChanged(SelectionChangedEventArgs e)
   在 System.Windows.Controls.Primitives.Selector.SelectionChanger.End()
   在 System.Windows.Controls.Primitives.Selector.SelectionChanger.SelectJustThisItem(ItemInfo info, Boolean assumeInItemsCollection)
   在 System.Windows.Controls.Primitives.Selector.OnSelectedIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   在 System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   在 System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   在 System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   在 System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   在 System.Windows.DependencyObject.CoerceValue(DependencyProperty dp)
   在 System.Windows.Controls.Primitives.Selector.OnItemsChanged(NotifyCollectionChangedEventArgs e)
   在 System.Collections.Specialized.NotifyCollectionChangedEventHandler.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
   在 System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
   在 System.Windows.WeakEventManager.ListenerList`1.DeliverEvent(Object sender, EventArgs e, Type managerType)
   在 System.Windows.WeakEventManager.DeliverEvent(Object sender, EventArgs args)
   在 System.Windows.Data.CollectionView.OnCollectionChanged(NotifyCollectionChangedEventArgs args)
   在 System.Windows.Data.ListCollectionView.ProcessCollectionChangedWithAdjustedIndex(NotifyCollectionChangedEventArgs args, Int32 adjustedOldIndex, Int32 adjustedNewIndex)
   在 System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   在 System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
   在 QuickLook.Common.ExtensionMethods.EnumerableExtensions.ForEach[T](IEnumerable`1 enumeration, Action`1 action)
   在 QuickLook.Plugin.OfficeViewer.SyncfusionControl.<>c__DisplayClass3_0.<OpenPowerpoint>b__0()
   在 System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   在 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with QuickLook.Plugin.OfficeViewer.SyncfusionControl.OpenPowerpoint, then trace the delayed rendering path into PdfViewerControl.ReRenderCurrentPage and PdfPageExtension.Render. Reproduce rapid switching with a large PPTX and verify that the previous load no longer reaches rendering with zero dimensions or produces an unhandled System.ArgumentException.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.