Skip to content

Commit

Permalink
Limitation of of assemblies to be loaded for compilation to only thos…
Browse files Browse the repository at this point in the history
…e, which aren't in AssemblyLoadContexts, which aren't unloaded. (#253)
  • Loading branch information
GerardCieciwa authored Sep 11, 2023
1 parent 7538ea5 commit 731854f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/UiPath.Workflow.Runtime/Expressions/AssemblyReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Loader;

namespace System.Activities.Expressions;

Expand Down Expand Up @@ -148,7 +149,7 @@ internal static Assembly GetAssembly(AssemblyName assemblyName)
// as Xaml would do. that is to find the first match
// found starting from the end of the array of Assemblies
// returned by AppDomain.GetAssemblies()
Assembly[] currentAssemblies = AppDomain.CurrentDomain.GetAssemblies();
Assembly[] currentAssemblies = AssemblyLoadContext.All.SelectMany(c=>c.Assemblies).ToArray();

// For collectible assemblies, we need to ensure that they
// are not cached, but are usable in expressions.
Expand All @@ -164,7 +165,7 @@ internal static Assembly GetAssembly(AssemblyName assemblyName)
continue;
}

if (curAsm.IsDynamic || curAsm.IsCollectible)
if (curAsm.IsDynamic)
{
// ignore dynamic assemblies
continue;
Expand Down

0 comments on commit 731854f

Please sign in to comment.