Hey,
On Tue, May 4, 2010 at 9:08 AM, Jan <[email protected]> wrote:
> I just want to avoid configuration problems. If the assembly has a pdb
> referenced and I cannot find it, I do not want to silently ignore it.
> If I remember right the pdb file path is part of the assembly.
Yeah, the PE headers can contain a reference to the fullname of the
pdb. But it doesn't make much sense to expose it. I mean, if you
analyze an assembly of mine, say Mono.Linq.Expressions.dll, you'd get:
C:\sources\mono.linq.expressions\bin\Debug\Mono.Linq.Expressions.pdb
Not very useful. Now you can have something like:
static bool HasPdbFileAround (ModuleDefinition module)
{
return File.Exists (Path.ChangeExtension
(module.FullyQualifiedName, ".pdb"));
}
var module = ModuleDefinition.ReadModule (...);
if (!HasPdbFileAround (module))
return;
var provider = new PdbReaderProvider ();
var reader = provider.GetSymbolReader (module, module.FullyQualifiedName);
module.ReadSymbols (reader); // this still may throw, but then you can continue.
--
Jb Evain <[email protected]>
--
--
mono-cecil