Skip to content

Commit

Permalink
#1324 Delay initial TypeCache initialization call to first time types…
Browse files Browse the repository at this point in the history
… are actually required
  • Loading branch information
GeertvanHorrik committed May 17, 2019
1 parent 1d9614c commit f0053dc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Catel.Core/Helpers/HttpContextHelper.cs
Expand Up @@ -57,4 +57,4 @@ public static object GetHttpApplicationInstance()
}
}

#endif
#endif
12 changes: 1 addition & 11 deletions src/Catel.Core/Reflection/TypeCache.cs
Expand Up @@ -100,16 +100,6 @@ static TypeCache()
{
#if NET || NETCORE || NETSTANDARD
AppDomain.CurrentDomain.AssemblyLoad += OnAssemblyLoaded;

// Initialize the types of early loaded assemblies
lock (_lockObject)
{
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (var assembly in assemblies)
{
InitializeTypes(assembly);
}
}
#endif
}

Expand Down Expand Up @@ -604,7 +594,7 @@ private static Type[] GetTypesPrefilteredByAssembly(Assembly assembly, Func<Type
/// <param name="forceFullInitialization">If <c>true</c>, the types are initialized, even when the types are already initialized.</param>
/// <param name="allowMultithreadedInitialization">If <c>true</c>, allow multithreaded initialization.</param>
/// <exception cref="ArgumentException">The <paramref name="assemblyName"/> is <c>null</c> or whitespace.</exception>
public static void InitializeTypes(string assemblyName, bool forceFullInitialization, bool allowMultithreadedInitialization = true)
public static void InitializeTypes(string assemblyName, bool forceFullInitialization, bool allowMultithreadedInitialization = false)
{
// Important note: only allow explicit multithreaded initialization

Expand Down

0 comments on commit f0053dc

Please sign in to comment.