diff options
author | author <email@service.domain> | 2021-06-03 17:00:26 +0300 |
---|---|---|
committer | author <email@service.domain> | 2021-06-03 17:00:26 +0300 |
commit | 11ec2ea4b79e42c5571c17d85a0f8446698f9698 (patch) | |
tree | dfa18593ffa6de35f53489d1feedb769bf5e2a88 | |
parent | 32bac30b6187bfea96711cd924fcf32e40f08937 (diff) |
[Mac] Do not register reflection-only assemblies with registrar.
Reflection-only assemblies do not support having code executed, and
dependencies cannot be resolved by the dynamic registrar without the
AppDomain.ReflectionOnlyAssemblyResolve being used to resolve the
assemblies.
-rw-r--r-- | Xwt.XamMac/Xwt.Mac/NSApplicationInitializer.cs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Xwt.XamMac/Xwt.Mac/NSApplicationInitializer.cs b/Xwt.XamMac/Xwt.Mac/NSApplicationInitializer.cs index f8ee7c04..915d2a07 100644 --- a/Xwt.XamMac/Xwt.Mac/NSApplicationInitializer.cs +++ b/Xwt.XamMac/Xwt.Mac/NSApplicationInitializer.cs @@ -69,10 +69,18 @@ namespace Xwt.Mac { try { + if (args.LoadedAssembly.ReflectionOnly) + { + // Ignore. Code cannot be executed from reflection only assemblies. They will also fail + // to be loaded by Xamarin.Mac's DynamicRegistrar when it calls assembly.GetTypes() without an + // AppDomain.ReflectionOnlyAssemblyResolve event handler resolve the dependencies. + return; + } Runtime.RegisterAssembly(args.LoadedAssembly); - } catch (Exception e) + } + catch (Exception e) { - Console.Error.WriteLine("Error during static registrar initialization load", e); + Console.Error.WriteLine("Error during static registrar initialization load {0}", e); } } } |