Skip to content

Commit

Permalink
load pdb file if available for linenumbers in stacktrace (#204)
Browse files Browse the repository at this point in the history
* Update ManagedLoadContext.cs

load pdb file if available

if we want linenumbers in the stacktrace of a exception/Environment.StackTrace or StackTrace,GetFrame,... we have load the pdb files

changed method DotNetCorePlugins\src\Plugins\Loader\ManagedLoadContext.cs LoadAssemblyFromFilePath:187

other changed style changes not importent

* Update ManagedLoadContext.cs

Fix whitespace .. hope
  • Loading branch information
sf8321 committed May 26, 2021
1 parent 11cdc4d commit 5be3e0c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Plugins/Loader/ManagedLoadContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,14 @@ public Assembly LoadAssemblyFromFilePath(string path)
}

using var file = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read);
var pdbPath = Path.ChangeExtension(path, ".pdb");
if (File.Exists(pdbPath))
{
using var pdbFile = File.Open(pdbPath, FileMode.Open, FileAccess.Read, FileShare.Read);
return LoadFromStream(file, pdbFile);
}
return LoadFromStream(file);

}

/// <summary>
Expand Down

0 comments on commit 5be3e0c

Please sign in to comment.