Stewart Lynch
Stewart Lynch

Reputation: 129

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

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.

Upvotes: 0

Views: 303

Answers (1)

xwlan
xwlan

Reputation: 564

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.

Upvotes: 1

Related Questions