/// <summary>
        /// Initializes the Roslyn compiler service if it has not yet been initialized.
        /// </summary>
        public void InitializeCompilerService()
        {
            // Check if the compiler is initialized
            if (sharedCompiler == null)
            {
                // Create the compiler
                sharedCompiler = new RoslynCSharpCompiler(true, true, Microsoft.CodeAnalysis.OutputKind.DynamicallyLinkedLibrary, Microsoft.CodeAnalysis.CSharp.LanguageVersion.Default, sandbox);

                // Setup compiler
                ApplyCompilerServiceSettings();
            }
        }
        /// <summary>
        /// Dispose of this domain.
        /// This will cause the target app domain to be unloaded if it is not the default app domain.
        /// The domain will be unusable after disposing.
        /// </summary>
        public void Dispose()
        {
            if (sandbox != null)
            {
                // Unload app domain
                if (sandbox.IsDefaultAppDomain() == false)
                {
                    AppDomain.Unload(sandbox);
                }

                // Remove from active list
                activeDomains.Remove(this);

                lock (this)
                {
                    loadedAssemblies.Clear();
                }

                sandbox        = null;
                sharedCompiler = null;
                securityResult = null;
                compileResult  = null;
            }
        }