Added threading controls to AppDomain type search.

This commit is contained in:
MapleWheels
2023-09-22 11:56:12 -04:00
committed by Evil Factory
parent 9bd23efd3c
commit 5e03954afe
@@ -236,12 +236,20 @@ public partial class AssemblyManager
if (types.Count > 0) if (types.Count > 0)
return types; return types;
// fallback to Type.GetType OpsLockLoaded.EnterReadLock();
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) try
{ {
Type t = assembly.GetType(typeName); // fallback to Type.GetType
if (t is not null) foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
types.Add(byRef ? t.MakeByRefType() : t); {
Type t = assembly.GetType(typeName, false, false);
if (t is not null)
types.Add(byRef ? t.MakeByRefType() : t);
}
}
finally
{
OpsLockLoaded.ExitReadLock();
} }
return types; return types;