<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: &amp;quot;Not enough quota is available to process this command&amp;quot; exception when calling Document.CloseAndDiscard or AcadApplication.Documents.Open in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/quot-not-enough-quota-is-available-to-process-this-command-quot/m-p/12374315#M6650</link>
    <description>&lt;P&gt;I hope that if you have these 2 methods (CloseDrawing()/OpenDrawing()) used as generally shared code, you have remembered very well that they are &lt;STRONG&gt;ONLY&lt;/STRONG&gt; used when your code in the AutoCAD plugin runs in &lt;STRONG&gt;APPLICATION CONTEXT,&amp;nbsp;&lt;/STRONG&gt;not in &lt;STRONG&gt;DOCUMENT CONTEXT&lt;/STRONG&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you did not show or mention how these 2 methods are called, I am not sure if the AutoCAD error/crash is due to the methods being called in document context: if you do, they would crash AutoCAD for sure. So you have to look into it. OTH, if you do understand Application context and Document context well and calls the 2 methods only in Application context, the error would be a bit of mystical: I never saw something like this (mentioned "enough quota..."). Again, showing more relevant code where these 2 methods are called might be helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Nov 2023 16:37:56 GMT</pubDate>
    <dc:creator>norman.yuan</dc:creator>
    <dc:date>2023-11-13T16:37:56Z</dc:date>
    <item>
      <title>"Not enough quota is available to process this command" exception when calling Document.CloseAndDiscard or AcadApplication.Documents.Open</title>
      <link>https://forums.autodesk.com/t5/net-forum/quot-not-enough-quota-is-available-to-process-this-command-quot/m-p/12374259#M6649</link>
      <description>&lt;P&gt;&lt;SPAN&gt;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:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sflemingK8CWD_0-1699890770390.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1292342iC0CDE8F03CC93259/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sflemingK8CWD_0-1699890770390.png" alt="sflemingK8CWD_0-1699890770390.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;If I try to continue past this popup AutoCAD Architecture crashes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code that I am running is like this&lt;/P&gt;&lt;LI-CODE lang="general"&gt;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();
}&lt;/LI-CODE&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the call stack and last unhandled exception from dumpuserinfo.xml&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-----Current Stack:&lt;BR /&gt;at System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet)&lt;BR /&gt;at System.Windows.Interop.HwndTarget.UpdateWindowPos(IntPtr lParam)&lt;BR /&gt;at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)&lt;BR /&gt;at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp;amp; handled)&lt;BR /&gt;at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp;amp; handled)&lt;BR /&gt;at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)&lt;BR /&gt;at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)&lt;BR /&gt;at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)&lt;BR /&gt;at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)&lt;BR /&gt;at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)&lt;BR /&gt;at Autodesk.AutoCAD.ApplicationServices.DocumentExtension.CloseInternal(Document doc, Boolean discard, String fileName)&lt;BR /&gt;at MyProgram.a()&lt;/P&gt;&lt;P&gt;at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi, Object commandObject, Boolean bLispFunction)&lt;BR /&gt;at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo mi, Object commandObject, Boolean bLispFunction)&lt;BR /&gt;at Autodesk.AutoCAD.Runtime.PerDocumentCommandClass.Invoke(MethodInfo mi, Boolean bLispFunction)&lt;BR /&gt;at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.Invoke()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-----Last Unhandled Exception:&lt;/P&gt;&lt;P&gt;-----Last 3 'first chance' exceptions (may not be related to the crash if they were handled):&lt;BR /&gt;-----Last-0 'first chance' exception:&lt;BR /&gt;System.ComponentModel.Win32Exception (0x80004005): Not enough quota is available to process this command&lt;BR /&gt;at System.Windows.Interop.HwndTarget.UpdateWindowSettings(Boolean enableRenderTarget, Nullable`1 channelSet)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;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: &lt;A href="https://forums.autodesk.com/t5/autocad-architecture-forum/quot-not-enough-quota-is-available-to-process-this-command-quot/td-p/12367258" target="_blank"&gt;https://forums.autodesk.com/t5/autocad-architecture-forum/quot-not-enough-quota-is-available-to-process-this-command-quot/td-p/12367258&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2023 16:11:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/quot-not-enough-quota-is-available-to-process-this-command-quot/m-p/12374259#M6649</guid>
      <dc:creator>sflemingK8CWD</dc:creator>
      <dc:date>2023-11-13T16:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: "Not enough quota is available to process this command" exception when calling Document.CloseAndDiscard or AcadApplication.Documents.Open</title>
      <link>https://forums.autodesk.com/t5/net-forum/quot-not-enough-quota-is-available-to-process-this-command-quot/m-p/12374315#M6650</link>
      <description>&lt;P&gt;I hope that if you have these 2 methods (CloseDrawing()/OpenDrawing()) used as generally shared code, you have remembered very well that they are &lt;STRONG&gt;ONLY&lt;/STRONG&gt; used when your code in the AutoCAD plugin runs in &lt;STRONG&gt;APPLICATION CONTEXT,&amp;nbsp;&lt;/STRONG&gt;not in &lt;STRONG&gt;DOCUMENT CONTEXT&lt;/STRONG&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since you did not show or mention how these 2 methods are called, I am not sure if the AutoCAD error/crash is due to the methods being called in document context: if you do, they would crash AutoCAD for sure. So you have to look into it. OTH, if you do understand Application context and Document context well and calls the 2 methods only in Application context, the error would be a bit of mystical: I never saw something like this (mentioned "enough quota..."). Again, showing more relevant code where these 2 methods are called might be helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2023 16:37:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/quot-not-enough-quota-is-available-to-process-this-command-quot/m-p/12374315#M6650</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2023-11-13T16:37:56Z</dc:date>
    </item>
  </channel>
</rss>

