[XM] Add the option to ignore missing files during registration (#1709)

Not all assemblies referenced at compile time are necessary
at runtime. Allow XamMac to ignore missing assemblies just
like iOS does.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=51746
This commit is contained in:
Alan McGovern 2017-02-22 15:18:23 +00:00 коммит произвёл Chris Hamons
Родитель af667d1665
Коммит 0963ba1e75
2 изменённых файлов: 9 добавлений и 5 удалений

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

@ -33,6 +33,7 @@ namespace XamCore.AppKit {
public partial class NSApplication : NSResponder {
public static bool CheckForIllegalCrossThreadCalls = true;
public static bool CheckForEventAndDelegateMismatches = true;
public static bool IgnoreMissingAssembliesDuringRegistration = false;
private static Thread mainThread;

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

@ -17,6 +17,10 @@ using System.Runtime.InteropServices;
using XamCore.Foundation;
using XamCore.Registrar;
#if MONOMAC
using XamCore.AppKit;
#endif
#if !COREBUILD && (XAMARIN_APPLETLS || XAMARIN_NO_TLS)
#if !MMP && !MTOUCH && !MTOUCH_TEST
using Mono.Security.Interface;
@ -408,14 +412,13 @@ namespace XamCore.ObjCRuntime {
if (!assemblies.Contains (a))
CollectReferencedAssemblies (assemblies, a);
}
#if MONOMAC
catch {
catch (FileNotFoundException fefe) {
// that's more important for XI because device builds don't go thru this step
// and we can end up with simulator-only failures - bug #29211
throw;
#else
catch (FileNotFoundException fefe) {
NSLog ("Could not find `{0}` referenced by assembly `{1}`.", fefe.FileName, assembly.FullName);
#if MONOMAC
if (!NSApplication.IgnoreMissingAssembliesDuringRegistration)
throw;
#endif
}
}