title: Visual Studio 2013 project: debug assertion failures
body: <p>I have been working on a Visual Studio project (C++) for a number of weeks and this morning I have bumped into debugging errors that prevent the executable from being launched at all. Both the compiler and the linker seem to be doing a neat job.
  However, I have a  Debug Assertion Failure and the file that seems to be involved in this is in the foundation classes directory, and it's called dlgdata.cpp. The ASSERT (FALSE) statement that failed in this code snippet (which the debuggers points to) </p>
  
  <pre><code>HWND CDataExchange::PrepareCtrl(int nIDC)
  {
  ASSERT(nIDC != 0);
  ASSERT(nIDC != -1); // not allowed
  HWND hWndCtrl;
  COleControlSite* pSite = NULL;
  m_pDlgWnd-&gt;GetDlgItem(nIDC, &amp;hWndCtrl);
  if (hWndCtrl == NULL)
  {
      // Could be a windowless OCX
      pSite = m_pDlgWnd-&gt;GetOleControlSite(nIDC);
      if (pSite == NULL)
      {
          TRACE(traceAppMsg, 0, "Error: no data exchange control with ID 0x%04X.\n",        nIDC);
          ASSERT(FALSE); // that is the one 
          AfxThrowNotSupportedException();
      }
  </code></pre>
  
  <p>I am not exactly sure as to how I created this while I was creating a box to display the value of a control variable. when I ignore the failure and move on with debugging, this triggers a breakpoint and takes me to winocc.cpp, and again is the ASSERT statement to be highlighted. </p>
  
  <pre><code>BOOL CWnd::EnableWindow(BOOL bEnable)
  {
  ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));
  
  if (m_pCtrlSite == NULL)
      return ::EnableWindow(m_hWnd, bEnable);
  else
      return m_pCtrlSite-&gt;EnableWindow(bEnable);
  }
  </code></pre>
  
  <p>I might go back to a back-up, but that is several hours work away and I'd be interested in knowing how to handle these problems when they occur. Should they occur again.
  Cheers, M.</p>