Closed ArgoZhang closed 6 months ago
@ArgoZhang Thank you for filing this issue. In order for us to investigate this issue, please provide a minimalistic repro project that illustrates the problem.
private void Test()
{
GetName();
GetName();
}
private void GetName()
{
try
{
var folder = @"Plugins\Test";
//新建插件域,并注明可卸载
assemblyLoadContext = new AssemblyLoadContext(folder, true);
var assembly = GetAssembly(@"Plugins\Test\Test.dll", assemblyLoadContext);
var driverType = assembly.GetTypes().FirstOrDefault(x => typeof(ITestClass).IsAssignableFrom(x));
System.Console.WriteLine(driverType.GUID.ToString());
var driver = (ITestClass)Activator.CreateInstance(driverType)!;
var name = Utility.GetPropertyValue(driver, nameof(ITestClass.Name));
System.Console.WriteLine(name);
assemblyLoadContext.Unload();
}
catch (Exception ex)
{
System.Console.WriteLine(ex);
}
}
Is there an existing issue for this?
Describe the bug
unable to dynamically load DLL multiple times
Expected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
No response
Anything else?
No response