[mmp] Show more information when a MM2001 error occurs (#1987)

Same that was done for `mtouch` in
https://github.com/xamarin/xamarin-macios/pull/1947
This commit is contained in:
Sebastien Pouliot 2017-04-11 11:06:51 -04:00 коммит произвёл GitHub
Родитель 0a47a8ce0c
Коммит 479394782f
1 изменённых файлов: 16 добавлений и 1 удалений

Просмотреть файл

@ -1,6 +1,7 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Xml.XPath;
using Mono.Linker;
@ -104,7 +105,21 @@ namespace MonoMac.Tuner {
} catch (XmlResolutionException ex) {
throw new MonoMacException (2017, true, ex, "Could not process XML description: {0}", ex?.InnerException?.Message ?? ex.Message);
} catch (Exception e) {
throw new MonoMacException (2001, true, e, "Could not link assemblies. Reason: {0}", e.Message);
var message = new StringBuilder ();
if (e.Data.Count > 0) {
message.AppendLine ();
var m = e.Data ["MethodDefinition"] as string;
if (m != null)
message.AppendLine ($"\tMethod: `{m}`");
var t = e.Data ["TypeReference"] as string;
if (t != null)
message.AppendLine ($"\tType: `{t}`");
var a = e.Data ["AssemblyDefinition"] as string;
if (a != null)
message.AppendLine ($"\tAssembly: `{a}`");
}
message.Append ($"Reason: {e.Message}");
throw new MonoMacException (2001, true, e, "Could not link assemblies. {0}", message);
}
assemblies = ListAssemblies (context);