diff options
Diffstat (limited to 'src/SMAPI/Framework')
-rw-r--r-- | src/SMAPI/Framework/ModLoading/AssemblyLoader.cs | 13 |
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 { |