Reputation: 101
I am trying to inspect a .pdb using the DIA SDK from C# but I cannot get the user defined types using this code:
string pdbFileName = @"c:\test.pdb";
var sourceClass = new DiaSourceClass();
sourceClass.loadDataFromPdb(pdbFileName);
IDiaSession session;
sourceClass.openSession(out session);
IDiaEnumSymbols symbols;
session.globalScope.findChildren(SymTagEnum.SymTagUDT, null, 0, out symbols);
I get different results if I reference dia2.tlb or dia2.dll from my C# project.
If I reference dia2.tlb, the function call completes successfully, but I get no symbols back. This is the same if I pass SymTagEnum.SymTagPublicSymbol
to findChildren
too.
If I reference dia2.dll, the function throws a NotImplementedException
instead. In this case, passing SymTagPublicSymbol
to findChildren
does return symbols.
Has anyone encountered this? I think referencing the .dll is correct, but I do not know why I get the NotImplementedException
thrown.
I created the dia2.tlb
and dia2.dll
using the commands in a VS command prompt:
cd C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional
midl /I "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\DIA SDK\idl";"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\DIA SDK\include" dia2.idl /tlb dia2.tlb
tlbimp dia2.tlb
Many thanks.
Upvotes: 1
Views: 227