fix in LoadAssembly

This commit is contained in:
Ivan Bondarev 2023-01-03 17:59:03 +01:00
parent 7f73d91024
commit 88323a0675

View file

@ -360,7 +360,7 @@ namespace PascalABCCompiler.NetHelper
return false;
}
public static Assembly LoadAssembly(string name)
public static Assembly LoadAssembly(string name, bool use_load_from = false)
{
if (name == null) return null;
Assembly a = ass_name_cache[name] as Assembly;
@ -415,8 +415,10 @@ namespace PascalABCCompiler.NetHelper
fs.Read(buf, 0, (int)fs.Length);
fs.Close();
curr_inited_assm_path = name;
a = System.Reflection.Assembly.Load(buf);
if (!use_load_from)
a = System.Reflection.Assembly.Load(buf);
else
a = System.Reflection.Assembly.LoadFrom(name);
a.GetTypes();
buf = null;
//Thread th = new Thread(new ThreadStart(collect_internal));
@ -944,7 +946,7 @@ namespace PascalABCCompiler.NetHelper
if (!System.IO.File.Exists(path))
path = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), args.Name.Substring(0, args.Name.IndexOf(",")) + ".dll");
if (System.IO.File.Exists(path))
assm = LoadAssembly(path);
assm = LoadAssembly(path, true);
curr_inited_assm_path = null;
//return LoadAssembly(args.Name);