On Mon, 2010-05-03 at 20:12 +0200, Jb Evain wrote: > On Mon, May 3, 2010 at 7:12 PM, Jan <[email protected]> wrote: > > var parameters = new ReaderParameters > > { > > SymbolReaderProvider = new PdbReaderProvider(), > > ReadingMode = ReadingMode.Immediate, > > AssemblyResolver = resolver, > > }; > > > > ModuleDefinition = > > ModuleDefinition.ReadModule(SourceAssemblyFileName, parameters); > > > > Which leads to an exception if the pdb file is not found. But I need a > > logic where I can ask the assembly if there is a pdb referenced and if > > it is available to load it. > > There's no builtin, you'll have to test whether the pdb file exists or > not, and then, call ModuleDefinition.LoadSymbols with a ISymbolReader > provided by a PdbSymbolReaderProvider.
Even if there was a builtin way to "ask the assembly if there is a pdb referenced," you'd *still* need to check for the PDB "manually," as the PDB may have been removed and the assembly won't (and can't) know. In short, you need to separately check for the pdb anyway. - Jon -- -- mono-cecil
