AnyBox icon indicating copy to clipboard operation
AnyBox copied to clipboard

Probable AnyBox resource leak

Open tgill880 opened this issue 11 months ago • 0 comments

I use AnyBox to create dialog windows for my PS script. Although a number of different windows might be used, every time the script runs this large dialog is shown.

image

On occasion I get an Unhandled Windows Exception Error like this

Unhandled exception. System.ComponentModel.Win32Exception (1816): Not enough quota is available to process this command.
   at System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet)
   at System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr lParam)
   at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

ChatGPT analysis seems spot on (a small part of a much longer session).

The full error message you've provided offers more context and helps narrow down the possible causes of the "Not enough quota is available to process this command" error. This error is thrown from within the Windows Presentation Foundation (WPF) infrastructure, as indicated by the stack trace involving classes like HwndTarget, HwndSource, and the WPF Dispatcher. This suggests that the issue is related to the graphical user interface (GUI) components of your application or script, which aligns with the suspicion around AnyBox or any other part of your script that creates or manipulates windows or other GUI elements.

Since the rest of the script deals with handing files to ImageMagick for conversion, the error most likely comes from AnyBox, perhaps by not properly releasing resources?

tgill880 avatar Mar 07 '24 05:03 tgill880