summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/SMAPI/Framework/ModLoading/MySymbolReader.cs55
-rw-r--r--src/SMAPI/Framework/ModLoading/SymbolReaderProvider.cs4
2 files changed, 57 insertions, 2 deletions
diff --git a/src/SMAPI/Framework/ModLoading/MySymbolReader.cs b/src/SMAPI/Framework/ModLoading/MySymbolReader.cs
new file mode 100644
index 00000000..215631c6
--- /dev/null
+++ b/src/SMAPI/Framework/ModLoading/MySymbolReader.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Mono.Cecil;
+using Mono.Cecil.Cil;
+using Mono.Cecil.Pdb;
+
+namespace StardewModdingAPI.Framework.ModLoading
+{
+ internal class MySymbolReader : ISymbolReader
+ {
+ private ModuleDefinition Module;
+ private Stream Stream;
+ private ISymbolReader Using;
+
+ public MySymbolReader( ModuleDefinition module, Stream stream )
+ {
+ this.Module = module;
+ this.Stream = stream;
+ this.Using = new NativePdbReaderProvider().GetSymbolReader( module, stream );
+ }
+
+ public void Dispose()
+ {
+ this.Using.Dispose();
+ }
+
+ public ISymbolWriterProvider GetWriterProvider()
+ {
+ return new PortablePdbWriterProvider();
+ }
+
+ public bool ProcessDebugHeader( ImageDebugHeader header )
+ {
+ try
+ {
+ return this.Using.ProcessDebugHeader( header );
+ }
+ catch (Exception e)
+ {
+ this.Using.Dispose();
+ this.Using = new PortablePdbReaderProvider().GetSymbolReader( this.Module, this.Stream );
+ return this.Using.ProcessDebugHeader( header );
+ }
+ }
+
+ public MethodDebugInformation Read( MethodDefinition method )
+ {
+ return Using.Read( method );
+ }
+ }
+}
diff --git a/src/SMAPI/Framework/ModLoading/SymbolReaderProvider.cs b/src/SMAPI/Framework/ModLoading/SymbolReaderProvider.cs
index a651c167..c92e1e4d 100644
--- a/src/SMAPI/Framework/ModLoading/SymbolReaderProvider.cs
+++ b/src/SMAPI/Framework/ModLoading/SymbolReaderProvider.cs
@@ -21,7 +21,7 @@ namespace StardewModdingAPI.Framework.ModLoading
public ISymbolReader GetSymbolReader( ModuleDefinition module, string fileName )
{
if ( this.SymbolMapping.ContainsKey( module.Name ) )
- return new NativePdbReaderProvider().GetSymbolReader( module, this.SymbolMapping[ module.Name ] );
+ return new MySymbolReader( module, this.SymbolMapping[ module.Name ] );
return this.BaseProvider.GetSymbolReader( module, fileName );
}
@@ -29,7 +29,7 @@ namespace StardewModdingAPI.Framework.ModLoading
public ISymbolReader GetSymbolReader( ModuleDefinition module, Stream symbolStream )
{
if ( this.SymbolMapping.ContainsKey( module.Name ) )
- return new PortablePdbReaderProvider().GetSymbolReader( module, this.SymbolMapping[ module.Name ] );
+ return new MySymbolReader( module, this.SymbolMapping[ module.Name ] );
return this.BaseProvider.GetSymbolReader( module, symbolStream );
}