Example #1
0
        private void RunScriptCore(byte[] inMemoryAssembly, byte[] inMemorySymbolStore, TextWriter outputTextWriter, TextWriter errorTextWriter)
        {
            RemoteScriptRun scriptRun;

            lock (fieldsLock)
            {
                if (inMemoryAssembly != loadedAssembly)
                {
                    if (scriptAppDomain != null)
                    {
                        AppDomain.Unload(scriptAppDomain);
                    }
                    scriptAppDomain = AppDomain.CreateDomain("ScriptAppDomain");
                    remoteScriptRun = (RemoteScriptRun)scriptAppDomain.CreateInstanceAndUnwrap(typeof(RemoteScriptRun).Assembly.FullName, typeof(RemoteScriptRun).FullName);
                    remoteScriptRun.Load(inMemoryAssembly, inMemorySymbolStore, outputTextWriter, errorTextWriter);
                    loadedAssembly = inMemoryAssembly;
                }
                scriptRun = remoteScriptRun;
            }

            try
            {
                scriptRun?.Run();
            }
            catch (AppDomainUnloadedException)
            {
            }
        }
Example #2
0
 private void RunScriptCore(byte[] inMemoryAssembly, byte[] inMemorySymbolStore, TextWriter outputTextWriter, TextWriter errorTextWriter)
 {
     RemoteScriptRun scriptRun;
     lock (fieldsLock)
     {
         if (inMemoryAssembly != loadedAssembly)
         {
             if (scriptAppDomain != null)
             {
                 AppDomain.Unload(scriptAppDomain);
             }
             scriptAppDomain = AppDomain.CreateDomain("ScriptAppDomain");
             remoteScriptRun = (RemoteScriptRun)scriptAppDomain.CreateInstanceAndUnwrap(typeof(RemoteScriptRun).Assembly.FullName, typeof(RemoteScriptRun).FullName);
             remoteScriptRun.Load(inMemoryAssembly, inMemorySymbolStore, outputTextWriter, errorTextWriter);
             loadedAssembly = inMemoryAssembly;
         }
         scriptRun = remoteScriptRun;
     }
     
     try
     {
         scriptRun?.Run();
     }
     catch (AppDomainUnloadedException)
     {
     }
 }
Example #3
0
 private void StopScriptCore()
 {
     lock (fieldsLock)
     {
         if (scriptAppDomain != null)
         {
             AppDomain.Unload(scriptAppDomain);
             scriptAppDomain = null;
             loadedAssembly  = null;
             remoteScriptRun = null;
         }
     }
 }
Example #4
0
 private void StopScriptCore()
 {
     lock (fieldsLock)
     {
         if (scriptAppDomain != null)
         {
             AppDomain.Unload(scriptAppDomain);
             scriptAppDomain = null;
             loadedAssembly = null;
             remoteScriptRun = null;
         }
     }
 }