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,13 +236,21 @@ public partial class AssemblyManager
if (types.Count > 0) if (types.Count > 0)
return types; return types;
OpsLockLoaded.EnterReadLock();
try
{
// fallback to Type.GetType // fallback to Type.GetType
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
{ {
Type t = assembly.GetType(typeName); Type t = assembly.GetType(typeName, false, false);
if (t is not null) if (t is not null)
types.Add(byRef ? t.MakeByRefType() : t); types.Add(byRef ? t.MakeByRefType() : t);
} }
}
finally
{
OpsLockLoaded.ExitReadLock();
}
return types; return types;