/// <exception cref="ArgumentNullException"><paramref name="assemblyDirectory"/> is <see langword="null" />.</exception>
        public AppDomainIsolation(string assemblyDirectory, string assemblyConfiguration)
        {
            if (string.IsNullOrEmpty(assemblyDirectory))
            {
                throw new ArgumentNullException(nameof(assemblyDirectory));
            }

            using (var transformer = new AssemblyConfigurationFileTransformer())
            {
                var setup = new AppDomainSetup
                {
                    ShadowCopyFiles   = "true",
                    ApplicationBase   = assemblyDirectory,
                    ConfigurationFile = transformer.GetConfigurationPath(assemblyDirectory, assemblyConfiguration)
                };

                Domain = AppDomain.CreateDomain("AppDomainIsolation:" + Guid.NewGuid(), null, setup);
            }

            var type = typeof(T);

            try
            {
                Object = (T)Domain.CreateInstanceAndUnwrap(type.Assembly.FullName, type.FullName);
            }
            catch
            {
                Object = (T)Domain.CreateInstanceFromAndUnwrap(type.Assembly.Location, type.FullName);
            }
        }
        /// <exception cref="ArgumentNullException"><paramref name="assemblyDirectory"/> is <see langword="null" />.</exception>
        public AppDomainIsolation(string assemblyDirectory, string assemblyConfiguration)
        {
            if (string.IsNullOrEmpty(assemblyDirectory))
            {
                throw new ArgumentNullException(nameof(assemblyDirectory));
            }

            var configuration = AssemblyConfigurationFileTransformer.GetConfigurationBytes(assemblyDirectory, assemblyConfiguration);

            var setup = new AppDomainSetup();

            setup.ShadowCopyFiles = "true";
            setup.SetConfigurationBytes(configuration);

            Domain = AppDomain.CreateDomain("AppDomainIsolation:" + Guid.NewGuid(), null, setup);

            var type = typeof(T);

            LoadToolchainAssemblies(type);
            try
            {
                Object = (T)Domain.CreateInstanceAndUnwrap(type.Assembly.FullName, type.FullName);
            }
            catch
            {
                Object = (T)Domain.CreateInstanceFromAndUnwrap(type.Assembly.Location, type.FullName);
            }
        }