private static async Task <DfirRoot> GenerateDfirAsync(
            ICompositionHost host,
            Envoy documentEnvoy,
            ProgressToken progressToken,
            CompileCancellationToken compileCancellationToken)
        {
            ExtendedQualifiedName topLevelDocumentName = documentEnvoy.CreateExtendedQualifiedName();
            TargetCompiler        targetCompiler       = documentEnvoy.QueryInheritedService <ITargetCompilerServices>().First().Compiler;
            AnyMocCompiler        compiler             = host.GetSharedExportedValue <AnyMocCompiler>();
            IReadOnlySymbolTable  symbolTable          = documentEnvoy.ComputeSymbolTable();

            // A specAndQName is used by the compiler to identify the document for which we're asking for DFIR.
            var specAndQName = new SpecAndQName(targetCompiler.CreateDefaultBuildSpec(topLevelDocumentName, symbolTable), topLevelDocumentName);

            try
            {
                DfirRoot sourceDfirRoot = await compiler.GetTargetDfirAsync(specAndQName, compileCancellationToken, progressToken);

                if (sourceDfirRoot == null)
                {
                    await ShowErrorMessageBoxAsync(host, WaitForCompileErrorMessageBoxText);
                }

                return(sourceDfirRoot);
            }
            catch
            {
                await ShowErrorMessageBoxAsync(host, DfirGenerationErrorMessageBoxText);

                return(null);
            }
        }