"Not enough quota is available to process this command" exception when calling Document.CloseAndDiscard or AcadApplication.Documents.Open
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am a developer for an ACA plugin and recently I've been experiencing an infrequent issue with using Document.CloseAndDiscard and AcadApplication.Documents.Open where I sometimes get this error:
If I try to continue past this popup AutoCAD Architecture crashes.
The code that I am running is like this
void CloseDrawing()
{
Document activeDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
activeDoc.CloseAndDiscard(); // sometimes crashes here
}
void OpenDrawing(string fullFileName)
{
AcadApplication acadApp = (AcadApplication)Application.AcadApplication;
Autodesk.AutoCAD.Interop.IAcadDocument baseDwg;
baseDwg = acadApp.Documents.Open(fullFileName, true, null); // sometimes crashes here
baseDwg.Activate();
}
This problem is something that I have only been able to reproduce in AutoCAD Architecture 2022, but since I can't consistently reproduce this I cannot confidently say that the issue exists only in 2022 and not previous versions as well.
Has anyone experienced this issue before, or have any idea what could cause this? My code base is so large that I have no idea where to begin looking for what could be contributing to this error since the exception is originating from an AutoCAD method.
Below is the call stack and last unhandled exception from dumpuserinfo.xml
-----Current Stack:
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 MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
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)
at Autodesk.AutoCAD.ApplicationServices.DocumentExtension.CloseInternal(Document doc, Boolean discard, String fileName)
at MyProgram.a()
at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.PerDocumentCommandClass.Invoke(MethodInfo mi, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.Invoke()
-----Last Unhandled Exception:
-----Last 3 'first chance' exceptions (may not be related to the crash if they were handled):
-----Last-0 'first chance' exception:
System.ComponentModel.Win32Exception (0x80004005): Not enough quota is available to process this command
at System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet)
This is a duplicate of a post I made on the AutoCAD Architecture Forum since that was the wrong forum to ask my question. My original post can be found here: https://forums.autodesk.com/t5/autocad-architecture-forum/quot-not-enough-quota-is-available-to-proc...