Esempio n. 1
0
 public async Task Unload(WeakReference testAlcWeakRef, CheckModuleLoadContext alc)
 {
     alc.Unload();
     alc = null;
     await Task.Run(() =>
     {
         for (int i = 0; testAlcWeakRef.IsAlive && (i < 15); i++)
         {
             GC.Collect();
             GC.WaitForPendingFinalizers();
         }
     });
 }
Esempio n. 2
0
        public async Task <bool> ReloadActions()
        {
            if (Actions.Count != 0)
            {
                Actions.Clear();
                await _manager.Unload(_weakReference, _loadContext);
            }
            var result = await ModuleGovernor.BuildModule(GetComponentName());

            ModuleGovernor.AllowBuild();
            if (result)
            {
                _loadContext = new CheckModuleLoadContext();
                FillActions();
            }
            return(result);
        }
Esempio n. 3
0
 public Assembly Execute(out WeakReference testAlcWeakRef, out CheckModuleLoadContext alc, string pathToAssembly)
 {
     alc            = new CheckModuleLoadContext();
     testAlcWeakRef = new WeakReference(alc);
     return(alc.LoadFromAssemblyPath(pathToAssembly));;
 }