title: How to check if ID3D12GraphicsCommandList has been closed?
body: <p>I'm learning DirectX12 and writing some utility classes to encapsulate functionality. Right now I'm working on mechanism for pooling CommandLists.</p>
  
  <p>The pool assumes all command lists are closed. I wanted to validate that during inserting to the pool, but I can't manage to check it. From <a href="https://docs.microsoft.com/en-us/windows/desktop/api/d3d12/nf-d3d12-id3d12graphicscommandlist-close" rel="nofollow noreferrer">MSDN</a>:</p>
  
  <blockquote>
    <p>Returns S_OK if successful; otherwise, returns one of the following
    values:</p>
    
    <ul>
    <li>E_FAIL if the command list has already been closed, or an invalid API was called during command list recording.</li>
    </ul>
  </blockquote>
  
  <p>Which is precisely what I'm looking for, but when I call ID3D12GraphicsCommandList::Close() to validate, it throws exception in <code>KernelBase.dll</code>. It looks really bizarre to me. Is this specification incompliance?</p>
  
  <p><strong>//EDIT:</strong> I cannot catch the exception, even with <code>catch(...)</code>. It tells me maybe something may be wrong with my setup, but everything else is working for me.</p>