1 instantiation of ProjectState
Microsoft.CodeAnalysis.Workspaces (1)
Workspace\Solution\SolutionState.cs (1)
366var newProject = new ProjectState(languageServices, projectInfo, fallbackAnalyzerOptions);
218 references to ProjectState
Microsoft.CodeAnalysis.Features (1)
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (1)
215var projectState = document.Project.State;
Microsoft.CodeAnalysis.LanguageServer.Protocol (1)
Handler\SpellCheck\AbstractSpellCheckingHandler.cs (1)
31/// cref="ProjectState.GetParseOptionsChecksum"/> and <see cref="DocumentStateChecksums.Text"/>
Microsoft.CodeAnalysis.Workspaces (215)
FindSymbols\FindReferences\DependentTypeFinder_ProjectIndex.cs (1)
24private static readonly ConditionalWeakTable<ProjectState, AsyncLazy<ProjectIndex>> s_projectToIndex = new();
FindSymbols\Shared\AbstractSyntaxIndex.cs (6)
19protected delegate TIndex IndexCreator(ProjectState project, SyntaxNode root, Checksum checksum, CancellationToken cancellationToken); 30SolutionKey solutionKey, ProjectState project, DocumentState document, IndexReader read, IndexCreator create, CancellationToken cancellationToken) 37protected static ValueTask<TIndex?> GetIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, IndexReader read, IndexCreator create, CancellationToken cancellationToken) 43ProjectState project, 81ProjectState project, 115ProjectState project,
FindSymbols\Shared\AbstractSyntaxIndex_Persistence.cs (4)
39ProjectState project, 93ProjectState project, 135ProjectState project, 156ProjectState project,
FindSymbols\SymbolTree\SymbolTreeInfo_Source.cs (2)
68private static readonly ConditionalWeakTable<ProjectState, AsyncLazy<Checksum>> s_projectToSourceChecksum = new(); 81private static async Task<Checksum> ComputeSourceSymbolsChecksumAsync(ProjectState projectState, CancellationToken cancellationToken)
FindSymbols\SyntaxTree\SyntaxTreeIndex.cs (3)
41public static ValueTask<SyntaxTreeIndex> GetRequiredIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, CancellationToken cancellationToken) 47public static ValueTask<SyntaxTreeIndex?> GetIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, CancellationToken cancellationToken) 53public static ValueTask<SyntaxTreeIndex?> GetIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, bool loadOnly, CancellationToken cancellationToken)
FindSymbols\SyntaxTree\SyntaxTreeIndex_Create.cs (3)
38private static readonly ConditionalWeakTable<ProjectState, StringTable> s_projectStringTable = new(); 41ProjectState project, SyntaxNode root, Checksum checksum, CancellationToken _) 330public static StringTable GetStringTable(ProjectState project)
FindSymbols\TopLevelSyntaxTree\IDeclaredSymbolInfoFactoryService.cs (1)
16void AddDeclaredSymbolInfos(ProjectState project, SyntaxNode root, ArrayBuilder<DeclaredSymbolInfo> declaredSymbolInfos, Dictionary<string, ArrayBuilder<int>> extensionMethodInfo, CancellationToken cancellationToken);
FindSymbols\TopLevelSyntaxTree\TopLevelSyntaxTreeIndex.cs (3)
49public static ValueTask<TopLevelSyntaxTreeIndex> GetRequiredIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, CancellationToken cancellationToken) 55public static ValueTask<TopLevelSyntaxTreeIndex?> GetIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, CancellationToken cancellationToken) 61public static ValueTask<TopLevelSyntaxTreeIndex?> GetIndexAsync(SolutionKey solutionKey, ProjectState project, DocumentState document, bool loadOnly, CancellationToken cancellationToken)
FindSymbols\TopLevelSyntaxTree\TopLevelSyntaxTreeIndex_Create.cs (1)
16ProjectState project, SyntaxNode root, Checksum checksum, CancellationToken cancellationToken)
LanguageServices\DeclaredSymbolFactoryService\AbstractDeclaredSymbolInfoFactoryService.cs (1)
153ProjectState project,
Workspace\Host\PersistentStorage\ProjectKey.cs (2)
37public static ProjectKey ToProjectKey(SolutionState solutionState, ProjectState projectState) 40public static ProjectKey ToProjectKey(SolutionKey solutionKey, ProjectState projectState)
Workspace\ProjectSystem\ProjectSystemProject.cs (1)
300var projectState = solution.SolutionState.GetRequiredProjectState(projectId);
Workspace\ProjectSystem\ProjectSystemProjectFactory.cs (2)
596var projectWithMetadataReference = solution.GetProjectState(projectIdWithMetadataReference); 597var referencedProject = solution.GetProjectState(referencedProjectId);
Workspace\Solution\Document.cs (1)
560var provider = (ProjectState.ProjectAnalyzerConfigOptionsProvider)Project.State.AnalyzerOptions.AnalyzerConfigOptionsProvider;
Workspace\Solution\Project.cs (2)
34internal Project(Solution solution, ProjectState projectState) 43internal ProjectState State { get; }
Workspace\Solution\ProjectState.AnalyzerConfigOptionsCache.cs (1)
19/// This cache is stored on <see cref="ProjectState"/> and needs to be invalidated whenever <see cref="SolutionState.FallbackAnalyzerOptions"/> for the language of the project change,
Workspace\Solution\ProjectState.cs (36)
335internal sealed class ProjectAnalyzerConfigOptionsProvider(ProjectState projectState) : AnalyzerConfigOptionsProvider 581private ProjectState With( 607private ProjectState WithNewerAttributes(ProjectInfo.ProjectAttributes attributes) 615public ProjectState WithName(string name) 618public ProjectState WithFilePath(string? filePath) 621public ProjectState WithAssemblyName(string assemblyName) 624public ProjectState WithOutputFilePath(string? outputFilePath) 627public ProjectState WithOutputRefFilePath(string? outputRefFilePath) 630public ProjectState WithCompilationOutputInfo(in CompilationOutputInfo info) 633public ProjectState WithDefaultNamespace(string? defaultNamespace) 636public ProjectState WithHasAllInformation(bool hasAllInformation) 639public ProjectState WithRunAnalyzers(bool runAnalyzers) 642public ProjectState WithChecksumAlgorithm(SourceHashAlgorithm checksumAlgorithm) 657public ProjectState WithCompilationOptions(CompilationOptions? options) 675public ProjectState WithParseOptions(ParseOptions? options) 697public ProjectState WithFallbackAnalyzerOptions(StructuredAnalyzerConfigOptions options) 707public static bool IsSameLanguage(ProjectState project1, ProjectState project2) 726public ProjectState WithProjectReferences(IReadOnlyList<ProjectReference> projectReferences) 736public ProjectState WithMetadataReferences(IReadOnlyList<MetadataReference> metadataReferences) 746public ProjectState WithAnalyzerReferences(IEnumerable<AnalyzerReference> analyzerReferences) 756public ProjectState AddDocuments(ImmutableArray<DocumentState> documents) 768public ProjectState AddAdditionalDocuments(ImmutableArray<AdditionalDocumentState> documents) 780public ProjectState AddAnalyzerConfigDocuments(ImmutableArray<AnalyzerConfigDocumentState> documents) 792private ProjectState CreateNewStateForChangedAnalyzerConfig(TextDocumentStates<AnalyzerConfigDocumentState> newAnalyzerConfigDocumentStates, StructuredAnalyzerConfigOptions fallbackOptions) 811public ProjectState RemoveDocuments(ImmutableArray<DocumentId> documentIds) 824public ProjectState RemoveAdditionalDocuments(ImmutableArray<DocumentId> documentIds) 834public ProjectState RemoveAnalyzerConfigDocuments(ImmutableArray<DocumentId> documentIds) 844public ProjectState RemoveAllNormalDocuments() 857public ProjectState UpdateDocument(DocumentState newDocument) 860public ProjectState UpdateDocuments(ImmutableArray<DocumentState> oldDocuments, ImmutableArray<DocumentState> newDocuments) 883public ProjectState UpdateAdditionalDocument(AdditionalDocumentState newDocument) 886public ProjectState UpdateAdditionalDocuments(ImmutableArray<AdditionalDocumentState> oldDocuments, ImmutableArray<AdditionalDocumentState> newDocuments) 908public ProjectState UpdateAnalyzerConfigDocument(AnalyzerConfigDocumentState newDocument) 911public ProjectState UpdateAnalyzerConfigDocuments(ImmutableArray<AnalyzerConfigDocumentState> oldDocuments, ImmutableArray<AnalyzerConfigDocumentState> newDocuments) 918public ProjectState UpdateDocumentsOrder(ImmutableList<DocumentId> documentIds)
Workspace\Solution\Solution.cs (15)
86internal ProjectState? GetProjectState(ProjectId projectId) => this.SolutionState.GetProjectState(projectId); 155var state = solution.SolutionState.GetProjectState(projectId); 637var oldProject = GetRequiredProjectState(projectId); 729var oldProject = GetRequiredProjectState(projectId); 814var oldProject = GetRequiredProjectState(projectId); 901private static SourceCodeKind GetSourceCodeKind(ProjectState project) 916var project = GetRequiredProjectState(documentId.ProjectId); 937var project = GetRequiredProjectState(documentId.ProjectId); 956var project = GetRequiredProjectState(documentId.ProjectId); 963private Solution AddDocumentImpl(ProjectState project, DocumentId documentId, string name, SourceText text, IReadOnlyList<string>? folders, string? filePath, bool isGenerated) 988var project = GetRequiredProjectState(documentId.ProjectId); 1081var project = GetRequiredProjectState(documentId.ProjectId); 1094internal ProjectState GetRequiredProjectState(ProjectId projectId) 1819var projectState = this.SolutionState.GetRequiredProjectState(projectId); 1827var referencedProjectState = this.SolutionState.GetProjectState(projectReference.ProjectId);
Workspace\Solution\SolutionChanges.cs (2)
40var newState = _newSolution.GetProjectState(id); 41var oldState = old.GetProjectState(id);
Workspace\Solution\SolutionCompilationState.cs (26)
36/// about the solution structure. Specifically, the set of green <see cref="ProjectState"/>s, with all their 180var newProjectState = stateChange.NewProjectState; 555var oldProject = SolutionState.GetRequiredProjectState(projectId); 590var oldProjectState = SolutionState.GetRequiredProjectState(projectId); 818var oldProjectState = SolutionState.GetRequiredProjectState(projectId); 843Func<ProjectState, ImmutableArray<TDocumentState>, TranslationAction> getTranslationAction) 877private static TranslationAction GetUpdateDocumentsTranslationAction<TDocumentState>(ProjectState oldProjectState, ImmutableArray<TDocumentState> newDocumentStates) 888TranslationAction GetUpdateOrdinaryDocumentsTranslationAction(ProjectState oldProjectState, ImmutableArray<DocumentState> newDocumentStates) 895TranslationAction GetUpdateAdditionalDocumentsTranslationAction(ProjectState oldProjectState, ImmutableArray<AdditionalDocumentState> newDocumentStates) 902TranslationAction GetUpdateAnalyzerConfigDocumentsTranslationAction(ProjectState oldProjectState, ImmutableArray<AnalyzerConfigDocumentState> newDocumentStates) 1102var projectState = solution.GetProjectState(projectId); 1149/// Returns the compilation for the specified <see cref="ProjectState"/>. Can return <see langword="null"/> when the project 1155public Task<Compilation?> GetCompilationAsync(ProjectState project, CancellationToken cancellationToken) 1165public Task<bool> HasSuccessfullyLoadedAsync(ProjectState project, CancellationToken cancellationToken) 1177public ValueTask<TextDocumentStates<SourceGeneratedDocumentState>> GetSourceGeneratedDocumentStatesAsync(ProjectState project, CancellationToken cancellationToken) 1180/// <inheritdoc cref="GetSourceGeneratedDocumentStatesAsync(ProjectState, CancellationToken)"/> 1182ProjectState project, bool withFrozenSourceGeneratedDocuments, CancellationToken cancellationToken) 1190ProjectState project, CancellationToken cancellationToken) 1198ProjectState project, CancellationToken cancellationToken) 1226ICompilationTracker tracker, ProjectState fromProject, ProjectReference projectReference, bool includeCrossLanguage, CancellationToken cancellationToken) 1260ProjectReference projectReference, ProjectState fromProject, bool includeCrossLanguage, CancellationToken cancellationToken) 1613var oldProjectState = currentState.SolutionState.GetRequiredProjectState(documentId.ProjectId); 1658var projectState = SolutionState.GetRequiredProjectState(projectId); 1691var oldProjectState = SolutionState.GetRequiredProjectState(projectId); 1715private static TranslationAction GetRemoveDocumentsTranslationAction<TDocumentState>(ProjectState oldProject, ImmutableArray<DocumentId> documentIds, ImmutableArray<TDocumentState> states) 1724private static TranslationAction GetAddDocumentsTranslationAction<TDocumentState>(ProjectState oldProject, ImmutableArray<TDocumentState> states)
Workspace\Solution\SolutionCompilationState.ICompilationTracker.cs (2)
16ProjectState ProjectState { get; } 38ICompilationTracker Fork(ProjectState newProject, TranslationAction? translate);
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker.cs (13)
32private static readonly Func<ProjectState, string> s_logBuildCompilationAsync = 37public ProjectState ProjectState { get; } 59ProjectState project, 79public RegularCompilationTracker(ProjectState project) 125ProjectState newProjectState, 495var referencedProject = compilationState.SolutionState.GetProjectState(projectReference.ProjectId); 812var frozenProjectState = inProgressState.PendingTranslationActions.IsEmpty 931var projectState = inProgressState.PendingTranslationActions is [var translationAction, ..] 948private static void ValidateCompilationTreesMatchesProjectState(Compilation compilation, ProjectState projectState, CompilationTrackerGeneratorInfo? generatorInfo) 1033var projectState = this.ProjectState; 1072var projectState = this.ProjectState; 1123var depProject = solution.GetRequiredProjectState(id); 1129var referencedProject = solution.GetRequiredProjectState(projectId);
Workspace\Solution\SolutionCompilationState.RegularCompilationTracker_Generators.cs (2)
391static GeneratorDriver CreateGeneratorDriver(ProjectState projectState) 404static void CheckGeneratorDriver(GeneratorDriver generatorDriver, ProjectState projectState)
Workspace\Solution\SolutionCompilationState.SkeletonReferenceCache.cs (2)
43/// cref="ProjectState"/>, causing it to see a view of the world inapplicable to its current snapshot. A downside 115/// Produces a copy of the <see cref="SkeletonReferenceCache"/>, allowing forks of <see cref="ProjectState"/> to
Workspace\Solution\SolutionCompilationState.SymbolToProjectId.cs (1)
24var projectState = this.SolutionState.GetProjectState(documentId.ProjectId);
Workspace\Solution\SolutionCompilationState.TranslationAction.cs (4)
21public readonly ProjectState OldProjectState; 26public readonly ProjectState NewProjectState; 28protected TranslationAction(ProjectState oldProjectState, ProjectState newProjectState)
Workspace\Solution\SolutionCompilationState.TranslationAction_Actions.cs (6)
22ProjectState oldProjectState, 23ProjectState newProjectState, 70ProjectState oldProjectState, 71ProjectState newProjectState, 112ProjectState oldProjectState, 113ProjectState newProjectState)
Workspace\Solution\SolutionCompilationState.WithFrozenSourceGeneratedDocumentsCompilationTracker.cs (2)
41public ProjectState ProjectState => UnderlyingTracker.ProjectState; 76public ICompilationTracker Fork(ProjectState newProject, TranslationAction? translate)
Workspace\Solution\SolutionCompilationState_SourceGenerators.cs (9)
34/// of analyzer references (see <see cref="ProjectState.AnalyzerReferences"/>) to all the <see 39private static readonly ConditionalWeakTable<ProjectState, SourceGeneratorMap> s_projectStateToSourceGeneratorsMap = new(); 56private static ImmutableArray<ISourceGenerator> GetSourceGenerators(ProjectState projectState) 65private static AnalyzerReference GetAnalyzerReference(ProjectState projectState, ISourceGenerator sourceGenerator) 79private static SourceGeneratorMap? GetSourceGeneratorMap(ProjectState projectState) 86static SourceGeneratorMap ComputeSourceGenerators(ProjectState projectState) 106var projectState = this.SolutionState.GetRequiredProjectState(projectId); 122AsyncLazy<bool> GetLazy(AnalyzerReferenceMap analyzerReferenceMap, ProjectState projectState) 129SolutionCompilationState solution, ProjectState projectState, CancellationToken cancellationToken)
Workspace\Solution\SolutionState.cs (58)
25ProjectState OldProjectState, 26ProjectState NewProjectState); 73ImmutableDictionary<ProjectId, ProjectState> idToProjectStateMap, 119idToProjectStateMap: ImmutableDictionary<ProjectId, ProjectState>.Empty, 129public ImmutableDictionary<ProjectId, ProjectState> ProjectStates { get; } 172ImmutableDictionary<ProjectId, ProjectState>? idToProjectStateMap = null, 254foreach (var project in this.ProjectStates.Values) 310public ProjectState? GetProjectState(ProjectId projectId) 311=> ProjectStates.TryGetValue(projectId, out var state) ? state : null; 313public ProjectState GetRequiredProjectState(ProjectId projectId) 315var result = GetProjectState(projectId); 332using var _ = ArrayBuilder<ProjectState>.GetInstance(projectInfos.Count, out var projectStates); 338ProjectState CreateProjectState(ProjectInfo projectInfo) 366var newProject = new ProjectState(languageServices, projectInfo, fallbackAnalyzerOptions); 370SolutionState AddProjects(ArrayBuilder<ProjectState> projectStates) 381foreach (var projectState in projectStates) 393foreach (var projectState in projectStates) 511var oldProject = GetRequiredProjectState(projectId); 527var oldProject = GetRequiredProjectState(projectId); 543var oldProject = GetRequiredProjectState(projectId); 559var oldProject = GetRequiredProjectState(projectId); 575var oldProject = GetRequiredProjectState(projectId); 591var oldProject = GetRequiredProjectState(projectId); 607var oldProject = GetRequiredProjectState(projectId); 623var oldProject = GetRequiredProjectState(projectId); 640var oldProject = GetRequiredProjectState(projectId); 657var oldProject = GetRequiredProjectState(projectId); 674var oldProject = GetRequiredProjectState(projectId); 692var oldProject = GetRequiredProjectState(projectId); 710var oldProject = GetRequiredProjectState(projectId); 731var oldProject = GetRequiredProjectState(projectId); 771var oldProject = GetRequiredProjectState(projectId); 788var oldProject = GetRequiredProjectState(projectId); 819var oldProject = GetRequiredProjectState(projectId); 837var oldProject = GetRequiredProjectState(projectId); 854var oldProject = GetRequiredProjectState(projectId); 870var oldProject = GetRequiredProjectState(projectId); 888var oldProject = GetRequiredProjectState(projectId); 905var oldProject = GetRequiredProjectState(projectId); 957var oldProject = GetRequiredProjectState(documentId.ProjectId); 973var oldProject = GetRequiredProjectState(documentId.ProjectId); 985var oldProject = GetRequiredProjectState(newDocument.Id.ProjectId); 1001var oldProject = GetRequiredProjectState(documentId.ProjectId); 1017var oldProject = GetRequiredProjectState(documentId.ProjectId); 1033var oldProject = GetRequiredProjectState(documentId.ProjectId); 1049var oldProject = GetRequiredProjectState(documentId.ProjectId); 1065var oldProject = GetRequiredProjectState(documentId.ProjectId); 1081var oldProject = GetRequiredProjectState(documentId.ProjectId); 1125var oldProject = GetRequiredProjectState(newDocument.Id.ProjectId); 1138var oldProject = GetRequiredProjectState(newDocument.Id.ProjectId); 1149var oldProject = GetRequiredProjectState(newDocument.Id.ProjectId); 1165ProjectState oldProjectState, 1166ProjectState newProjectState, 1210ImmutableDictionary<ProjectId, ProjectState> projectStates) 1261var projectState = this.GetProjectState(documentId.ProjectId); 1286var relatedProject = relatedProjectIdHint is null ? null : this.ProjectStates[relatedProjectIdHint]; 1312var projectState = this.GetProjectState(documentId.ProjectId); 1337var projectState = args.solution.GetProjectState(documentId.ProjectId);
Workspace\Solution\SolutionState_Checksum.cs (2)
121var projectState = this.ProjectStates[orderedProjectId]; 173var projectState = this.GetProjectState(projectConeId);
Workspace\Solution\StateChecksums.cs (1)
317var projectState = solution.GetProjectState(assetPath.ProjectId);
Microsoft.VisualStudio.LanguageServices (1)
Progression\GraphBuilder.cs (1)
88var projectState = _solution.GetProjectState(docIdWithPath.ProjectId);