Skip to content

Instantly share code, notes, and snippets.

@mandel-macaque
Created November 13, 2017 23:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mandel-macaque/71c42add065d2cf2083a8b9c8e1d06b2 to your computer and use it in GitHub Desktop.
Save mandel-macaque/71c42add065d2cf2083a8b9c8e1d06b2 to your computer and use it in GitHub Desktop.
commit 91ded43b0b13025f4d6583e4571f1af002517348
Author: Chris Hamons <chris.hamons@xamarin.com>
Date: Mon Oct 23 12:52:14 2017 -0500
[macos] Fix pdb mismatch when saving assemblies processed by mmp (#2901)
- https://bugzilla.xamarin.com/show_bug.cgi?id=60277
- Teach mmp and mtouch resolver to always ask for symbol reading from Cecil
- In most cases we explicitly load symbols (LoadReferencesStep) but when we don't rewritten assemblies don't match their pdb and we break debugging.
diff --git a/tools/mmp/resolver.cs b/tools/mmp/resolver.cs
index 482df81b..a3691d8f 100644
--- a/tools/mmp/resolver.cs
+++ b/tools/mmp/resolver.cs
@@ -28,6 +28,7 @@ using System.Linq;
using System.Security.Cryptography;
using Mono.Cecil;
+using Mono.Cecil.Cil;
namespace Xamarin.Bundler {
public partial class MonoMacResolver : IAssemblyResolver {
@@ -72,7 +73,9 @@ namespace Xamarin.Bundler {
assembly = AssemblyDefinition.ReadAssembly (fileName, new ReaderParameters
{
AssemblyResolver = this,
- InMemory = new FileInfo (fileName).Length < 1024 * 1024 * 100 // 100 MB
+ InMemory = new FileInfo (fileName).Length < 1024 * 1024 * 100, // 100 MB
+ ReadSymbols = true,
+ SymbolReaderProvider = new DefaultSymbolReaderProvider (throwIfNoSymbol: false)
});
cache.Add (name, assembly);
return assembly;
diff --git a/tools/mtouch/AssemblyResolver.cs b/tools/mtouch/AssemblyResolver.cs
index 4050068a..b1e1f929 100644
--- a/tools/mtouch/AssemblyResolver.cs
+++ b/tools/mtouch/AssemblyResolver.cs
@@ -16,6 +16,7 @@ using System.IO;
using System.Linq;
using Mono.Cecil;
+using Mono.Cecil.Cil;
using Mono.Tuner;
using Xamarin.Bundler;
@@ -70,6 +71,8 @@ namespace MonoTouch.Tuner {
var parameters = new ReaderParameters ();
parameters.AssemblyResolver = this;
parameters.InMemory = new FileInfo (path).Length < 1024 * 1024 * 100; // 100 MB.
+ parameters.ReadSymbols = true;
+ parameters.SymbolReaderProvider = new DefaultSymbolReaderProvider (throwIfNoSymbol: false);
return parameters;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment