summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/release-notes.md1
-rw-r--r--src/SMAPI/Framework/ModLoading/AssemblyLoader.cs13
2 files changed, 13 insertions, 1 deletions
diff --git a/docs/release-notes.md b/docs/release-notes.md
index e133a45c..f95a6192 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -19,6 +19,7 @@
* Fixed rewriting generic types to method references.
* Simplified paranoid warnings in the log and reduced their log level.
* Fixed asset propagation for Gil's portraits.
+ * Fixed `.pdb` files ignored for error stack traces for mods rewritten by SMAPI.
* For SMAPI developers:
* When deploying web services to a single-instance app, the MongoDB server can now be replaced with in-memory storage.
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
{