1 write to State
Microsoft.CodeAnalysis.Workspaces (1)
Workspace\Solution\Project.cs (1)
42State = projectState;
190 references to State
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (2)
EditorConfigSettings\Updater\SettingsUpdaterTests.cs (1)
54var documentId = solution.Projects.Single().State.AnalyzerConfigDocumentStates.Ids.First();
Workspaces\WorkspaceTests_EditorFeatures.cs (1)
1094Assert.Equal(1, project.State.AnalyzerConfigDocumentStates.Count);
Microsoft.CodeAnalysis.EditorFeatures (2)
EditAndContinue\EditAndContinueLanguageService.cs (1)
376return new ProjectInstanceId(project.FilePath!, project.State.NameAndFlavor.flavor ?? "");
EditorConfigSettings\DataProvider\SettingsProviderBase.cs (1)
63var configFileDirectoryOptions = project.State.GetAnalyzerOptionsForPath(givenFolder.FullName, CancellationToken.None);
Microsoft.CodeAnalysis.Features (59)
DesignerAttribute\DesignerAttributeDiscoveryService.cs (1)
245var filePath = project.State.DocumentStates.GetRequiredState(documentId).FilePath;
Diagnostics\Service\DocumentAnalysisExecutor_Helpers.cs (1)
66if (!project.State.RunAnalyzers || globalOptions.GetBackgroundAnalysisScope(project.Language) == BackgroundAnalysisScope.None)
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer.CompilationManager.cs (1)
38var projectState = project.State;
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer.cs (1)
49=> _stateManager.GetOrCreateAnalyzersAsync(project.Solution.SolutionState, project.State, cancellationToken);
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnostics.cs (3)
65solution.SolutionState, project.State, cancellationToken).ConfigureAwait(false); 67solution.SolutionState, project.State, cancellationToken).ConfigureAwait(false); 121if (s_projectToForceAnalysisData.TryGetValue(project.State, out var box) &&
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnosticsForSpan.cs (3)
64.GetOrCreateAnalyzersAsync(solutionState, project.State, cancellationToken) 68var hostAnalyzerInfo = await _stateManager.GetOrCreateHostAnalyzerInfoAsync(solutionState, project.State, cancellationToken).ConfigureAwait(false); 227var hostAnalyzerInfo = await _stateManager.GetOrCreateHostAnalyzerInfoAsync(solutionState, project.State, cancellationToken).ConfigureAwait(false);
Diagnostics\Service\EngineV2\DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs (1)
40var projectState = project.State;
Diagnostics\Service\EngineV2\InProcOrRemoteHostAnalyzerRunner.cs (1)
101var skippedAnalyzersInfo = project.Solution.SolutionState.Analyzers.GetSkippedAnalyzersInfo(project.State, AnalyzerInfoCache);
EditAndContinue\DebuggingSession.cs (2)
513EditSession.Telemetry.LogRudeEditDiagnostics(analysis.RudeEdits, project.State.Attributes.TelemetryId); 626_editSessionTelemetry.LogUpdatedBaseline(solution.GetRequiredProject(projectId).State.ProjectInfo.Attributes.TelemetryId);
EditAndContinue\EditAndContinueService.cs (2)
152? solution.Projects.Select(project => (project, project.State.DocumentStates.States.Values)) 188select (project, from documentId in projectDocumentIds select project.State.DocumentStates.GetState(documentId));
EditAndContinue\EditSession.cs (34)
341if (oldProject.State == newProject.State) 351foreach (var documentId in newProject.State.DocumentStates.GetChangedStateIds(oldProject.State.DocumentStates, ignoreUnchangedContent: true)) 372foreach (var documentId in newProject.State.DocumentStates.GetAddedStateIds(oldProject.State.DocumentStates)) 388foreach (var documentId in newProject.State.DocumentStates.GetRemovedStateIds(oldProject.State.DocumentStates)) 415foreach (var documentId in newProject.State.AdditionalDocumentStates.GetChangedStateIds(oldProject.State.AdditionalDocumentStates, ignoreUnchangedContent: true)) 424foreach (var documentId in newProject.State.AnalyzerConfigDocumentStates.GetChangedStateIds(oldProject.State.AnalyzerConfigDocumentStates, ignoreUnchangedContent: true)) 433if (newProject.State.AdditionalDocumentStates.GetRemovedStateIds(oldProject.State.AdditionalDocumentStates).Any() || 434newProject.State.AdditionalDocumentStates.GetAddedStateIds(oldProject.State.AdditionalDocumentStates).Any() || 435newProject.State.AnalyzerConfigDocumentStates.GetRemovedStateIds(oldProject.State.AnalyzerConfigDocumentStates).Any() || 436newProject.State.AnalyzerConfigDocumentStates.GetAddedStateIds(oldProject.State.AnalyzerConfigDocumentStates).Any()) 549var generatorDiagnostics = await project.Solution.CompilationState.GetSourceGeneratorDiagnosticsAsync(project.State, cancellationToken).ConfigureAwait(false); 561return await project.Solution.CompilationState.GetSourceGeneratedDocumentStatesAsync(project.State, cancellationToken).ConfigureAwait(false); 571if (!newProject.SupportsEditAndContinue() || oldProject.State == newProject.State) 576foreach (var documentId in newProject.State.DocumentStates.GetChangedStateIds(oldProject.State.DocumentStates, ignoreUnchangedContent: true)) 589if (!newProject.State.DocumentStates.HasAnyStateChanges(oldProject.State.DocumentStates) && 590!newProject.State.AdditionalDocumentStates.HasAnyStateChanges(oldProject.State.AdditionalDocumentStates) && 591!newProject.State.AnalyzerConfigDocumentStates.HasAnyStateChanges(oldProject.State.AnalyzerConfigDocumentStates)) 1167Telemetry.LogRudeEditDiagnostics(analysis.RudeEdits, newProject.State.Attributes.TelemetryId); 1360Telemetry.LogProjectAnalysisSummary(projectSummaryToReport, newProject.State.ProjectInfo.Attributes.TelemetryId, projectDiagnostics);
EditAndContinue\RunningProjectOptions.cs (1)
54if (runningProjectsByPathAndTfm.TryGetValue((project.FilePath, project.State.NameAndFlavor.flavor), out var restartAutomatically))
EditAndContinue\Utilities\Extensions.cs (1)
78? $"'{project.FilePath}'" + (project.State.NameAndFlavor.flavor is { } flavor ? $" ('{flavor}')" : "")
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.cs (2)
448oldProject.State.RunAnalyzers != newProject.State.RunAnalyzers)
ExternalAccess\Watch\Api\WatchHotReloadService.cs (1)
192=> project.State.NameAndFlavor.flavor;
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (2)
215var projectState = document.Project.State; 573? definition.SourceSpans[0].Document.Project.State
NavigateTo\RoslynNavigateToItem.cs (2)
144var (firstProjectName, firstProjectFlavor) = firstProject.State.NameAndFlavor; 159var (projectName, projectFlavor) = additionalProject.State.NameAndFlavor;
Microsoft.CodeAnalysis.Features.UnitTests (6)
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (4)
2423var generatedDocuments = await project.Solution.CompilationState.GetSourceGeneratedDocumentStatesAsync(project.State, CancellationToken.None); 2429var generatorDiagnostics = await solution.CompilationState.GetSourceGeneratorDiagnosticsAsync(project.State, CancellationToken.None); 2460generatedDocuments = await solution.CompilationState.GetSourceGeneratedDocumentStatesAsync(project.State, CancellationToken.None); 2463generatorDiagnostics = await solution.CompilationState.GetSourceGeneratorDiagnosticsAsync(project.State, CancellationToken.None);
EditAndContinue\WatchHotReloadServiceTests.cs (2)
195var generatedDocuments = await project.Solution.CompilationState.GetSourceGeneratedDocumentStatesAsync(project.State, CancellationToken.None); 201var generatorDiagnostics = await solution.CompilationState.GetSourceGeneratorDiagnosticsAsync(project.State, CancellationToken.None);
Microsoft.CodeAnalysis.LanguageServer (1)
LanguageServer\Handler\DebugConfiguration\WorkspaceDebugConfigurationHandler.cs (1)
56var (_, flavor) = project.State.NameAndFlavor;
Microsoft.CodeAnalysis.LanguageServer.Protocol (2)
Extensions\ProtocolConversions.cs (1)
839IsMiscellaneous = project.Solution.WorkspaceKind == WorkspaceKind.MiscellaneousFiles && !project.State.HasAllInformation,
Handler\SpellCheck\SpellCheckPullCache.cs (1)
24var parseOptionsChecksum = project.State.GetParseOptionsChecksum();
Microsoft.CodeAnalysis.Remote.ServiceHub (8)
Host\RemoteWorkspace.SolutionCreator.cs (1)
346project.State.ProjectInfo.Attributes.FixUpCompilationOptions(
Host\TestUtils.cs (3)
176var projectStateChecksums = await project.State.GetStateChecksumsAsync(cancellationToken).ConfigureAwait(false); 233var projectChecksums = await project.State.GetStateChecksumsAsync(cancellationToken).ConfigureAwait(false); 234await projectChecksums.FindAsync(project.State, AssetPath.FullLookupForTesting, Flatten(projectChecksums), callback, map, cancellationToken).ConfigureAwait(false);
Services\DiagnosticAnalyzer\DiagnosticComputer.cs (2)
166_project.State, _analyzerInfoCache); 425return project.State.HasSdkCodeStyleAnalyzers && reference.IsFeaturesAnalyzer();
Services\SourceGeneration\RemoteSourceGenerationService.cs (2)
39project.State, withFrozenSourceGeneratedDocuments, cancellationToken).ConfigureAwait(false); 59project.State, withFrozenSourceGeneratedDocuments, cancellationToken).ConfigureAwait(false);
Microsoft.CodeAnalysis.Remote.Workspaces (1)
EditAndContinue\ManagedHotReloadLanguageService.cs (1)
297return new ProjectInstanceId(project.FilePath!, project.State.NameAndFlavor.flavor ?? "");
Microsoft.CodeAnalysis.Workspaces (81)
Diagnostics\Extensions.cs (1)
492var projectChecksum = await project.State.GetChecksumAsync(cancellationToken).ConfigureAwait(false);
FindSymbols\FindReferences\DependentTypeFinder_ProjectIndex.cs (6)
48if (!s_projectToIndex.TryGetValue(project.State, out var tuple) || 57s_projectToIndex.Remove(project.State); 60_ = s_projectToIndex.GetValue(project.State, _ => tuple); 79var regularDocumentStates = project.State.DocumentStates; 80var sourceGeneratorDocumentStates = await project.Solution.CompilationState.GetSourceGeneratedDocumentStatesAsync(project.State, cancellationToken).ConfigureAwait(false); 91solutionKey, project.State, document, cancellationToken).ConfigureAwait(false);
FindSymbols\Shared\AbstractSyntaxIndex_Persistence.cs (1)
148document.Project.State,
FindSymbols\SymbolTree\SymbolTreeInfo_Source.cs (1)
74project.State,
FindSymbols\SyntaxTree\SyntaxTreeIndex.cs (3)
39=> GetRequiredIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, cancellationToken); 45=> GetIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, cancellationToken); 51=> GetIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, loadOnly, cancellationToken);
FindSymbols\TopLevelSyntaxTree\TopLevelSyntaxTreeIndex.cs (3)
47=> GetRequiredIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, cancellationToken); 53=> GetIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, cancellationToken); 59=> GetIndexAsync(SolutionKey.ToSolutionKey(document.Project.Solution), document.Project.State, (DocumentState)document.State, loadOnly, cancellationToken);
Workspace\Host\PersistentStorage\ProjectKey.cs (1)
35=> ToProjectKey(project.Solution.SolutionState, project.State);
Workspace\ProjectSystem\ProjectSystemProject.cs (1)
719projectBeforeMutation.State, path, properties, projectUpdateState, solutionChanges.Solution, out var projectReference);
Workspace\Solution\Document.cs (1)
615var provider = (ProjectState.ProjectHostAnalyzerConfigOptionsProvider)Project.State.HostAnalyzerOptions.AnalyzerConfigOptionsProvider;
Workspace\Solution\Project.cs (41)
56public ProjectId Id => State.Id; 61public string? FilePath => State.FilePath; 66public string? OutputFilePath => State.OutputFilePath; 71public string? OutputRefFilePath => State.OutputRefFilePath; 76public CompilationOutputInfo CompilationOutputInfo => State.CompilationOutputInfo; 89public string? DefaultNamespace => State.DefaultNamespace; 104public HostLanguageServices LanguageServices => State.LanguageServices.HostLanguageServices; 111public LanguageServices Services => State.LanguageServices; 116public string Language => State.Language; 121public string AssemblyName => State.AssemblyName; 126public string Name => State.Name; 131public IReadOnlyList<MetadataReference> MetadataReferences => State.MetadataReferences; 136public IEnumerable<ProjectReference> ProjectReferences => State.ProjectReferences.Where(pr => this.Solution.ContainsProject(pr.ProjectId)); 142public IReadOnlyList<ProjectReference> AllProjectReferences => State.ProjectReferences; 147public IReadOnlyList<AnalyzerReference> AnalyzerReferences => State.AnalyzerReferences; 152public AnalyzerOptions AnalyzerOptions => State.ProjectAnalyzerOptions; 157public AnalyzerOptions HostAnalyzerOptions => State.HostAnalyzerOptions; 162public CompilationOptions? CompilationOptions => State.CompilationOptions; 167public ParseOptions? ParseOptions => State.ParseOptions; 172public bool IsSubmission => State.IsSubmission; 177public bool HasDocuments => !State.DocumentStates.IsEmpty; 182public IReadOnlyList<DocumentId> DocumentIds => State.DocumentStates.Ids; 187public IReadOnlyList<DocumentId> AdditionalDocumentIds => State.AdditionalDocumentStates.Ids; 192internal IReadOnlyList<DocumentId> AnalyzerConfigDocumentIds => State.AnalyzerConfigDocumentStates.Ids; 214=> State.DocumentStates.Contains(documentId); 220=> State.AdditionalDocumentStates.Contains(documentId); 226=> State.AnalyzerConfigDocumentStates.Contains(documentId); 318var generatedDocumentStates = await Solution.CompilationState.GetSourceGeneratedDocumentStatesAsync(this.State, cancellationToken).ConfigureAwait(false); 350var generatedDocumentStates = await Solution.CompilationState.GetSourceGeneratedDocumentStatesAsync(State, cancellationToken).ConfigureAwait(false); 394return Solution.CompilationState.GetSourceGeneratorDiagnosticsAsync(this.State, cancellationToken); 399return Solution.CompilationState.GetSourceGeneratorRunResultAsync(this.State, cancellationToken); 497(documentId, project) => project.State.DocumentStates.TryGetState(documentId, out var state) ? new Document(project, state) : null; 500(documentId, project) => project.State.AdditionalDocumentStates.TryGetState(documentId, out var state) ? new AdditionalDocument(project, state) : null; 503(documentId, project) => project.State.AnalyzerConfigDocumentStates.TryGetState(documentId, out var state) ? new AnalyzerConfigDocument(project, state) : null; 525=> Solution.CompilationState.GetCompilationAsync(State, cancellationToken); 532=> Solution.CompilationState.HasSuccessfullyLoadedAsync(State, cancellationToken); 550public VersionStamp Version => State.Version; 556=> State.GetLatestDocumentVersionAsync(cancellationToken); 576=> State.GetSemanticVersionAsync(cancellationToken); 825=> State.GetAnalyzerConfigOptions(); 838var documentId = await State.GetDocumentIdAsync(contentHash, cancellationToken).ConfigureAwait(false);
Workspace\Solution\ProjectChanges.cs (18)
100=> NewProject.State.DocumentStates.GetAddedStateIds(OldProject.State.DocumentStates); 106=> NewProject.State.AdditionalDocumentStates.GetAddedStateIds(OldProject.State.AdditionalDocumentStates); 112=> NewProject.State.AnalyzerConfigDocumentStates.GetAddedStateIds(OldProject.State.AnalyzerConfigDocumentStates); 130=> NewProject.State.DocumentStates.GetChangedStateIds(OldProject.State.DocumentStates, onlyGetDocumentsWithTextChanges, ignoreUnchangeableDocuments); 137=> NewProject.State.AdditionalDocumentStates.GetChangedStateIds(OldProject.State.AdditionalDocumentStates); 144=> NewProject.State.AnalyzerConfigDocumentStates.GetChangedStateIds(OldProject.State.AnalyzerConfigDocumentStates); 150=> NewProject.State.DocumentStates.GetRemovedStateIds(OldProject.State.DocumentStates); 156=> NewProject.State.AdditionalDocumentStates.GetRemovedStateIds(OldProject.State.AdditionalDocumentStates); 162=> NewProject.State.AnalyzerConfigDocumentStates.GetRemovedStateIds(OldProject.State.AnalyzerConfigDocumentStates);
Workspace\Workspace.cs (4)
1785var document = projectChanges.OldProject.State.DocumentStates.GetState(documentId) ?? 1786projectChanges.NewProject.State.DocumentStates.GetState(documentId)!; 2057project.State.Attributes.With(version: VersionStamp.Create()), 2066hostObjectType: project.State.HostObjectType);
Microsoft.CodeAnalysis.Workspaces.MSBuild (1)
MSBuild\ProjectMap.cs (1)
78AddProjectInfo(project.State.ProjectInfo);
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (2)
VisualStudioMSBuildWorkspaceTests.cs (2)
287Assert.Equal(SourceHashAlgorithm.Sha1, project.State.ChecksumAlgorithm); 305Assert.Equal(SourceHashAlgorithms.Default, project.State.ChecksumAlgorithm);
Microsoft.CodeAnalysis.Workspaces.UnitTests (4)
SolutionTests\SolutionTests.cs (4)
1588s => s.GetRequiredProject(projectId).State.ChecksumAlgorithm, 2333var sourcePathOptions = project2.State.GetAnalyzerOptionsForPath(Path.Combine(s_projectDir, "x.cs"), CancellationToken.None); 2344sourcePathOptions = project2.State.GetAnalyzerOptionsForPath(Path.Combine(s_projectDir, "subfolder", "x.cs"), CancellationToken.None); 5574var documentOptionsViaSyntaxTree = document.Project.State.ProjectAnalyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(syntaxTree);
Microsoft.VisualStudio.LanguageServices (5)
Diagnostics\VisualStudioDiagnosticAnalyzerService.cs (3)
179static (otherProject, project) => otherProject.FilePath == project.FilePath && otherProject.State.NameAndFlavor.name == project.State.NameAndFlavor.name, 187: projectsToAnalyze.Length == 1 ? project.Name : project.State.NameAndFlavor.name ?? project.Name;
FindReferences\StreamingFindUsagesPresenter.cs (1)
281var (projectName, _) = document.Project.State.NameAndFlavor;
ProjectSystem\VisualStudioWorkspaceImpl.RemoveAnalyzerConfigDocumentUndoUnit.cs (1)
22=> fromProject.State.AnalyzerConfigDocumentStates.Ids;
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (4)
ProjectSystemShim\CPS\AdditionalPropertiesTests.cs (2)
132Assert.Equal(expectedRunAnalyzers, environment.Workspace.CurrentSolution.Projects.Single().State.RunAnalyzers); 152Assert.Equal(expectedRunAnalyzers, environment.Workspace.CurrentSolution.Projects.Single().State.RunAnalyzers);
ProjectSystemShim\CPS\CSharpCompilerOptionsTests.cs (2)
183Assert.Equal(SourceHashAlgorithms.Default, environment.Workspace.CurrentSolution.Projects.Single().State.ChecksumAlgorithm); 187Assert.Equal(SourceHashAlgorithm.Sha1, environment.Workspace.CurrentSolution.Projects.Single().State.ChecksumAlgorithm);
Roslyn.VisualStudio.Next.UnitTests (12)
Remote\SnapshotSerializationTests.cs (3)
187var firstProjectChecksum = await solution.GetProject(solution.ProjectIds[0]).State.GetChecksumAsync(CancellationToken.None); 188var secondProjectChecksum = await solution.GetProject(solution.ProjectIds[1]).State.GetChecksumAsync(CancellationToken.None); 552var checksum = await project.State.GetChecksumAsync(CancellationToken.None);
Services\AssetProviderTests.cs (4)
127await project.State.GetChecksumAsync(CancellationToken.None); 140allProjectChecksums.Add(await project.State.GetStateChecksumsAsync(CancellationToken.None)); 156await project.State.GetChecksumAsync(CancellationToken.None); 169var stateChecksums = await project.State.GetStateChecksumsAsync(CancellationToken.None);
Services\ServiceHubServicesTests.cs (2)
1684Assert.Equal(projectStateShouldSame, object.ReferenceEquals(solution1.GetProject(currentProjectId).State, solution2.GetProject(currentProjectId).State));
Services\SolutionServiceTests.cs (3)
277Assert.Equal(SourceHashAlgorithm.Sha1 + version, project.State.ChecksumAlgorithm); 278Assert.Equal((version % 2) != 0, project.State.HasAllInformation); 279Assert.Equal((version % 2) != 0, project.State.RunAnalyzers);