22
22
//
23
23
// History:
24
24
// - 2021/02/21 ([email protected] ): Adjust for hard link to AppDomain.AssemblyLoad
25
+ // - 2021/11/28 ([email protected] ): Disable assembly loading for Uno's as loaded types are never used.
26
+
27
+ // #define SUPPORTS_LOAD_ASSEMBLIES
25
28
26
29
using System ;
27
30
using System . Collections . Generic ;
@@ -74,6 +77,7 @@ public XamlSchemaContext (IEnumerable<Assembly> referenceAssemblies, XamlSchemaC
74
77
75
78
private void RegisterAssemblyLoaded ( )
76
79
{
80
+ #if SUPPORTS_LOAD_ASSEMBLIES
77
81
var that = new WeakReference < XamlSchemaContext > ( this ) ;
78
82
79
83
void Hook ( object o , AssemblyLoadEventArgs e )
@@ -95,12 +99,15 @@ void Hook(object o, AssemblyLoadEventArgs e)
95
99
// Register the Hook method to the AssemblyLoad event, so there's no
96
100
// hard link between "this" and the AssemblyLoad event delegate.
97
101
AppDomain . CurrentDomain . AssemblyLoad += Hook ;
102
+ #endif
98
103
}
99
104
100
105
~ XamlSchemaContext ( )
101
106
{
107
+ #if SUPPORTS_LOAD_ASSEMBLIES
102
108
if ( reference_assemblies == null )
103
109
unhookAssemblyLoad ? . Invoke ( ) ;
110
+ #endif
104
111
}
105
112
106
113
IList < Assembly > reference_assemblies ;
@@ -321,6 +328,7 @@ public virtual bool TryGetCompatibleXamlNamespace (string xamlNamespace, out str
321
328
}
322
329
}
323
330
331
+ #if SUPPORTS_LOAD_ASSEMBLIES
324
332
void OnAssemblyLoaded ( object o , AssemblyLoadEventArgs e )
325
333
{
326
334
if ( reference_assemblies != null )
@@ -335,6 +343,7 @@ void OnAssemblyLoaded (object o, AssemblyLoadEventArgs e)
335
343
if ( all_xaml_types != null )
336
344
FillAllXamlTypes ( e . LoadedAssembly ) ;
337
345
}
346
+ #endif
338
347
339
348
// cache updater methods
340
349
void FillXamlNamespaces ( Assembly ass )
0 commit comments