public async ValueTask <IAssembly> LoadProjectAsync( ProjectInfo projectInfo, AssemblyLoadContext assemblyLoadContext, IEnumerable <IAssembly> alreadyLoadedProjects, CancellationToken cancellationToken = default) { var dependencies = await _dependencyLoader.LoadDependenciesAsync( projectInfo, assemblyLoadContext, alreadyLoadedProjects, cancellationToken); ImmutableArray <IDocument> documents; try { var includedFilePaths = projectInfo .IncludedFilesAndFolders .Select(x => ( path: NormalizePath(x), isDirectory: IsDirectory(x) )) .SelectMany <(string path, bool isDirectory), string>(x => { if (x.isDirectory) { return(_fileSystem.Directory.GetFiles(x.path, "*.fl", SearchOption.AllDirectories)); } return(new[] { x.path }); }) .Distinct(); var excludedFilesAndFolders = projectInfo .ExcludedFilesAndFolders .Select(x => ( path: NormalizePath(x), isDirectory: IsDirectory(x) )).ToList(); documents = await includedFilePaths .Where(x => excludedFilesAndFolders.All(y => !IsOrContains(y.path, x))) .ToAsyncEnumerable() .SelectAwait(x => new ValueTask <string>(_fileSystem.File.ReadAllTextAsync(x, cancellationToken))) .Select(x => DocumentFactory.FromString(x)) .ToImmutableArrayAsync(); } catch (IOException e) { throw new FlcException($"failed to load included files and folders for {projectInfo.Name}", e); } return(_assemblyFactory.FromSource( QualifiedName.Parse(projectInfo.Name), (projectInfo.Version.Major, projectInfo.Version.Minor, projectInfo.Version.Suffix), dependencies, documents)); }