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

View File

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