I have a member variable declared as

```
CComPtr<IXMLDOMDocument2> m_spXMLDoc;

```

XML document is created like this

```
CoCreateInstance(CLSID_DOMDocument, NULL, CLSCTX_INPROC_SERVER,
    IID_IXMLDOMDocument2, (void**)&m_spXMLDoc));

```

Now when application exits, an exception is thrown. Callstack is pointing to `p->Release()`

```
~CComPtrBase() throw()
{
   if (p)
      p->Release();
}

```

When I hover over to `p` in VS debugger, it points to some valid memory.

The last callstack points to exception in msxm6

```
msxml6.dll!3d6cXX03() 

```

Any suggestions, what could be the reason? I don't think it's a `CComPtr` issue.