Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ TryOpenAssociatedPortablePdb()

bool System.Reflection.PortableExecutable.PEReader.TryOpenAssociatedPortablePdb ( string peImagePath,
Func< string, Stream?> pdbFileStreamProvider,
out MetadataReaderProvider? pdbReaderProvider,
out string? pdbPath )
inline

Definition at line 389 of file PEReader.cs.

390 {
391 if (peImagePath == null)
392 {
393 Throw.ArgumentNull("peImagePath");
394 }
395 if (pdbFileStreamProvider == null)
396 {
397 Throw.ArgumentNull("pdbFileStreamProvider");
398 }
399 pdbReaderProvider = null;
400 pdbPath = null;
401 string directoryName;
402 try
403 {
404 directoryName = Path.GetDirectoryName(peImagePath);
405 }
406 catch (Exception ex)
407 {
408 throw new ArgumentException(ex.Message, "peImagePath");
409 }
410 Exception errorToReport = null;
412 DebugDirectoryEntry codeViewEntry = collection.FirstOrDefault((DebugDirectoryEntry e) => e.IsPortableCodeView);
413 if (codeViewEntry.DataSize != 0 && TryOpenCodeViewPortablePdb(codeViewEntry, directoryName, pdbFileStreamProvider, out pdbReaderProvider, out pdbPath, ref errorToReport))
414 {
415 return true;
416 }
417 DebugDirectoryEntry embeddedPdbEntry = collection.FirstOrDefault((DebugDirectoryEntry e) => e.Type == DebugDirectoryEntryType.EmbeddedPortablePdb);
418 if (embeddedPdbEntry.DataSize != 0)
419 {
420 bool openedEmbeddedPdb = false;
421 pdbReaderProvider = null;
422 TryOpenEmbeddedPortablePdb(embeddedPdbEntry, ref openedEmbeddedPdb, ref pdbReaderProvider, ref errorToReport);
423 if (openedEmbeddedPdb)
424 {
425 return true;
426 }
427 }
428 if (errorToReport != null)
429 {
430 ExceptionDispatchInfo.Capture(errorToReport).Throw();
431 }
432 return false;
433 }
static ? string GetDirectoryName(string? path)
Definition Path.cs:121
ImmutableArray< DebugDirectoryEntry > ReadDebugDirectory()
Definition PEReader.cs:297
void TryOpenEmbeddedPortablePdb(DebugDirectoryEntry embeddedPdbEntry, ref bool openedEmbeddedPdb, ref MetadataReaderProvider provider, ref Exception errorToReport)
Definition PEReader.cs:512
bool TryOpenCodeViewPortablePdb(DebugDirectoryEntry codeViewEntry, string peImageDirectory, Func< string, Stream > pdbFileStreamProvider, out MetadataReaderProvider provider, out string pdbPath, ref Exception errorToReport)
Definition PEReader.cs:435
static ExceptionDispatchInfo Capture(Exception source)

References System.Reflection.Throw.ArgumentNull(), System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture(), System.collection, System.Reflection.PortableExecutable.DebugDirectoryEntry.DataSize, System.IO.Path.GetDirectoryName(), System.Reflection.PortableExecutable.DebugDirectoryEntry.IsPortableCodeView, System.Exception.Message, System.Reflection.PortableExecutable.PEReader.ReadDebugDirectory(), System.Reflection.PortableExecutable.PEReader.TryOpenCodeViewPortablePdb(), System.Reflection.PortableExecutable.PEReader.TryOpenEmbeddedPortablePdb(), and System.Reflection.PortableExecutable.DebugDirectoryEntry.Type.