How do I make DIA release its lock on a pdb file?

301 views Asked by At

How do I make DIA release its lock on a pdb file?

I load a pdb and create a session as shown below, and it all works fine, I can use the session to get data from the pdb.

When I'm finished with the pdb I release the session and the DiaSource, but DIA still has a lock on the pdb file, I can't delete the pdb file in explorer until my app exits. How do I tell DIA to release the lock on the pdb file?

CoCreateInstance(__uuidof(DiaSource),
    NULL,
    CLSCTX_INPROC_SERVER,
    __uuidof(IDiaDataSource),
    (void**)&mp_DiaSource);

mp_DiaSource->loadAndValidateDataFromPdb(
    (LPCOLESTR)p_wide_filename, &m_Sig, 0, m_Age);

mp_DiaSource->openSession(&mp_Session);

// do stuff with mp_Session here

mp_Session->Release();

mp_DiaSource->Release();

many thanks.

Stewart.

1

There are 1 answers

1
xwlan On

at least for msdia90.dll, it's true that the file handle is not closed after Release(), a possible workaround is, call loadDataFromIStream(), and pass IStream instead of a path to load pdb file, however, I never test whether this really works.