ReflectionTypeLoadException troubleshooting.
This commit is contained in:
parent
7d554f06d3
commit
e15e32eb78
|
@ -739,17 +739,26 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly Lazy<List<string>> lazyAsmTypes = new Lazy<List<string>>(() =>
|
private static readonly Lazy<HashSet<string>> _lazyAsmTypes = new Lazy<HashSet<string>>(() =>
|
||||||
Assembly.ReflectionOnlyLoadFrom(Assembly.GetExecutingAssembly().Location)
|
new HashSet<string>(GetAssemblyTypes().Select(t => t.AssemblyQualifiedName))
|
||||||
.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)
|
public bool IsAvailable(Type tool)
|
||||||
{
|
{
|
||||||
if (!ServiceInjector.IsAvailable(Global.Emulator.ServiceProvider, 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)
|
|| (tool == typeof(LuaConsole) && OSTailoredCode.CurrentOS != OSTailoredCode.DistinctOS.Windows)) // simply doesn't work (for now)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue