/// <summary> /// Given an existing assembly, this will check for the existance of PDB files /// </summary> /// <returns></returns> public static ISymbolReaderProvider GetSymbolReader(string assemblyPath, DebugSymbolType debugSymbolType = DebugSymbolType.Full) { var pdb = File.Exists(Path.ChangeExtension(assemblyPath, "pdb")); var mdb = File.Exists(Path.ChangeExtension(assemblyPath, "mdb")); if (!pdb && !mdb) { return(null); } switch (debugSymbolType) { case DebugSymbolType.None: return(null); case DebugSymbolType.Embedded: return(new EmbeddedPortablePdbReaderProvider()); case DebugSymbolType.Full: case DebugSymbolType.PdbOnly: case DebugSymbolType.Portable: return(pdb ? (ISymbolReaderProvider) new PdbReaderProvider() : new MdbReaderProvider()); default: throw new NotSupportedException(debugSymbolType.ToString()); } }
/// <summary> /// Given an existing assembly, this will check for the existance of PDB files /// </summary> /// <returns></returns> public static ISymbolWriterProvider GetSymbolWriter(string assemblyPath, DebugSymbolType debugSymbolType = DebugSymbolType.Full) { var pdb = File.Exists(Path.ChangeExtension(assemblyPath, "pdb")); var mdb = File.Exists(Path.ChangeExtension(assemblyPath, "mdb")); if (!pdb && !mdb) { return(null); } switch (debugSymbolType) { case DebugSymbolType.None: // embedded has symbols in dll, could probably extract and rewrite but I have never used this ever case DebugSymbolType.Embedded: return(null); case DebugSymbolType.Full: case DebugSymbolType.PdbOnly: return(pdb ? (ISymbolWriterProvider) new PdbWriterProvider() : new MdbWriterProvider()); case DebugSymbolType.Portable: return(new EmbeddedPortablePdbWriterProvider()); default: throw new NotSupportedException(debugSymbolType.ToString()); } }