HRESULT 0x806D0005 from Microsoft Dia2Lib

I am trying to read a PDB file in a C # application. When I call loadDataFromPdb

or loadAndValidateDataFromPdb

with a file that I know exists, I get HRESULT 0x806D0005. Unfortunately, I have no idea what this means. I have a list of possible results [here] ( http://msdn.microsoft.com/en-us/library/2008hf0e(v=VS.80).aspx) , but I'm afraid I can't definitively pinpoint the problem.

Does anyone know what I am doing wrong? Or at least a method for checking what is matched?

Exception : System.Runtime.InteropServices.COMException (0x806D0005): Exception from HRESULT: 0x806D0005 in Dia2Lib.DiaSourceClass.loadDataFromPdb (String pdbPath)

Sample code:

public static void LoadSymbolsForModule(uint baseAddress, uint size, uint timeStamp, DM_PDB_SIGNATURE signature)
{
    IDiaDataSource m_source = new DiaSourceClass();
    //m_source.loadAndValidateDataFromPdb(signature.path, ref signature.guid, 0, signature.age);
    m_source.loadDataFromPdb(signature.path);
    IDiaSession m_session;
    m_source.openSession(out m_session);
    m_session.loadAddress = baseAddress;
    modules.Add(new Module(baseAddress, size, m_session));
}

      

Thanks guys. This problem has been killing me all day.

+2


a source to share


1 answer


Searching for E_PDB_NOT_FOUND const showed the source code in google dia2.h code which confirmed that 0x806D0005 is E_PDB_NOT_FOUND.

E_PDB_OK            = ( HRESULT  )(( ( ( ( unsigned long  )1 << 31 )  | ( ( unsigned long  )( LONG  )0x6d << 16 )  )  | ( unsigned long  )1 ) ),
E_PDB_USAGE         = ( E_PDB_OK + 1 ) ,
E_PDB_OUT_OF_MEMORY = ( E_PDB_USAGE + 1 ) ,
E_PDB_FILE_SYSTEM   = ( E_PDB_OUT_OF_MEMORY + 1 ) ,
E_PDB_NOT_FOUND     = ( E_PDB_FILE_SYSTEM + 1 ) ,

      

Note that the signature of the function being used takes LPCOLESTR

which is a unicode string. Make sure you order the string correctly in your interface declaration, i.e.

Int32 loadDataFromPdb ( [MarshalAs(UnmanagedType.LPWStr)] string pdbPath );

      



The msdn documentation also assumes that if the file exists, this error will be returned if it "determines that the file is in an invalid format". I doubt this is a real problem, but if you create this pdb file in some non-standard way, the problem might be the pdb file itself.

Searching for hresult and E_PDB_NOT_FOUND found someone who faced the same problem . It seemed that their problem was related to resource consumption i.e. too many pdbs being loaded or not released properly. Other search results for this hresult and this error name seem to support the possibility that this error occurs for other pdb load failures, for example pdbs is too large.

Hope this helps a little. :)

+3


a source







All Articles