628 references to Id
AnalyzerRunner (3)
CodeRefactoringRunner.cs (1)
105if (projectChanges.Length != 1 || projectChanges[0].ProjectId != document.Project.Id)
DiagnosticAnalyzerRunner.cs (2)
130projectPerformance[project.Id] = sumOfDocumentAverages / documentCount; 345projectDiagnosticTasks.Add(new KeyValuePair<ProjectId, Task<AnalysisResult>>(project.Id, resultTask));
Microsoft.Analyzers.Extra.Tests (2)
Resources\RoslynTestUtils.cs (2)
363var changedProj = solution.GetProject(proj.Id); 457var changedProj = solution.GetProject(proj.Id);
Microsoft.Analyzers.Local.Tests (2)
Resources\RoslynTestUtils.cs (2)
364var changedProj = solution.GetProject(proj.Id); 458var changedProj = solution.GetProject(proj.Id);
Microsoft.AspNetCore.Analyzer.Testing (1)
CodeFixRunner.cs (1)
36var updatedProject = updatedSolution.GetProject(document.Project.Id);
Microsoft.CodeAnalysis.CodeStyle.Fixes (1)
src\Analyzers\Core\CodeFixes\UpgradeProject\AbstractUpgradeProjectCodeFixProvider.cs (1)
79foreach (var projectId in solution.Projects.Select(p => p.Id))
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (2)
src\Analyzers\CSharp\CodeFixes\UpdateProjectToAllowUnsafe\CSharpUpdateProjectToAllowUnsafeCodeFixProvider.cs (1)
43return project.Solution.WithProjectCompilationOptions(project.Id, compilationOptions.WithAllowUnsafe(true));
src\Analyzers\CSharp\CodeFixes\UpgradeProject\CSharpUpgradeProjectCodeFixProvider.cs (1)
95return project.Solution.WithProjectParseOptions(project.Id, parseOptions.WithLanguageVersion(parsedNewVersion));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (30)
CodeActions\PreviewTests.cs (2)
73solution = solution.AddDocument(DocumentId.CreateNewId(_oldDocument.Project.Id, AddedDocumentName), AddedDocumentName, AddedDocumentText); 78solution = solution.RemoveMetadataReference(_oldDocument.Project.Id, removedReference);
Diagnostics\DiagnosticAnalyzerDriver\DiagnosticAnalyzerDriverTests.cs (1)
164var additionalDocId = DocumentId.CreateNewId(workspace.CurrentSolution.Projects.Single().Id);
Formatting\CodeCleanupTests.cs (2)
804project = project.Solution.WithProjectFilePath(project.Id, @$"z:\\{project.FilePath}").GetProject(project.Id);
Formatting\CodeCleanupTests.TestFixers.cs (2)
116return solution.AddDocument(DocumentId.CreateNewId(project.Id), "new.cs", SourceText.From("")); 172return solution.AddDocument(DocumentId.CreateNewId(project.Id), "new.cs", SourceText.From(""));
Formatting\RazorLineFormattingOptionsTests.cs (1)
58DocumentId.CreateNewId(project.Id),
PdbSourceDocument\AbstractPdbSourceDocumentTests.cs (2)
175Assert.Equal(project.Id, mappedProject!.Id);
SymbolKey\SymbolKeyTests.cs (3)
204Assert.True(bodyProject.Id == bodyLocalProjectId, $"Expected {bodyProject.Id} == {bodyLocalProjectId}. {i}"); 205Assert.Equal(referenceProject.Id, referenceAssemblyProjectId);
Workspaces\WorkspaceTests_EditorFeatures.cs (17)
286var id1 = snapshot.Projects.First(p => p.Name == project1.Name).Id; 287var id2 = snapshot.Projects.First(p => p.Name == project2.Name).Id; 325var id1 = snapshot.Projects.First(p => p.Name == project1.Name).Id; 326var id2 = snapshot.Projects.First(p => p.Name == project2.Name).Id; 412var id1 = snapshot.Projects.First(p => p.Name == project1.Name).Id; 434var id1 = snapshot.Projects.First(p => p.Name == project1.Name).Id; 435var id2 = snapshot.Projects.First(p => p.Name == project2.Name).Id; 462var id1 = snapshot.Projects.First(p => p.Name == project1.Name).Id; 463var id2 = snapshot.Projects.First(p => p.Name == project2.Name).Id; 495var id1 = solutionY.Projects.First(p => p.Name == project1.Name).Id; 496var id2 = solutionY.Projects.First(p => p.Name == project2.Name).Id; 549var id1 = solutionY.Projects.First(p => p.Name == project1.Name).Id; 550var id2 = solutionY.Projects.First(p => p.Name == project2.Name).Id; 617var id1 = solutionY.Projects.First(p => p.Name == project1.Name).Id; 618var id2 = solutionY.Projects.First(p => p.Name == project2.Name).Id; 1235var newDocId = DocumentId.CreateNewId(project.Id); 1271var newDocId = DocumentId.CreateNewId(project.Id);
Microsoft.CodeAnalysis.CSharp.Features (3)
CodeRefactorings\EnableNullable\EnableNullableCodeRefactoringProvider.cs (1)
90solution = solution.WithProjectCompilationOptions(project.Id, compilationOptions.WithNullableContextOptions(NullableContextOptions.Enable));
src\Analyzers\CSharp\CodeFixes\UpdateProjectToAllowUnsafe\CSharpUpdateProjectToAllowUnsafeCodeFixProvider.cs (1)
43return project.Solution.WithProjectCompilationOptions(project.Id, compilationOptions.WithAllowUnsafe(true));
src\Analyzers\CSharp\CodeFixes\UpgradeProject\CSharpUpgradeProjectCodeFixProvider.cs (1)
95return project.Solution.WithProjectParseOptions(project.Id, parseOptions.WithLanguageVersion(parsedNewVersion));
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (3)
EditAndContinue\CSharpEditAndContinueAnalyzerTests.cs (3)
664var newDocId = DocumentId.CreateNewId(oldProject.Id); 710var newDocId = DocumentId.CreateNewId(oldProject.Id); 743var documentId = DocumentId.CreateNewId(oldProject.Id);
Microsoft.CodeAnalysis.EditorFeatures (12)
EditAndContinue\EditAndContinueLanguageService.cs (1)
289var projectId = solution.Projects.FirstOrDefault(project => project.FilePath == path)?.Id;
Preview\AbstractPreviewFactoryService.cs (11)
110previewItems.Add(new SolutionPreviewItem(oldProject.Id, documentId, async c => 131previewItems.Add(new SolutionPreviewItem(oldProject.Id, documentId, async c => 152previewItems.Add(new SolutionPreviewItem(oldProject.Id, documentId, async c => 159previewItems.Add(new SolutionPreviewItem(oldProject.Id, null, 166previewItems.Add(new SolutionPreviewItem(oldProject.Id, null, 173previewItems.Add(new SolutionPreviewItem(oldProject.Id, null, 180previewItems.Add(new SolutionPreviewItem(oldProject.Id, null, 187previewItems.Add(new SolutionPreviewItem(oldProject.Id, null, 194previewItems.Add(new SolutionPreviewItem(oldProject.Id, null, 202previewItems.Add(new SolutionPreviewItem(project.Id, null, 209previewItems.Add(new SolutionPreviewItem(project.Id, null,
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (20)
CodeFixes\CodeFixServiceTests.cs (2)
1081sourceDocument.Project.Solution, sourceDocument.Project.Id, sourceDocument.Id, diagnosticIds: null, shouldIncludeAnalyzer: null, getDocuments: null, 1145var cachedDiagnostics = await diagnosticIncrementalAnalyzer.GetCachedDiagnosticsAsync(sourceDocument.Project.Solution, sourceDocument.Project.Id, sourceDocument.Id,
Diagnostics\DiagnosticAnalyzerServiceTests.cs (1)
891return workspace.AddDocument(project.Id, "Empty.cs", SourceText.From("class A { B B {get} }"));
Diagnostics\DiagnosticDataTests.cs (3)
122projectId: document.Project.Id, 155projectId: document.Project.Id, 249projectId: firstDocument.Project.Id,
Preview\PreviewWorkspaceTests.cs (1)
58var newSolution = previewWorkspace.CurrentSolution.RemoveProject(project.Id);
SymbolFinder\DependentTypeFinderTests.cs (12)
72", Net461.References.mscorlib, portableProject.Id); 113", Net461.References.mscorlib, portableProject.Id); 164", Net461.References.mscorlib, portableProject.Id); 205", SystemRuntimePP7Ref, portableProject.Id); 247", Net461.References.mscorlib, portableProject.Id); 289", Net40.References.mscorlib, portableProject.Id); 330", Net461.References.mscorlib, portableProject.Id); 371", Net461.References.mscorlib, portableProject.Id); 411", Net40.References.mscorlib, portableProject.Id); 695", Net40.References.mscorlib, normalProject1.Id); 697normalProject1 = solution.GetProject(normalProject1.Id); 751", Net40.References.mscorlib, portableProject1.Id);
TextEditor\OpenDocumentTests.cs (1)
41var projectId = workspace.AddProject($"Project{i}", LanguageNames.CSharp).Id;
Microsoft.CodeAnalysis.EditorFeatures.Wpf (1)
Peek\PeekableItemFactory.cs (1)
92solution.Workspace, project.Id, symbolKey, peekResultFactory, _metadataAsSourceFileService, _globalOptions, _threadingContext));
Microsoft.CodeAnalysis.ExternalAccess.FSharp (2)
LanguageServices\FSharpVisualStudioWorkspaceExtensions.cs (2)
28projectId = projects[0].Id; 44return workspace.CurrentSolution.Projects.FirstOrDefault(p => p.FilePath == filePath)?.Id ?? ProjectId.CreateNewId("ProjectNotFound");
Microsoft.CodeAnalysis.Features (79)
AddImport\AbstractAddImportCodeFixProvider.cs (1)
67var packageSources = installerService?.IsEnabled(document.Project.Id) == true
AddImport\AbstractAddImportFeatureService.cs (1)
465var projectsThatTransitivelyDependOnThisProject = dependencyGraph.GetProjectsThatTransitivelyDependOnThisProject(project.Id);
AddImport\CodeActions\AssemblyReferenceCodeAction.cs (1)
109_newProject.Id,
AddImport\CodeActions\ProjectSymbolReferenceCodeAction.cs (2)
38=> fixData.ProjectReferenceToAdd != null && fixData.ProjectReferenceToAdd != originalDocument.Project.Id; 52return Task.FromResult<CodeActionOperation?>(new AddProjectReferenceCodeActionOperation(OriginalDocument.Project.Id, FixData.ProjectReferenceToAdd, applyOperation));
AddImport\References\ProjectSymbolReference.cs (11)
36return document.Project.Id == _project.Id 51=> document.Project.Id != _project.Id; 60if (document.Project.Id == _project.Id) 79textChanges, description, tags, priority, _project.Id); 93description = project.Id == _project.Id 104_project.Id == reference._project.Id; 108=> Hash.Combine(_project.Id, base.GetHashCode());
AddImport\SearchScopes\MetadataSymbolsSearchScope.cs (1)
31_assemblyProject.Id,
AddMissingReference\AddMissingReferenceCodeAction.cs (1)
50foreach (var candidateProjectId in dependencyGraph.GetProjectsThatThisProjectTransitivelyDependsOn(project.Id))
AddPackage\AbstractAddPackageCodeFixProvider.cs (1)
38!installerService.IsEnabled(document.Project.Id))
CodeFixes\Configuration\ConfigurationUpdater.cs (4)
243currentProject = solution.GetProject(project.Id)!; 255currentProject = solution.GetProject(project.Id)!; 330var id = DocumentId.CreateNewId(project.Id); 337return newSolution.GetProject(project.Id)?.GetAnalyzerConfigDocument(id);
CodeFixes\Suppression\AbstractSuppressionCodeFixProvider.GlobalSuppressMessageFixAllCodeAction.cs (1)
77var currentProject = currentSolution.GetProject(oldProject.Id);
CodeRefactorings\AddMissingImports\AbstractAddMissingImportsFeatureService.cs (1)
77var usableFixes = unambiguousFixes.WhereAsArray(fixData => DoesNotAddReference(fixData, document.Project.Id));
CodeRefactorings\SyncNamespace\AbstractSyncNamespaceCodeRefactoringProvider.MoveFileCodeAction.cs (1)
41var newDocumentId = DocumentId.CreateNewId(document.Project.Id, document.Name);
Completion\Providers\AbstractInternalsVisibleToCompletionProvider.cs (1)
154var projectGuid = project.Id.Id.ToString();
Completion\Providers\ImportCompletionProvider\AbstractTypeImportCompletionService.cs (2)
78var referencedProjects = graph.GetProjectsThatThisProjectTransitivelyDependsOn(currentProject.Id).Select(solution.GetRequiredProject).Where(p => p.SupportsCompilation); 171project.Id,
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.cs (3)
36solutionInfo, project.Id, cancellationToken), 258if (!cacheService.ProjectItemsCache.TryGetValue(project.Id, out var cacheEntry) || 281cacheService.ProjectItemsCache[project.Id] = cacheEntry;
Completion\Providers\ImportCompletionProvider\ExtensionMethodImportCompletionHelper.SymbolComputer.cs (3)
145var relevantProjectIds = graph.GetProjectsThatThisProjectTransitivelyDependsOn(project.Id).Concat(project.Id); 164else if (!_cacheService.ProjectItemsCache.TryGetValue(project.Id, out cacheEntry))
ConvertTupleToStruct\AbstractConvertTupleToStructCodeRefactoringProvider.cs (1)
460var dependentProjects = graph.GetProjectsThatDirectlyDependOnThisProject(startingProject.Id);
Diagnostics\CodeAnalysisDiagnosticAnalyzerService.cs (2)
122_analyzedProjectIds.Add(project.Id); 125_clearedProjectIds.Remove(project.Id);
EditAndContinue\CommittedSolution.cs (1)
209if (committedDocument == null && !solution.ContainsProject(document.Project.Id))
EditAndContinue\DebuggingSession.cs (5)
294if (!TryCreateInitialBaseline(baselineCompilation, outputs, baselineProject.Id, out errors, out var initialBaseline, out var debugInfoReaderProvider, out var metadataReaderProvider)) 310var newBaseline = new ProjectBaseline(moduleId, baselineProject.Id, initialBaseline, generation: 0); 313_projectBaselines[baselineProject.Id] = baselines; 320=> _projectBaselines.TryGetValue(baselineProject.Id, out baselines) && 797var oldProject = LastCommittedSolution.GetProject(newProject.Id);
EditAndContinue\EditAndContinueDocumentAnalysesCache.cs (1)
79var oldProject = oldDocument?.Project ?? oldSolution.GetRequiredProject(newDocument.Project.Id);
EditAndContinue\EditSession.cs (13)
296var oldProject = oldSolution.GetProject(newProject.Id); 311var newProject = newSolution.GetProject(oldProject.Id); 470diagnostics?.Add(new ProjectDiagnostics(project.Id, generatorDiagnostics)); 486Debug.Assert(oldProject.Id == newProject.Id); 826var oldProject = oldSolution.GetProject(newProject.Id); 859diagnostics.Add(new(newProject.Id, [mvidReadError])); 894diagnostics.Add(new(newProject.Id, documentDiagnostics)); 930diagnostics.Add(new(newProject.Id, moduleDiagnostics)); 965diagnostics.Add(new(newProject.Id, createBaselineErrors)); 1040diagnostics.Add(new(newProject.Id, emitResult.Diagnostics)); 1057diagnostics.Add(new(newProject.Id, emitDiagnostics)); 1079newProject.Id,
EditAndContinue\Utilities\Extensions.cs (1)
47log?.Write("Project '{0}' (id '{1}') doesn't support EnC: no file path", project.Name, project.Id);
EncapsulateField\AbstractEncapsulateFieldService.cs (1)
235var projectId = document.Project.Id;
ExternalAccess\UnitTesting\API\UnitTestingSearchHelpers.cs (2)
37(service, solutionChecksum, cancellationToken) => service.GetSourceLocationAsync(solutionChecksum, project.Id, query, cancellationToken), 60(service, solutionChecksum, cancellationToken) => service.GetSourceLocationsAsync(solutionChecksum, project.Id, query, cancellationToken),
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.UnitTestingSemanticChangeProcessor.cs (1)
211var self = project.Id;
ExtractInterface\AbstractExtractInterfaceService.cs (1)
190refactoringResult.DocumentToExtractFrom.Project.Id,
GenerateType\AbstractGenerateTypeService.Editor.cs (5)
272var newDocumentId = DocumentId.CreateNewId(projectToBeUpdated.Id, debugName: documentName); 348var documentId = DocumentId.CreateNewId(projectToBeUpdated.Id, documentName); 377if (!triggeringProject.ProjectReferences.Any(pr => pr.ProjectId == projectToBeUpdated.Id)) 379updatedSolution = updatedSolution.AddProjectReference(triggeringProject.Id, new ProjectReference(projectToBeUpdated.Id));
InitializeParameter\AbstractInitializeMemberFromParameterCodeRefactoringProviderMemberCreation.cs (1)
448var compilation = await finalSolution.GetRequiredProject(documentWithMemberAdded.Project.Id).GetRequiredCompilationAsync(cancellationToken).ConfigureAwait(false);
MetadataAsSource\MetadataAsSourceGeneratedFileInfo.cs (1)
30this.SourceProjectId = sourceProject.Id;
NavigateTo\NavigateToSearcher.cs (1)
467allProjectIdSet.AddRange(orderedProjects.SelectMany(x => x).Select(p => p.Id));
Navigation\INavigableItem.cs (1)
93=> new(project.Name, project.Id);
PdbSourceDocument\PdbSourceDocumentMetadataAsSourceFileProvider.cs (1)
376_fileToDocumentInfoMap[info.FilePath] = new(documentId, encoding, info.ChecksumAlgorithm, sourceProject.Id, sourceWorkspace, documentInfo);
SignatureHelp\AbstractSignatureHelpProvider.cs (3)
257var totalProjects = relatedDocuments.Select(d => d.Project.Id).Concat(document.Project.Id); 288invalidProjectsForCurrentSymbol.Add(relatedDocument.Project.Id);
src\Analyzers\Core\CodeFixes\UpgradeProject\AbstractUpgradeProjectCodeFixProvider.cs (1)
79foreach (var projectId in solution.Projects.Select(p => p.Id))
Workspace\CompileTimeSolutionProvider.cs (1)
192var sourceGeneratedDocuments = await compileTimeSolution.GetRequiredProject(designTimeDocument.Project.Id).GetSourceGeneratedDocumentsAsync(cancellationToken).ConfigureAwait(false);
Microsoft.CodeAnalysis.Features.Test.Utilities (7)
Diagnostics\TestDiagnosticAnalyzerDriver.cs (2)
52project.Solution, project.Id, document.Id, diagnosticIds: null, shouldIncludeAnalyzer: null, 65project.Solution, project.Id, documentId: null, diagnosticIds: null, shouldIncludeAnalyzer: null,
EditAndContinue\EditAndContinueWorkspaceTestBase.cs (4)
114solution = solution.AddAnalyzerReference(project.Id, new TestGeneratorReference(generator)); 119solution = solution.AddAdditionalDocument(DocumentId.CreateNewId(project.Id), "additional", CreateText(additionalFileText)); 125DocumentId.CreateNewId(project.Id), 137document = solution.GetRequiredProject(project.Id).
EditAndContinue\Extensions.cs (1)
71=> project.Solution.AddTestDocument(project.Id, source, path, out id);
Microsoft.CodeAnalysis.Features.UnitTests (20)
EditAndContinue\EditSessionActiveStatementsTests.cs (3)
78var id = DocumentId.CreateNewId(project.Id, name); 176solution = dummyProject.Solution.AddDocument(DocumentId.CreateNewId(dummyProject.Id, NoCompilationConstants.LanguageName), "a.dummy", ""); 685var analyzer = solution.GetProject(project.Id).Services.GetRequiredService<IEditAndContinueAnalyzer>();
EditAndContinue\EmitSolutionUpdateResultsTests.cs (4)
89document.Project.Id, 105document.Project.Id, 122document.Project.Id, 129var rudeEdits = ImmutableArray.Create(new ProjectDiagnostics(document.Project.Id,
FindUsages\DefinitionItemFactoryTests.cs (13)
94expressionMap.Add(project.Id.Id.ToString(), $"project.{nameof(Project.Id)}.{nameof(Project.Id.Id)}.{nameof(Project.Id.Id.ToString)}()"); 198("MetadataSymbolOriginatingProjectIdGuid", project.Id.Id.ToString()), 276("MetadataSymbolOriginatingProjectIdGuid", project.Id.Id.ToString()), 366("MetadataSymbolOriginatingProjectIdGuid", project.Id.Id.ToString()), 424("MetadataSymbolOriginatingProjectIdGuid", project.Id.Id.ToString()), 592("MetadataSymbolOriginatingProjectIdGuid", project.Id.Id.ToString()), 650("MetadataSymbolOriginatingProjectIdGuid", project.Id.Id.ToString()), 751("MetadataSymbolOriginatingProjectIdGuid", project.Id.Id.ToString()) 807("MetadataSymbolOriginatingProjectIdGuid", project.Id.Id.ToString()) 914("MetadataSymbolOriginatingProjectIdGuid", project.Id.Id.ToString()),
Microsoft.CodeAnalysis.LanguageServer (1)
LanguageServer\Handler\DebugConfiguration\WorkspaceDebugConfigurationHandler.cs (1)
49var targetsDotnetCore = _targetFrameworkManager.IsDotnetCoreProject(project.Id);
Microsoft.CodeAnalysis.LanguageServer.Protocol (43)
Extensions\Extensions.cs (2)
153return FindItemInProjectContext(documents, documentIdentifier, projectIdGetter: (item) => item.Project.Id, defaultGetter: () => 170: FindItemInProjectContext(projects, projectIdentifier, projectIdGetter: (item) => item.Id, defaultGetter: () => projects[0]);
Extensions\ProtocolConversions.cs (1)
817Id = ProjectIdToProjectContextId(project.Id),
Extensions\SourceGeneratedDocumentUri.cs (1)
59var projectId = solution.GetProject(projectIdGuidOnly)?.Id;
Features\CodeFixes\CodeFixService.FixAllDiagnosticProvider.cs (2)
65var diagnostics = await _diagnosticService.GetDiagnosticsForIdsAsync(project.Solution, project.Id, documentId: null, _diagnosticIds, shouldIncludeAnalyzer: null, _includeSuppressedDiagnostics, includeLocalDocumentDiagnostics: true, includeNonLocalDocumentDiagnostics: false, cancellationToken).ConfigureAwait(false); 72var diagnostics = await _diagnosticService.GetProjectDiagnosticsForIdsAsync(project.Solution, project.Id, _diagnosticIds, shouldIncludeAnalyzer: null, _includeSuppressedDiagnostics, includeNonLocalDocumentDiagnostics: false, cancellationToken).ConfigureAwait(false);
Features\Diagnostics\DocumentAnalysisExecutor_Helpers.cs (1)
392if (documentId.ProjectId == project.Id)
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.AnalysisData.cs (4)
119var state = stateSet.GetOrCreateProjectState(project.Id); 121Contract.ThrowIfFalse(project.Id == result.ProjectId); 141return new ProjectAnalysisData(project.Id, VersionStamp.Default, ImmutableDictionary<DiagnosticAnalyzer, DiagnosticAnalysisResult>.Empty); 144return new ProjectAnalysisData(project.Id, version.Value, builder.ToImmutable());
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.cs (1)
90=> $"project: ({project.Id}), ({string.Join(Environment.NewLine, stateSets.Select(s => s.Analyzer.ToString()))})";
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.Executor.cs (1)
47return new ProjectAnalysisData(project.Id, version, existingData.Result, result);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.InProcOrRemoteHostAnalyzerRunner.cs (2)
102invocation: (service, solutionInfo, cancellationToken) => service.GetSourceGeneratorDiagnosticsAsync(solutionInfo, project.Id, cancellationToken), 227project.Id,
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.ProjectState.cs (7)
61Contract.ThrowIfFalse(lastResult.ProjectId == project.Id); 122Contract.ThrowIfFalse(lastResult.ProjectId == document.Project.Id); 163Contract.ThrowIfFalse(lastResult.ProjectId == project.Id); 322return DiagnosticAnalysisResult.CreateEmpty(project.Id, VersionStamp.Default); 338return DiagnosticAnalysisResult.CreateEmpty(project.Id, VersionStamp.Default); 352return DiagnosticAnalysisResult.CreateEmpty(project.Id, VersionStamp.Default); 407var diagnostics = await GetDiagnosticsFromInMemoryStorageAsync(serializerVersion, project, document: null, project.Id, NonLocalStateName, cancellationToken).ConfigureAwait(false);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.StateManager.cs (1)
79=> GetStateSets(project.Id).Where(s => s.Language == project.Language);
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.StateManager.ProjectStates.cs (3)
60if (_projectAnalyzerStateMap.TryGetValue(project.Id, out var entry) && 114_projectAnalyzerStateMap = _projectAnalyzerStateMap.SetItem(project.Id, projectStateSets.Value); 130if (!_projectAnalyzerStateMap.TryGetValue(project.Id, out var entry))
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer.StateSet.cs (3)
107if (!TryGetProjectState(document.Project.Id, out var projectState) || 136var projectState = GetOrCreateProjectState(document.Project.Id); 152if (TryGetProjectState(document.Project.Id, out var projectState))
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer_GetDiagnostics.cs (2)
116foreach (var stateSet in StateManager.GetStateSets(project.Id)) 174if (!stateSet.TryGetProjectState(project.Id, out var state))
Features\Diagnostics\EngineV2\DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs (3)
44var state = stateSet.GetOrCreateProjectState(project.Id); 89stateSets = stateSets.WhereAsArray(s => !s.Analyzer.IsCompilerAnalyzer() || !s.FromBuild(project.Id)); 99stateSets = stateSets.WhereAsArray(s => s.Analyzer.IsCompilerAnalyzer() || s.Analyzer.IsWorkspaceDiagnosticAnalyzer() || !s.FromBuild(project.Id));
Handler\Diagnostics\AbstractPullDiagnosticHandler.cs (1)
261return new ProjectOrDocumentId(project.Id);
Handler\Diagnostics\DiagnosticSourceProviders\WorkspaceDocumentsAndProjectDiagnosticSourceProvider.cs (1)
70if (!fullSolutionAnalysisEnabled && !codeAnalysisService.HasProjectBeenAnalyzed(project.Id))
Handler\Diagnostics\DiagnosticSources\AbstractWorkspaceDocumentDiagnosticSource.cs (1)
77Document.Project.Solution, Document.Project.Id, documentId: null,
Handler\Diagnostics\DiagnosticSources\NonLocalDocumentDiagnosticSource.cs (1)
28Document.Project.Solution, Document.Project.Id, Document.Id,
Handler\Diagnostics\IDiagnosticProjectInformationService.cs (1)
38ProjectIdentifier = project.Id.Id.ToString(),
Handler\SemanticTokens\SemanticTokensRefreshQueue.cs (3)
44var projectChecksum = await project.Solution.CompilationState.GetChecksumAsync(project.Id, cancellationToken).ConfigureAwait(false); 50if (_projectIdToLastComputedChecksum.TryGetValue(project.Id, out var lastChecksum) && lastChecksum == projectChecksum) 56_projectIdToLastComputedChecksum[project.Id] = projectChecksum;
Handler\SourceGenerators\SourceGeneratedDocumentCache.cs (1)
23var executionVersion = state.Document.Project.Solution.GetSourceGeneratorExecutionVersion(state.Document.Project.Id);
Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests (4)
Diagnostics\PullDiagnosticTests.cs (2)
513Id = ProtocolConversions.ProjectIdToProjectContextId(document.Project.Id), 1287projectId: project?.Id,
Workspaces\LspWorkspaceManagerTests.cs (2)
447await testWorkspaceTwo.ChangeProjectAsync(newProjectWorkspaceTwo.Id, newProjectWorkspaceTwo.Solution); 503await testWorkspace.ChangeProjectAsync(newProject.Id, newProject.Solution);
Microsoft.CodeAnalysis.Remote.ServiceHub (11)
Host\RemoteWorkspace.SolutionCreator.cs (9)
352assetPath: project.Id, newProjectChecksums.CompilationOptions, cancellationToken).ConfigureAwait(false))); 359assetPath: project.Id, newProjectChecksums.ParseOptions, cancellationToken).ConfigureAwait(false)); 366assetPath: project.Id, newProjectChecksums.ProjectReferences, cancellationToken).ConfigureAwait(false)); 373assetPath: project.Id, newProjectChecksums.MetadataReferences, cancellationToken).ConfigureAwait(false)); 382assetPath: project.Id, newProjectChecksums.AnalyzerReferences, cancellationToken).ConfigureAwait(false); 465assetPath: new(AssetPathKind.DocumentAttributes, project.Id), newChecksumsToSync, cancellationToken).ConfigureAwait(false); 471assetPath: new(AssetPathKind.DocumentText, project.Id), newChecksumsToSync, cancellationToken).ConfigureAwait(false); 501project = addDocuments(project.Solution, lazyDocumentsToAdd.ToImmutable()).GetProject(project.Id)!; 518project = removeDocuments(project.Solution, lazyDocumentsToRemove.ToImmutable()).GetProject(project.Id)!;
Services\DiagnosticAnalyzer\DiagnosticComputer.cs (2)
136s_compilationWithAnalyzersCache.Project.Id == project.Id &&
Microsoft.CodeAnalysis.Remote.Workspaces (1)
SolutionAssetStorage.cs (1)
58=> StoreAssetsAsync(project.Solution.CompilationState, project.Id, cancellationToken);
Microsoft.CodeAnalysis.Workspaces (109)
Classification\SemanticClassificationCacheUtilities.cs (1)
23var projectKey = new ProjectKey(SolutionKey.ToSolutionKey(project.Solution), project.Id, project.FilePath, project.Name, Checksum.Null);
Diagnostics\DiagnosticAnalysisResult.cs (2)
145project.Id, 171project.Id,
Diagnostics\DiagnosticData.cs (2)
190=> Create(diagnostic, project?.Id, project?.Language, 213project.Id,
Editing\SymbolEditor.cs (3)
106return await GetSymbolAsync(ChangedSolution, project.Id, symbolId, cancellationToken).ConfigureAwait(false); 113return await GetSymbolAsync(ChangedSolution, project.Id, symbolId, cancellationToken).ConfigureAwait(false); 134.ToLookup(p => p.AssemblyName, p => p.Id)
FindSymbols\Declarations\DeclarationFinder_AllDeclarations.cs (1)
44(service, solutionInfo, cancellationToken) => service.FindAllDeclarationsWithNormalQueryAsync(solutionInfo, project.Id, query.Name, query.Kind, criteria, cancellationToken),
FindSymbols\Declarations\DeclarationFinder_SourceDeclarations.cs (2)
86(service, solutionInfo, cancellationToken) => service.FindProjectSourceDeclarationsWithNormalQueryAsync(solutionInfo, project.Id, name, ignoreCase, criteria, cancellationToken), 152(service, solutionInfo, cancellationToken) => service.FindProjectSourceDeclarationsWithPatternAsync(solutionInfo, project.Id, pattern, criteria, cancellationToken),
FindSymbols\FindReferences\DependentProjectsFinder.cs (5)
217projectIdsToReferencingSubmissionIds.MultiAdd(referencedProject.Id, project.Id); 228foreach (var dependentProject in dependentProjects.Select(dp => dp.project.Id)) 237if (!dependentProjects.Any(dp => dp.project.Id == pId)) 317return project.ProjectReferences.Any(p => p.ProjectId == symbolOrigination.sourceProject.Id);
FindSymbols\FindReferences\DependentTypeFinder.cs (6)
443return dependencyGraph.GetProjectsThatTransitivelyDependOnThisProject(project.Id) 444.Concat(project.Id); 475return [.. projectsToExamine.OrderBy((p1, p2) => order[p1.Id] - order[p2.Id])]; 495.SelectMany(p => dependencyGraph.GetProjectsThatThisProjectTransitivelyDependsOn(p.Id)) 496.Concat(projects.Select(p => p.Id)).ToSet();
FindSymbols\FindReferences\DependentTypeFinder_Remote.cs (1)
31var projectIds = projects?.Where(p => RemoteSupportedLanguages.IsSupported(p.Language)).SelectAsArray(p => p.Id) ?? default;
FindSymbols\SymbolTree\SymbolTreeInfoCacheService.cs (8)
76_workQueue.AddWork(project.Id); 88var referencingProjects = new HashSet<ProjectId>(solution.Projects.Where(p => p.MetadataReferences.Contains(reference)).Select(p => p.Id)); 101_workQueue.AddWork(project.Id); 104if (_projectIdToInfo.TryGetValue(project.Id, out var projectInfo)) 115return _projectIdToInfo.GetOrAdd(project.Id, (semanticVersion: default, info)).info; 167if (!_projectIdToInfo.TryGetValue(project.Id, out var projectInfo) || 184_projectIdToInfo[project.Id] = (semanticVersion, info); 211metadataInfo.ReferencingProjects.Add(project.Id);
Remote\RemoteArguments.cs (2)
69=> new(symbol.GetSymbolKey(cancellationToken).ToString(), project.Id); 95result = new SerializableSymbolAndProjectId(SymbolKey.CreateString(symbol, cancellationToken), project.Id);
Remote\RemoteServiceConnection.cs (4)
82=> TryInvokeAsync(project.Solution.CompilationState, project.Id, invocation, cancellationToken); 88=> TryInvokeAsync(project.Solution.CompilationState, project.Id, invocation, cancellationToken); 132=> TryInvokeAsync(project.Solution.CompilationState, project.Id, invocation, cancellationToken); 138=> TryInvokeAsync(project.Solution.CompilationState, project.Id, invocation, cancellationToken);
Shared\Extensions\ProjectExtensions.cs (2)
17=> project.Solution.WithOptions(options).GetProject(project.Id)!; 32=> project.Solution.GetDocumentIdsWithFilePath(filePath).FirstOrDefault(id => id.ProjectId == project.Id);
Workspace\ProjectSystem\ProjectSystemProject.cs (2)
669var projectId = projectBeforeMutation.Id; 822var newSolution = solution.WithProjectAnalyzerReferences(project.Id, isolatedReferences);
Workspace\Solution\Project.cs (60)
230=> Solution.GetDocumentId(syntaxTree, this.Id); 236=> Solution.GetDocument(syntaxTree, this.Id); 311if (this.Id != documentId.ProjectId) 346if (this.Id != documentId.ProjectId) 483=> Solution.CompilationState.TryGetCompilation(this.Id, out compilation); 531=> Solution.CompilationState.GetDependentVersionAsync(this.Id, cancellationToken); 538=> Solution.CompilationState.GetDependentSemanticVersionAsync(this.Id, cancellationToken); 573=> Solution.CompilationState.GetDependentChecksumAsync(this.Id, cancellationToken); 579=> this.Solution.WithProjectAssemblyName(this.Id, assemblyName).GetRequiredProject(Id); 585=> this.Solution.WithProjectDefaultNamespace(this.Id, defaultNamespace).GetRequiredProject(Id); 588=> Solution.WithProjectOutputFilePath(Id, path).GetRequiredProject(Id); 591=> Solution.WithProjectOutputRefFilePath(Id, path).GetRequiredProject(Id); 594=> Solution.WithProjectCompilationOutputInfo(Id, info).GetRequiredProject(Id); 600=> this.Solution.WithProjectCompilationOptions(this.Id, options).GetRequiredProject(Id); 606=> this.Solution.WithProjectParseOptions(this.Id, options).GetRequiredProject(Id); 613=> this.Solution.AddProjectReference(this.Id, projectReference).GetRequiredProject(Id); 620=> this.Solution.AddProjectReferences(this.Id, projectReferences).GetRequiredProject(Id); 626=> this.Solution.RemoveProjectReference(this.Id, projectReference).GetRequiredProject(Id); 633=> this.Solution.WithProjectReferences(this.Id, projectReferences).GetRequiredProject(Id); 640=> this.Solution.AddMetadataReference(this.Id, metadataReference).GetRequiredProject(Id); 647=> this.Solution.AddMetadataReferences(this.Id, metadataReferences).GetRequiredProject(Id); 653=> this.Solution.RemoveMetadataReference(this.Id, metadataReference).GetRequiredProject(Id); 660=> this.Solution.WithProjectMetadataReferences(this.Id, metadataReferences).GetRequiredProject(Id); 667=> this.Solution.AddAnalyzerReference(this.Id, analyzerReference).GetRequiredProject(Id); 674=> this.Solution.AddAnalyzerReferences(this.Id, analyzerReferences).GetRequiredProject(Id); 680=> this.Solution.RemoveAnalyzerReference(this.Id, analyzerReference).GetRequiredProject(Id); 687=> this.Solution.WithProjectAnalyzerReferences(this.Id, analyzerReferencs).GetRequiredProject(Id); 694=> Solution.WithProjectAttributes(attributes).GetRequiredProject(Id); 701var id = DocumentId.CreateNewId(this.Id); 713var id = DocumentId.CreateNewId(this.Id); 722var id = DocumentId.CreateNewId(this.Id, debugName: name); 731var id = DocumentId.CreateNewId(this.Id); 740var id = DocumentId.CreateNewId(this.Id); 749var id = DocumentId.CreateNewId(this.Id); 760return this.Solution.RemoveDocument(documentId).GetRequiredProject(Id); 770return this.Solution.RemoveDocuments(documentIds).GetRequiredProject(this.Id); 779=> this.Solution.RemoveAdditionalDocument(documentId).GetRequiredProject(Id); 788return this.Solution.RemoveAdditionalDocuments(documentIds).GetRequiredProject(this.Id); 797=> this.Solution.RemoveAnalyzerConfigDocument(documentId).GetRequiredProject(Id); 806return this.Solution.RemoveAnalyzerConfigDocuments(documentIds).GetRequiredProject(this.Id); 814if (documentId?.ProjectId != this.Id)
Workspace\Solution\ProjectChanges.cs (1)
18public ProjectId ProjectId => NewProject.Id;
Workspace\Solution\SolutionCompilationState.cs (2)
1757if (!projectWithCachedGeneratorState.Solution.CompilationState.TryGetCompilationTracker(projectWithCachedGeneratorState.Id, out var tracker) || 1820=> project.SupportsCompilation ? compilationState.GetCompilationTracker(project.Id).GeneratorDriver : null;
Workspace\Workspace.cs (3)
1455outputAssemblyToProjectIdMap[p.OutputFilePath!] = p.Id; 1460outputAssemblyToProjectIdMap[p.OutputRefFilePath!] = p.Id; 1590this.ApplyProjectRemoved(proj.Id);
Workspace\Workspace_Editor.cs (2)
885foreach (var docId in this.GetOpenDocumentIds(oldProject.Id)) 894return newSolution.GetRequiredProject(oldProject.Id);
Microsoft.CodeAnalysis.Workspaces.MSBuild (1)
MSBuild\ProjectMap.cs (1)
78Add(project.Id, project.FilePath, project.OutputFilePath, project.OutputRefFilePath);
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (14)
NetCoreTests.cs (1)
129Assert.Equal(libraryProject.Id, projectRefId);
VisualStudioMSBuildWorkspaceTests.cs (13)
224Assert.True(projects[0].ProjectReferences.Any(r => r.ProjectId == projects[1].Id) || 225projects[1].ProjectReferences.Any(r => r.ProjectId == projects[0].Id)); 411var solution2 = solution1.WithProjectCompilationOptions(project.Id, project.CompilationOptions.WithOutputKind(OutputKind.NetModule)); 1445vbProject = workspace.CurrentSolution.GetProject(vbProject.Id); 2015workspace.AddDocument(project.Id, ["NewFolder"], "Bar.cs", newText); 2169var newDocId = DocumentId.CreateNewId(project.Id); 2196var csProjectId = csProject.Id; 2200var vbProjectId = vbProject.Id; 2945workspace.TryApplyChanges(workspace.CurrentSolution.GetProject(project.Id).RemoveAnalyzerReference(aref).Solution); 2966workspace.TryApplyChanges(workspace.CurrentSolution.GetProject(project.Id).RemoveProjectReference(pref).Solution); 2967Assert.Empty(workspace.CurrentSolution.GetProject(project.Id).ProjectReferences); 2973workspace.TryApplyChanges(workspace.CurrentSolution.GetProject(project.Id).AddProjectReference(pref).Solution); 2974Assert.Single(workspace.CurrentSolution.GetProject(project.Id).ProjectReferences);
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (2)
Workspaces\TestWorkspace`1.cs (2)
469var hostProject = this.GetTestProject(projectChanges.NewProject.Id); 473base.OnProjectNameChanged(projectChanges.NewProject.Id, projectChanges.NewProject.Name, projectChanges.NewProject.FilePath);
Microsoft.CodeAnalysis.Workspaces.UnitTests (123)
FindReferencesTests.cs (3)
386}", NetCoreApp.References, solution.Projects.Single(pid => pid.Name == "NetStandardProject").Id); 400Assert.True(projectIds.Contains(netCoreProject.Id)); 476", Net40.References.mscorlib, solution.Projects.Single(pid => pid.Name == "PortableProject").Id);
Formatter\FormatterTests.cs (4)
52var document = workspace.AddDocument(project.Id, "File.dummy", SourceText.From("dummy")); 70var document = workspace.AddDocument(project.Id, "File.dummy", SourceText.From("dummy")); 115var csDocument = workspace.AddDocument(csProject.Id, "File.cs", SourceText.From("class C { }")); 116var vbDocument = workspace.AddDocument(vbProject.Id, "File.vb", SourceText.From("Class C : End Class"));
Simplifier\SimplifierTests.cs (3)
29return workspace.AddDocument(project.Id, "CSharpFile.cs", SourceText.From("class C { }")); 78var csDocument = workspace.AddDocument(csProject.Id, "File.cs", SourceText.From("class C { }")); 79var vbDocument = workspace.AddDocument(vbProject.Id, "File.vb", SourceText.From("Class C : End Class"));
SolutionTests\ProjectDependencyGraphTests.cs (32)
216solution = solution.WithProjectReferences(solution.GetProjectsByName("C").Single().Id, []); 226var projectAId = solution.GetProjectsByName("A").Single().Id; 227var projectBId = solution.GetProjectsByName("B").Single().Id; 280var projectId = solution.GetProjectsByName(project).Single().Id; 297var projectId = solution.GetProjectsByName(project).Single().Id; 315solution = solution.WithProjectReferences(solution.GetProjectsByName("A").Single().Id, 395solution = solution.WithProjectReferences(solution.GetProjectsByName("C").Single().Id, []); 415solution = solution.RemoveProject(solution.GetProjectsByName("B").Single().Id); 437solution = solution.RemoveProject(solution.GetProjectsByName("B").Single().Id); 459solution = solution.RemoveProject(solution.GetProjectsByName("B").Single().Id); 481solution = solution.RemoveProject(solution.GetProjectsByName("B").Single().Id); 506var expected = solution.SolutionState.GetProjectDependencyGraph().GetProjectsThatTransitivelyDependOnThisProject(d.Id); 508var aToB = a.ProjectReferences.Single(reference => reference.ProjectId == b.Id); 509solution = solution.RemoveProjectReference(a.Id, aToB); 514Assert.Same(expected, solution.SolutionState.GetProjectDependencyGraph().GetTestAccessor().TryGetProjectsThatTransitivelyDependOnThisProject(d.Id)); 534var expected = solution.SolutionState.GetProjectDependencyGraph().GetProjectsThatTransitivelyDependOnThisProject(e.Id); 536var aToB = a.ProjectReferences.Single(reference => reference.ProjectId == b.Id); 537solution = solution.RemoveProjectReference(a.Id, aToB); 542Assert.Same(expected, solution.SolutionState.GetProjectDependencyGraph().GetTestAccessor().TryGetProjectsThatTransitivelyDependOnThisProject(e.Id)); 563var notExpected = solution.SolutionState.GetProjectDependencyGraph().GetProjectsThatTransitivelyDependOnThisProject(c.Id); 566var aToB = a.ProjectReferences.Single(reference => reference.ProjectId == b.Id); 567solution = solution.RemoveProjectReference(a.Id, aToB); 571Assert.Null(solution.SolutionState.GetProjectDependencyGraph().GetTestAccessor().TryGetProjectsThatTransitivelyDependOnThisProject(c.Id)); 615var firstBToC = b.ProjectReferences.First(reference => reference.ProjectId == c.Id); 616solution = solution.RemoveProjectReference(b.Id, firstBToC); 620var remainingBToC = b.ProjectReferences.Single(reference => reference.ProjectId == c.Id); 621solution = solution.RemoveProjectReference(b.Id, remainingBToC); 648var projectId = solution.GetProjectsByName(project).Single().Id; 660var projectId = solution.GetProjectsByName(project).Single().Id; 724references.Add(new ProjectReference(solution.GetProjectsByName(targetProject).Single().Id)); 728references.Add(new ProjectReference(solution.GetProjectsByName(targetProject).Single().Id, [$"alias{references.Count}"])); 733solution.GetProjectsByName(projectName).Single().Id,
SolutionTests\SolutionTests.cs (54)
1914var projectId = solution.Projects.Single().Id; 1947var projectId = solution.Projects.Single().Id; 1963var projectId = solution.Projects.Single().Id; 2005var projectId = solution.Projects.Single().Id; 2076var projectId = solution.Projects.Single().Id; 2094var projectId = solution.Projects.Single().Id; 2119var projectId = solution.Projects.Single().Id; 2146var projectId = solution.Projects.Single().Id; 2164var projectId = solution.Projects.Single().Id; 2192var projectId = solution.Projects.Single().Id; 2310var editorConfigId = DocumentId.CreateNewId(solution3.Projects.Single().Id); 2590var pid2 = solution.Projects.Single().Id; 2838Assert.True(solution.ContainsProject(project.Id), "Solution was expected to have project " + project.Id); 2839Assert.Equal(project, solution.GetProject(project.Id)); 2862referenced, solution.GetProjectState(project.Id), includeCrossLanguage: true, CancellationToken.None); 3975Assert.Equal(pid2, projectForBaseType.Id); 3983Assert.Equal(pid1, projectForBaseType.Id); 3991var doc = ws.AddDocument(proj.Id, "a.cs", SourceText.From("public class c { }", Encoding.UTF32)); 4032projectReferences: [new ProjectReference(project1.Id)])); 4052workspace.AddDocument(project1.Id, "Broken.cs", SourceText.From("class ")); 4062projectReferences: [new ProjectReference(project1.Id)])); 4234projectReferences: [new ProjectReference(project1.Id)])); 4236var document = workspace.AddDocument(project2.Id, "Test.cs", SourceText.From("")); 4241Assert.True(await frozenSolution.GetProject(project1.Id).HasSuccessfullyLoadedAsync(CancellationToken.None)); 4242Assert.True(await frozenSolution.GetProject(project2.Id).HasSuccessfullyLoadedAsync(CancellationToken.None)); 4417currentSolution = currentSolution.WithProjectParseOptions(document1.Project.Id, options.WithPreprocessorSymbols("X")); 5302solution = solution.RemoveProject(solution.Projects.Single(p => p.Name == "CS2").Id); 5308solution = solution.RemoveProject(solution.Projects.Single(p => p.Name == "NC1").Id); 5348projectReferences: [new ProjectReference(csBrokenProject.Id), new ProjectReference(vbNormalProject.Id)])); 5358projectReferences: [new ProjectReference(vbNormalProject.Id)])); 5368projectReferences: [new ProjectReference(dependsOnBrokenProject.Id)])); 5378projectReferences: [new ProjectReference(dependsOnVbNormalProject.Id)])); 5404var s4 = s2.RemoveProject(s2.Projects.Single(p => p.Name == "P1").Id); 5616project1 = project2.Solution.GetProject(project1.Id).AddDocument("Doc1", SourceText.From("class Doc1 { }")).Project; 5617project2 = project1.Solution.GetProject(project2.Id).AddDocument("Doc2", SourceText.From("class Doc2 { }")).Project; 5618project1 = project2.Solution.GetProject(project1.Id); 5624var frozenProject1 = frozenSolution.GetProject(project1.Id); 5627var frozenProject2 = frozenSolution.GetProject(project2.Id); 5644project1 = project2.Solution.GetProject(project1.Id).AddDocument("Doc1", SourceText.From("class Doc1 { }")).Project; 5645project2 = project1.Solution.GetProject(project2.Id).AddDocument("Doc2", SourceText.From("class Doc2 { }")).Project; 5647project2 = project2.AddProjectReference(new(project1.Id)); 5648project1 = project2.Solution.GetProject(project1.Id); 5654var frozenProject1 = frozenSolution.GetProject(project1.Id); 5661var frozenProject2 = frozenSolution.GetProject(project2.Id); 5674project1 = project2.Solution.GetProject(project1.Id).AddDocument("Doc1", SourceText.From("class Doc1 { }")).Project; 5675project2 = project1.Solution.GetProject(project2.Id).AddDocument("Doc2", SourceText.From("class Doc2 { }")).Project; 5677project2 = project2.AddProjectReference(new(project1.Id)); 5678project1 = project2.Solution.GetProject(project1.Id); 5684var frozenProject1 = frozenSolution.GetProject(project1.Id); 5691var frozenProject2 = frozenSolution.GetProject(project2.Id); 5715var forkedProject1 = frozenSolution.WithDocumentText(project1.Documents.Single().Id, SourceText.From("class Doc2 { }")).GetProject(project1.Id); 5754var forkedProject1 = frozenSolution.WithDocumentText(project1.Documents.Single().Id, SourceText.From("class Doc2 { }")).GetProject(project1.Id);
SolutionTests\SolutionWithSourceGeneratorTests.cs (2)
849DocumentId.CreateNewId(project.Id), 908var projectId2 = project2.Id;
SymbolKeyTests.cs (2)
865var document = workspace.AddDocument(project.Id, "testdocument", sourceText); 912var document = workspace.AddDocument(project.Id, "testdocument", sourceText);
WorkspaceTests\AdhocWorkspaceTests.cs (12)
39Assert.Equal(info.Id, project.Id); 59var info = DocumentInfo.Create(DocumentId.CreateNewId(project.Id), "code.cs"); 73var doc = ws.AddDocument(project.Id, name, SourceText.From(source)); 101Assert.Equal(pinfo.Id, project.Id); 133Assert.Equal(info1.Id, project1.Id); 139Assert.Equal(info2.Id, project2.Id); 377var projid = ws.AddProject("TestProject", LanguageNames.CSharp).Id; 414var projectId = ws.AddProject("TestProject", LanguageNames.CSharp).Id; 445var projectId = ws.AddProject("TestProject", LanguageNames.CSharp).Id; 480var projectId = ws.AddProject("TestProject", LanguageNames.CSharp).Id; 512var projectId = ws.AddProject("TestProject", LanguageNames.CSharp).Id; 543var projectId = ws.AddProject("TestProject", LanguageNames.CSharp).Id;
WorkspaceTests\WorkspaceReferenceTests.cs (5)
36var info = DocumentInfo.Create(DocumentId.CreateNewId(project.Id), "code.cs"); 76var info = DocumentInfo.Create(DocumentId.CreateNewId(project.Id), "code.cs"); 116var info = DocumentInfo.Create(DocumentId.CreateNewId(project.Id), "code.cs"); 156var referenceDocumentInfo = DocumentInfo.Create(DocumentId.CreateNewId(referenceProject.Id), "code.cs"); 160var info = DocumentInfo.Create(DocumentId.CreateNewId(project.Id), "code.cs");
WorkspaceTests\WorkspaceTests.cs (6)
24var projectId = ws.AddProject("TestProject", LanguageNames.CSharp).Id; 37var projectId = ws.AddProject("TestProject", LanguageNames.CSharp).Id; 53var projectId = ws.AddProject("TestProject", LanguageNames.CSharp).Id; 71var projectId = ws.AddProject("TestProject", LanguageNames.CSharp).Id; 88var projectId = ws.AddProject("TestProject", LanguageNames.CSharp).Id; 104var projectId = ws.AddProject("TestProject", LanguageNames.CSharp).Id;
Microsoft.Gen.ComplianceReports.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
498var changedProj = solution.GetProject(proj.Id);
Microsoft.Gen.ContextualOptions.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
498var changedProj = solution.GetProject(proj.Id);
Microsoft.Gen.Logging.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
498var changedProj = solution.GetProject(proj.Id);
Microsoft.Gen.Metrics.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
498var changedProj = solution.GetProject(proj.Id);
Microsoft.Gen.MetricsReports.Unit.Tests (1)
test\Generators\Shared\RoslynTestUtils.cs (1)
498var changedProj = solution.GetProject(proj.Id);
Microsoft.Interop.ComInterfaceGenerator (1)
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
229return solution.WithProjectCompilationOptions(project.Id, ((CSharpCompilationOptions)project.CompilationOptions).WithAllowUnsafe(true));
Microsoft.Interop.LibraryImportGenerator (1)
src\libraries\System.Runtime.InteropServices\gen\Common\ConvertToSourceGeneratedInteropFixer.cs (1)
229return solution.WithProjectCompilationOptions(project.Id, ((CSharpCompilationOptions)project.CompilationOptions).WithAllowUnsafe(true));
Microsoft.ML.CodeAnalyzer.Tests (1)
Code\BestFriendTest.cs (1)
74solution = solution.AddProjectReference(projectId, new ProjectReference(projectA.Id));
Microsoft.VisualStudio.LanguageServices (48)
CallHierarchy\CallHierarchyProvider.cs (7)
111new MethodCallFinder(symbol, project.Id, AsyncListener, this) 116finders.Add(new OverridingMemberFinder(symbol, project.Id, AsyncListener, this)); 122finders.Add(new CallToOverrideFinder(symbol, project.Id, AsyncListener, this)); 127finders.Add(new BaseMemberFinder(symbol.GetOverriddenMember(), project.Id, AsyncListener, this)); 133finders.Add(new InterfaceImplementationCallFinder(implementedInterfaceMember, project.Id, AsyncListener, this)); 138finders.Add(new ImplementerFinder(symbol, project.Id, AsyncListener, this)); 146return [new FieldReferenceFinder(symbol, project.Id, AsyncListener, this)];
CodeLens\CodeLensCallbackListener.cs (2)
67var projectGuid = _workspace.GetProjectGuid(project.Id); 71var projectVersion = await service.GetProjectCodeLensVersionAsync(solution, project.Id, cancellationToken).ConfigureAwait(false);
Diagnostics\VisualStudioDiagnosticAnalyzerService.cs (3)
104.Where(p => _workspace.GetHierarchy(p.Id) == hierarchy); 341await _codeAnalysisService.RunAnalysisAsync(solution, project?.Id, onAfterProjectAnalyzed, CancellationToken.None).ConfigureAwait(false); 344await _codeAnalysisService.RunAnalysisAsync(solution, otherProject.Id, onAfterProjectAnalyzed, CancellationToken.None).ConfigureAwait(false);
FindReferences\StreamingFindUsagesPresenter.cs (1)
285var guid = vsWorkspace?.GetProjectGuid(document.Project.Id) ?? Guid.Empty;
GenerateType\GenerateTypeDialogViewModel.cs (4)
439this.ProjectFolders = _projectManagementService.GetFolders(this.SelectedProject.Id, this.SelectedProject.Solution.Workspace); 740.Where(p => p != document.Project && !dependencyGraph.GetProjectsThatThisProjectTransitivelyDependsOn(p.Id).Contains(document.Project.Id)) 777this.ProjectFolders = _projectManagementService.GetFolders(this.SelectedProject.Id, this.SelectedProject.Solution.Workspace);
Implementation\AbstractEditorFactory.cs (1)
327var documentId = DocumentId.CreateNewId(projectToAddTo.Id);
Implementation\HierarchyItemToProjectIdMap.cs (5)
50var hierarchy = _workspace.GetHierarchy(p.Id); 59projectId = candidateProjects[0].Id; 67var matchingProject = candidateProjects.FirstOrDefault(p => _workspace.TryGetDependencyNodeTargetIdentifier(p.Id) == targetFrameworkMoniker); 71projectId = matchingProject.Id; 84projectId = candidateProject.Id;
Interactive\VsResetInteractive.cs (1)
165=> _workspace.CurrentSolution.Projects.FirstOrDefault(proj => _workspace.GetHierarchy(proj.Id) == hierarchy);
LanguageServer\Handler\Diagnostics\VisualStudioDiagnosticProjectInformationService.cs (1)
23var guid = workspace.GetProjectGuid(project.Id);
LanguageService\AbstractCreateServicesOnTextViewConnection.cs (1)
102_workQueue.AddWork(e.Document.Project.Id);
Library\ObjectBrowser\AbstractListItemFactory.cs (2)
516set.Add((project.Id, compilation.Assembly)); 526set.Add((project.Id, referenceAssembly));
Library\ObjectBrowser\Extensions.cs (4)
69&& workspace.GetHierarchy(project.Id) is { } hierarchy 85if (other.Id == project.Id) 131var hierarchy = workspace.GetHierarchy(project.Id);
Library\ObjectBrowser\Lists\ProjectListItem.cs (1)
18: base(project.Id, GetProjectGlyph(project))
Library\VsNavInfo\NavInfoFactory.cs (1)
183var hierarchy = workspace.GetHierarchy(project.Id);
Progression\GraphBuilder.cs (1)
163return thisProject.Id;
Progression\GraphQueries\IsUsedByGraphQuery.cs (1)
32var projectId = graphBuilder.GetContextProject(node, cancellationToken).Id;
ProjectSystem\VisualStudioProjectManagementService.cs (1)
44vsWorkspace.GetProjectData(project.Id,
ProjectSystem\VisualStudioWorkspaceImpl.cs (6)
364=> IsCPSProject(project.Id); 400var maxSupportLangVersion = ProjectSystemProjectFactory.TryGetMaxSupportedLanguageVersion(project.Id); 1548if (projects.RemoveAll(p => p.Id == project.Id) > 0) 1559_projectToHierarchyMap = _projectToHierarchyMap.Remove(project.Id); 1560_projectToGuidMap = _projectToGuidMap.Remove(project.Id); 1562ImmutableInterlocked.TryRemove(ref _projectToRuleSetFilePath, project.Id, out _);
Snippets\SnippetExpansionClient.cs (1)
1088var projectId = originalProject.Id;
TableDataSource\Suppression\VisualStudioDiagnosticListSuppressionStateService.cs (1)
287projectId: project.Id);
TableDataSource\Suppression\VisualStudioSuppressionFixService.cs (1)
142return p => projectHierarchy == null || p.Id == projectIdToMatch;
Workspace\VisualStudioDocumentNavigationService.cs (1)
307vsWorkspace.OpenDocumentFromPath(mappedSpanResult.FilePath, generatedDocument.Project.Id);
Workspace\VisualStudioSymbolNavigationService.cs (1)
287hierarchy = visualStudioWorkspace.GetHierarchy(document.Project.Id);
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (3)
PersistentStorage\AbstractPersistentStorageTests.cs (3)
874var id = DocumentId.CreateNewId(solution.Projects.Single().Id); 894var id = DocumentId.CreateNewId(solution.Projects.Single().Id); 993solution = solution.AddDocument(DocumentInfo.Create(DocumentId.CreateNewId(project.Id), "Document1",
Microsoft.VisualStudio.LanguageServices.LiveShare (1)
Client\RemoteLanguageServiceWorkspace.cs (1)
335DocumentId.CreateNewId(project.Id),
Microsoft.VisualStudio.LanguageServices.Xaml (2)
Implementation\LanguageServer\Handler\Diagnostics\AbstractPullDiagnosticHandler.cs (1)
142ProjectIdentifier = project.Id.Id.ToString(),
Implementation\XamlProjectService.cs (1)
204var project = _xamlProjects.Values.SingleOrDefault(p => p.Id == document.Project.Id);
Roslyn.VisualStudio.Next.UnitTests (69)
Remote\RemoteHostClientServiceFactoryTests.cs (1)
48var document = workspace.AddDocument(project.Id, "doc.cs", SourceText.From("code"));
Remote\SnapshotSerializationTests.cs (2)
56solution = document2.Project.Solution.GetRequiredProject(project1.Id) 57.AddProjectReference(new ProjectReference(project2.Id, ["test"]))
Services\ServiceHubServicesTests.cs (3)
293projectId1 = solution.Projects.Single(p => p.Name == "Project0").Id; 294projectId2 = solution.Projects.Single(p => p.Name == "Project1").Id; 1731var projectId = project.Id;
Services\SolutionServiceTests.cs (63)
569var project1Checksum = await solution.CompilationState.GetChecksumAsync(project1.Id, CancellationToken.None); 570await solution.AppendAssetMapAsync(map, project1.Id, CancellationToken.None); 575var project2Checksum = await solution.CompilationState.GetChecksumAsync(project2.Id, CancellationToken.None); 576await solution.AppendAssetMapAsync(map, project2.Id, CancellationToken.None); 601await solution.AppendAssetMapAsync(map, project1.Id, CancellationToken.None); 602var project1Checksum = await solution.CompilationState.GetChecksumAsync(project1.Id, CancellationToken.None); 608await solution.AppendAssetMapAsync(map, project2.Id, CancellationToken.None); 609var project2Checksum = await solution.CompilationState.GetChecksumAsync(project2.Id, CancellationToken.None); 636solution = project3.Solution.AddProjectReference(project3.Id, new(project3.Solution.Projects.Single(p => p.Name == "P2").Id)); 642await solution.AppendAssetMapAsync(map, project2.Id, CancellationToken.None); 643var project2Checksum = await solution.CompilationState.GetChecksumAsync(project2.Id, CancellationToken.None); 649await solution.AppendAssetMapAsync(map, project3.Id, CancellationToken.None); 650var project3Checksum = await solution.CompilationState.GetChecksumAsync(project3.Id, CancellationToken.None); 669solution = project3.Solution.AddProjectReference(project3.Id, new(project3.Solution.Projects.Single(p => p.Name == "P2").Id)); 676await solution.AppendAssetMapAsync(map, project3.Id, CancellationToken.None); 677var project3Checksum = await solution.CompilationState.GetChecksumAsync(project3.Id, CancellationToken.None); 682await solution.AppendAssetMapAsync(map, project2.Id, CancellationToken.None); 683var project2Checksum = await solution.CompilationState.GetChecksumAsync(project2.Id, CancellationToken.None); 689await solution.AppendAssetMapAsync(map, project1.Id, CancellationToken.None); 690var project1Checksum = await solution.CompilationState.GetChecksumAsync(project1.Id, CancellationToken.None); 710solution = project3.Solution.AddProjectReference(project3.Id, new(project2.Id)) 711.AddProjectReference(project2.Id, new(project1.Id)); 718await solution.AppendAssetMapAsync(map, project3.Id, CancellationToken.None); 719var project3Checksum = await solution.CompilationState.GetChecksumAsync(project3.Id, CancellationToken.None); 724await solution.AppendAssetMapAsync(map, project2.Id, CancellationToken.None); 725var project2Checksum = await solution.CompilationState.GetChecksumAsync(project2.Id, CancellationToken.None); 730await solution.AppendAssetMapAsync(map, project1.Id, CancellationToken.None); 731var project1Checksum = await solution.CompilationState.GetChecksumAsync(project1.Id, CancellationToken.None); 750solution = project3.Solution.AddProjectReference(project3.Id, new(project2.Id)) 751.AddProjectReference(project3.Id, new(project1.Id)); 758await solution.AppendAssetMapAsync(map, project3.Id, CancellationToken.None); 759var project3Checksum = await solution.CompilationState.GetChecksumAsync(project3.Id, CancellationToken.None); 764await solution.AppendAssetMapAsync(map, project2.Id, CancellationToken.None); 765var project2Checksum = await solution.CompilationState.GetChecksumAsync(project2.Id, CancellationToken.None); 770await solution.AppendAssetMapAsync(map, project1.Id, CancellationToken.None); 771var project1Checksum = await solution.CompilationState.GetChecksumAsync(project1.Id, CancellationToken.None); 796await solution.AppendAssetMapAsync(map, project1.Id, CancellationToken.None); 797var project1Checksum = await solution.CompilationState.GetChecksumAsync(project1.Id, CancellationToken.None); 803await solution.AppendAssetMapAsync(map, project2.Id, CancellationToken.None); 804var project2Checksum = await solution.CompilationState.GetChecksumAsync(project2.Id, CancellationToken.None); 835solution = solution.GetProject(project1.Id).AddDocument("X.cs", SourceText.From("// X")).Project.Solution; 836solution = solution.GetProject(project2.Id).AddDocument("Y.vb", SourceText.From("' Y")).Project.Solution; 841await solution.AppendAssetMapAsync(map, project1.Id, CancellationToken.None); 842var project1Checksum = await solution.CompilationState.GetChecksumAsync(project1.Id, CancellationToken.None); 853await solution.AppendAssetMapAsync(map, project2.Id, CancellationToken.None); 854var project2Checksum = await solution.CompilationState.GetChecksumAsync(project2.Id, CancellationToken.None); 890solution = solution.GetProject(project1.Id).AddDocument("X.cs", SourceText.From("// X")).Project.Solution; 891solution = solution.GetProject(project2.Id).AddDocument("Y.cs", SourceText.From("// Y")).Project.Solution; 892solution = solution.GetProject(project1.Id).AddProjectReference(new ProjectReference(project2.Id)).Solution; 897await solution.AppendAssetMapAsync(map, project1.Id, CancellationToken.None); 898var project1Checksum = await solution.CompilationState.GetChecksumAsync(project1.Id, CancellationToken.None); 901var project1Synced = project1SyncedSolution.GetRequiredProject(project1.Id); 902var project2Synced = project1SyncedSolution.GetRequiredProject(project2.Id); 930var project1Checksum = await solution.CompilationState.GetChecksumAsync(project1.Id, CancellationToken.None); 966await solution.AppendAssetMapAsync(map, project1.Id, CancellationToken.None); 967var project1Checksum = await solution.CompilationState.GetChecksumAsync(project1.Id, CancellationToken.None);