- Fixed ACL name not being shown in warnings.

- Fixed thread lock recursion causing fileloadexceptions.
This commit is contained in:
MapleWheels
2023-10-26 16:25:01 -04:00
parent 2a931142a0
commit e2695db011
3 changed files with 42 additions and 15 deletions
@@ -280,20 +280,33 @@ public class MemoryFileAssemblyContextLoader : AssemblyLoadContext
}
//try resolve against other loaded alcs
foreach (var loadedAcL in _assemblyManager.GetAllLoadedACLs())
ImmutableList<AssemblyManager.LoadedACL> list;
try
{
if (loadedAcL.Acl is null || loadedAcL.Acl.IsTemplateMode || loadedAcL.Acl.IsDisposed)
continue;
list = _assemblyManager.UnsafeGetAllLoadedACLs();
}
catch
{
list = ImmutableList<AssemblyManager.LoadedACL>.Empty;
}
if (!list.IsEmpty)
{
foreach (var loadedAcL in list)
{
if (loadedAcL.Acl is null || loadedAcL.Acl.IsTemplateMode || loadedAcL.Acl.IsDisposed)
continue;
try
{
ass = loadedAcL.Acl.LoadFromAssemblyName(assemblyName);
if (ass is not null)
return ass;
}
catch
{
// LoadFromAssemblyName throws, no need to propagate
try
{
ass = loadedAcL.Acl.LoadFromAssemblyName(assemblyName);
if (ass is not null)
return ass;
}
catch
{
// LoadFromAssemblyName throws, no need to propagate
}
}
}
@@ -315,6 +328,7 @@ public class MemoryFileAssemblyContextLoader : AssemblyLoadContext
CompiledAssembly = null;
CompiledAssemblyImage = null;
_dependencyResolvers.Clear();
_assemblyManager = null;
base.Unloading -= OnUnload;
this.IsDisposed = true;
}