Esempio n. 1
0
        private static void UnloadMainContext(bool threaded = true)
        {
            if (!mainContextRef.IsInvalid)
            {
                try
                {
                    AssemblyUnloader unloader = new AssemblyUnloader(entryPointType, unloadMethod, mainContextRef);
                    mainContextRef.DoCallBack(unloader.Unload);
                }
                catch (Exception e)
                {
                    MessageBox("HotReload Unload failed for \"" + mainAssemblyPath + "\" " +
                               Environment.NewLine + Environment.NewLine + e, unloadErrorMsgBoxTitle);
                }

                Runtime.AssemblyContextRef oldContextRef = mainContextRef;
                mainContextRef = Runtime.AssemblyContextRef.Invalid;

                UnloadContext(oldContextRef, threaded);
            }
        }
Esempio n. 2
0
        private static void UnloadAppDomain()
        {
            if (appDomain != null)
            {
                try
                {
                    AssemblyUnloader unloader = new AssemblyUnloader(entryPointType, unloadMethod);
                    appDomain.DoCallBack(unloader.Unload);
                    hotreloadData = appDomain.GetData(hotReloadDataName) as byte[];
                    appDomain.SetData(hotReloadDataName, null);
                }
                catch (Exception e)
                {
                    MessageBox.Show("HotReload Unload failed for \"" + assemblyPath + "\" " +
                                    Environment.NewLine + Environment.NewLine + e, unloadErrorMsgBoxTitle);
                }

                AppDomain oldAppDomain = appDomain;
                appDomain = null;

                UnloadAppDomain(oldAppDomain);
            }
        }