Skip to content

A Swiss Army knife for developers.

Revert "Added support of per-extension assembly isolation (#1431)" (#1449)

Etienne Baudoux453ffd1b342a
diff --git a/src/app/dev/DevToys.Core/Mef/AssemblyIsolation.cs b/src/app/dev/DevToys.Core/Mef/AssemblyIsolation.cs
deleted file mode 100644
index d60460223..000000000
--- a/src/app/dev/DevToys.Core/Mef/AssemblyIsolation.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System.Reflection;
-using System.Runtime.Loader;
-
-namespace DevToys.Core.Mef;
-
-// See https://learn.microsoft.com/en-us/dotnet/core/dependency-loading/understanding-assemblyloadcontext
-internal sealed class AssemblyIsolation : AssemblyLoadContext
-{
- private readonly AssemblyDependencyResolver _resolver;
-
- internal AssemblyIsolation(string entryPointAssemblyPath)
- {
- _resolver = new AssemblyDependencyResolver(entryPointAssemblyPath);
- }
-
- protected override Assembly? Load(AssemblyName assemblyName)
- {
- string? assemblyPath = _resolver.ResolveAssemblyToPath(assemblyName);
- if (assemblyPath != null)
- {
- return LoadFromAssemblyPath(assemblyPath);
- }
-
- return null;
- }
-}
diff --git a/src/app/dev/DevToys.Core/Mef/RecursiveDirectoryCatalog.cs b/src/app/dev/DevToys.Core/Mef/RecursiveDirectoryCatalog.cs
index 222698670..2fe1eb7c3 100644
--- a/src/app/dev/DevToys.Core/Mef/RecursiveDirectoryCatalog.cs
+++ b/src/app/dev/DevToys.Core/Mef/RecursiveDirectoryCatalog.cs
@@ -14,7 +14,6 @@ internal sealed partial class RecursiveDirectoryCatalog : ComposablePartCatalog,
{
private readonly ILogger _logger;
private readonly string _path;
- private AssemblyIsolation? _assemblyIsolation;
private AggregateCatalog? _aggregateCatalog;
/// <summary>
@@ -123,13 +122,7 @@ internal sealed partial class RecursiveDirectoryCatalog : ComposablePartCatalog,
try
{
AssemblyCount++;
-
- // Create an isolation context for the plugin.
- // This allows to load dependencies version that the plugin asks, even if DevToys uses a different version of that same dependency.
- _assemblyIsolation ??= new AssemblyIsolation(filePath);
-
- Assembly assembly = _assemblyIsolation.LoadFromAssemblyPath(filePath);
- var asmCat = new AssemblyCatalog(assembly);
+ var asmCat = new AssemblyCatalog(filePath);
// Force MEF to load the plugin and figure out if there are any exports
// good assemblies will not throw the RTLE exception and can be added to the catalog