/// <nodoc />
        public FrontEndConfiguration(IFrontEndConfiguration template, PathRemapper pathRemapper)
        {
            Contract.Requires(template != null);
            Contract.Assume(pathRemapper != null);

            ProfileScript               = template.ProfileScript;
            ProfileReportDestination    = pathRemapper.Remap(template.ProfileReportDestination);
            FileToFileReportDestination = pathRemapper.Remap(template.FileToFileReportDestination);

            EnableIncrementalFrontEnd  = template.EnableIncrementalFrontEnd;
            EnableEvaluationThrottling = template.EnableEvaluationThrottling;
            DebugScript                            = template.DebugScript;
            DebuggerBreakOnExit                    = template.DebuggerBreakOnExit;
            DebuggerPort                           = template.DebuggerPort;
            UsePartialEvaluation                   = template.UsePartialEvaluation;
            EnabledPolicyRules                     = new List <string>(template.EnabledPolicyRules);
            MaxFrontEndConcurrency                 = template.MaxFrontEndConcurrency;
            MaxRestoreNugetConcurrency             = template.MaxRestoreNugetConcurrency;
            ThreadPoolMinThreadCountMultiplier     = template.ThreadPoolMinThreadCountMultiplier;
            MaxTypeCheckingConcurrency             = template.MaxTypeCheckingConcurrency;
            DisableLanguagePolicyAnalysis          = template.DisableLanguagePolicyAnalysis;
            DisableIsObsoleteCheckDuringConversion = template.DisableIsObsoleteCheckDuringConversion;
            NameResolutionSemantics                = template.NameResolutionSemantics;
            PreserveFullNames                      = template.PreserveFullNames;
            DisableCycleDetection                  = template.DisableCycleDetection;
            PreserveTrivia                         = template.PreserveTrivia;
            ErrorLimit = template.ErrorLimit;
            ForcePopulatePackageCache = template.ForcePopulatePackageCache;
            UsePackagesFromFileSystem = template.UsePackagesFromFileSystem;
            RespectWeakFingerprintForNugetUpToDateCheck = template.RespectWeakFingerprintForNugetUpToDateCheck;
            ForceGenerateNuGetSpecs             = template.ForceGenerateNuGetSpecs;
            UseLegacyOfficeLogic                = template.UseLegacyOfficeLogic;
            TrackMethodInvocations              = template.TrackMethodInvocations;
            CycleDetectorStartupDelay           = template.CycleDetectorStartupDelay;
            FailIfWorkspaceMemoryIsNotCollected = template.FailIfWorkspaceMemoryIsNotCollected;
            FailIfFrontendMemoryIsNotCollected  = template.FailIfFrontendMemoryIsNotCollected;
            ConstructAndSaveBindingFingerprint  = template.ConstructAndSaveBindingFingerprint;
            UseGraphPatching                       = template.UseGraphPatching;
            CancelParsingOnFirstFailure            = template.CancelParsingOnFirstFailure;
            UseSpecPublicFacadeAndAstWhenAvailable = template.UseSpecPublicFacadeAndAstWhenAvailable;
            CancelEvaluationOnFirstFailure         = template.CancelEvaluationOnFirstFailure;
            ReloadPartialEngineStateWhenPossible   = template.ReloadPartialEngineStateWhenPossible;
            EnableCyclicalFriendModules            = template.EnableCyclicalFriendModules;
            LogStatistics = template.LogStatistics;
            ShowSlowestElementsStatistics    = template.ShowSlowestElementsStatistics;
            ShowLargestFilesStatistics       = template.ShowLargestFilesStatistics;
            ReleaseWorkspaceBeforeEvaluation = template.ReleaseWorkspaceBeforeEvaluation;
            UnsafeOptimizedAstConversion     = template.UnsafeOptimizedAstConversion;
            AllowUnsafeAmbient          = template.AllowUnsafeAmbient;
            GenerateCgManifestForNugets = template.GenerateCgManifestForNugets;
            ValidateCgManifestForNugets = template.ValidateCgManifestForNugets;
            AllowMissingSpecs           = template.AllowMissingSpecs;
        }
        /// <nodoc/>
        public FrontEndArtifactManager(
            FrontEndEngineAbstraction engine,
            string frontEndEngineDirectory,
            Logger logger,
            LoggingContext loggingContext,
            IFrontEndStatistics frontEndStatistics,
            PathTable pathTable,
            IFrontEndConfiguration configuration,
            CancellationToken cancellationToken)
        {
            Contract.Requires(engine != null);
            Contract.Requires(loggingContext != null);
            Contract.Requires(frontEndStatistics != null);
            Contract.Requires(!string.IsNullOrEmpty(frontEndEngineDirectory));
            Contract.Requires(pathTable != null);

            m_engine        = engine;
            m_frontEndCache = new FrontEndCache(frontEndEngineDirectory, logger, loggingContext, frontEndStatistics, pathTable);

            // If engine state changed, delete facade and ast cache, because from one run to another the serialized AST bytes
            // can be different even if corresponding DScript sourced didn't change (reason: PathTable can change in the meantime)
            if (!engine.IsEngineStatePartiallyReloaded())
            {
                FrontEndPublicFacadeAndAstProvider.PurgeCache(frontEndEngineDirectory);
            }

            // If public facades are not used, then we don't create the public facade provider. This avoids
            // creating the public facade cache.
            // In particular, the IDE never uses this optimization, and the cache needs an exclusive lock.
            if (configuration.UseSpecPublicFacadeAndAstWhenAvailable())
            {
                m_publicFacadeAndAstProvider = new FrontEndPublicFacadeAndAstProvider(
                    engine,
                    logger,
                    loggingContext,
                    frontEndEngineDirectory,
                    configuration.LogStatistics,
                    pathTable,
                    frontEndStatistics,
                    cancellationToken);
            }
        }