summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-05-21 21:59:45 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-05-21 21:59:45 -0400
commitf8e0600672952fa211b118df27f359581ee4b1f1 (patch)
treeb656b2f72ef66b02e43eb22fc3bb9e57110d88ae /src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
parent1beee07a3548f4f7efe9d4044ec7a3eb78987f89 (diff)
downloadSMAPI-f8e0600672952fa211b118df27f359581ee4b1f1.tar.gz
SMAPI-f8e0600672952fa211b118df27f359581ee4b1f1.tar.bz2
SMAPI-f8e0600672952fa211b118df27f359581ee4b1f1.zip
load .pdb file when mod is loaded from bytes (#711)
Diffstat (limited to 'src/SMAPI/Framework/ModLoading/AssemblyLoader.cs')
-rw-r--r--src/SMAPI/Framework/ModLoading/AssemblyLoader.cs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs b/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
index 5218938f..eadb2997 100644
--- a/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
+++ b/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
@@ -127,10 +127,21 @@ namespace StardewModdingAPI.Framework.ModLoading
{
if (!oneAssembly)
this.Monitor.Log($" Loading {assembly.File.Name} (rewritten)...", LogLevel.Trace);
+
+ // load PDB file if present
+ byte[] symbols;
+ {
+ string symbolsPath = Path.Combine(Path.GetDirectoryName(assemblyPath), Path.GetFileNameWithoutExtension(assemblyPath)) + ".pdb";
+ symbols = File.Exists(symbolsPath)
+ ? File.ReadAllBytes(symbolsPath)
+ : null;
+ }
+
+ // load assembly
using MemoryStream outStream = new MemoryStream();
assembly.Definition.Write(outStream);
byte[] bytes = outStream.ToArray();
- lastAssembly = Assembly.Load(bytes);
+ lastAssembly = Assembly.Load(bytes, symbols);
}
else
{