From 5f1c76b285d8ee5e0b44a9020757124940fbd2c8 Mon Sep 17 00:00:00 2001 From: adelikat Date: Thu, 31 Oct 2019 20:52:50 -0500 Subject: [PATCH] Revert "ReflectionTypeLoadException troubleshooting." This reverts commit e15e32eb78965f10cbfc7212f320cbe1e90917fe. --- BizHawk.Client.EmuHawk/tools/ToolManager.cs | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/ToolManager.cs b/BizHawk.Client.EmuHawk/tools/ToolManager.cs index 0fa81dc2e4..9a382d2d11 100644 --- a/BizHawk.Client.EmuHawk/tools/ToolManager.cs +++ b/BizHawk.Client.EmuHawk/tools/ToolManager.cs @@ -739,26 +739,17 @@ namespace BizHawk.Client.EmuHawk } } - private static readonly Lazy> _lazyAsmTypes = new Lazy>(() => - new HashSet(GetAssemblyTypes().Select(t => t.AssemblyQualifiedName)) + private static readonly Lazy> lazyAsmTypes = new Lazy>(() => + Assembly.ReflectionOnlyLoadFrom(Assembly.GetExecutingAssembly().Location) + .GetTypes() + .Select(t => t.AssemblyQualifiedName) + .ToList() ); - private static Type[] GetAssemblyTypes() - { - try - { - return Assembly.ReflectionOnlyLoadFrom(Assembly.GetExecutingAssembly().Location).GetTypes(); - } - catch (ReflectionTypeLoadException ex) - { - throw new AggregateException(ex.LoaderExceptions); - } - } - public bool IsAvailable(Type tool) { if (!ServiceInjector.IsAvailable(Global.Emulator.ServiceProvider, tool) - || !_lazyAsmTypes.Value.Contains(tool.AssemblyQualifiedName) // not a tool + || !lazyAsmTypes.Value.Contains(tool.AssemblyQualifiedName) // not a tool || (tool == typeof(LuaConsole) && OSTailoredCode.CurrentOS != OSTailoredCode.DistinctOS.Windows)) // simply doesn't work (for now) { return false;