src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (1)
133Solution solution,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationContext.cs (1)
12Solution Solution,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ISolutionExtensions.cs (13)
17public static IEnumerable<DocumentId> GetChangedDocuments(this Solution? newSolution, Solution oldSolution)
33public static TextDocument? GetTextDocument(this Solution solution, DocumentId? documentId)
36public static Document GetRequiredDocument(this Solution solution, SyntaxTree syntaxTree)
39public static Project GetRequiredProject(this Solution solution, ProjectId projectId)
50public static Document GetRequiredDocument(this Solution solution, DocumentId documentId)
100public static TextDocument GetRequiredAdditionalDocument(this Solution solution, DocumentId documentId)
103public static TextDocument GetRequiredAnalyzerConfigDocument(this Solution solution, DocumentId documentId)
106public static TextDocument GetRequiredTextDocument(this Solution solution, DocumentId documentId)
147public static TextDocument? GetTextDocumentForLocation(this Solution solution, Location location)
161public static TLanguageService? GetLanguageService<TLanguageService>(this Solution? solution, string languageName) where TLanguageService : ILanguageService
164public static TLanguageService GetRequiredLanguageService<TLanguageService>(this Solution solution, string languageName) where TLanguageService : ILanguageService
172public static HostLanguageServices GetExtendedLanguageServices(this Solution solution, string languageName)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SemanticModelReuse\SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs (1)
77var solution = e.NewSolution;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (1)
133Solution solution,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationContext.cs (1)
12Solution Solution,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ISolutionExtensions.cs (13)
17public static IEnumerable<DocumentId> GetChangedDocuments(this Solution? newSolution, Solution oldSolution)
33public static TextDocument? GetTextDocument(this Solution solution, DocumentId? documentId)
36public static Document GetRequiredDocument(this Solution solution, SyntaxTree syntaxTree)
39public static Project GetRequiredProject(this Solution solution, ProjectId projectId)
50public static Document GetRequiredDocument(this Solution solution, DocumentId documentId)
100public static TextDocument GetRequiredAdditionalDocument(this Solution solution, DocumentId documentId)
103public static TextDocument GetRequiredAnalyzerConfigDocument(this Solution solution, DocumentId documentId)
106public static TextDocument GetRequiredTextDocument(this Solution solution, DocumentId documentId)
147public static TextDocument? GetTextDocumentForLocation(this Solution solution, Location location)
161public static TLanguageService? GetLanguageService<TLanguageService>(this Solution? solution, string languageName) where TLanguageService : ILanguageService
164public static TLanguageService GetRequiredLanguageService<TLanguageService>(this Solution solution, string languageName) where TLanguageService : ILanguageService
172public static HostLanguageServices GetExtendedLanguageServices(this Solution solution, string languageName)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SemanticModelReuse\SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs (1)
77var solution = e.NewSolution;
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (12)
51private async Task<Solution> FixNodeAsync(
73private async Task<Solution> RenameThenRemoveAsyncTokenAsync(Document document, SyntaxNode node, IMethodSymbol methodSymbol, CancellationToken cancellationToken)
77var solution = document.Project.Solution;
83var newSolution = await Renamer.RenameSymbolAsync(solution, methodSymbol, new SymbolRenameOptions(), newName, cancellationToken).ConfigureAwait(false);
96private async Task<Solution> RemoveAsyncTokenAsync(
110var newSolution = newDocument.Project.Solution;
119private static async Task<Solution> RemoveAwaitFromCallersAsync(
154private static async Task<Solution> RemoveAwaitFromCallersAsync(
155Solution solution, ImmutableArray<ReferenceLocation> locations, CancellationToken cancellationToken)
157var currentSolution = solution;
170private static async Task<Solution> RemoveAwaitFromCallersAsync(
171Solution currentSolution, IGrouping<Document, ReferenceLocation> group, CancellationToken cancellationToken)
src\Analyzers\Core\CodeFixes\UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (12)
85var solution = context.Document.Project.Solution;
104private async Task<Solution> ProcessResultAsync(
105Solution originalSolution, Solution currentSolution, Diagnostic diagnostic, CancellationToken cancellationToken)
117private async Task<Solution> ProcessResultWorkerAsync(
118Solution originalSolution, Solution currentSolution, Diagnostic diagnostic, CancellationToken cancellationToken)
257var updatedSolution = currentSolution.WithDocumentSyntaxRoot(fieldDocument.Id, newFieldTreeRoot);
314private static async Task<Solution> UpdateReferencesAsync(
315Solution solution,
395Solution originalSolution,
396Solution currentSolution,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (1)
133Solution solution,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationContext.cs (1)
12Solution Solution,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ISolutionExtensions.cs (13)
17public static IEnumerable<DocumentId> GetChangedDocuments(this Solution? newSolution, Solution oldSolution)
33public static TextDocument? GetTextDocument(this Solution solution, DocumentId? documentId)
36public static Document GetRequiredDocument(this Solution solution, SyntaxTree syntaxTree)
39public static Project GetRequiredProject(this Solution solution, ProjectId projectId)
50public static Document GetRequiredDocument(this Solution solution, DocumentId documentId)
100public static TextDocument GetRequiredAdditionalDocument(this Solution solution, DocumentId documentId)
103public static TextDocument GetRequiredAnalyzerConfigDocument(this Solution solution, DocumentId documentId)
106public static TextDocument GetRequiredTextDocument(this Solution solution, DocumentId documentId)
147public static TextDocument? GetTextDocumentForLocation(this Solution solution, Location location)
161public static TLanguageService? GetLanguageService<TLanguageService>(this Solution? solution, string languageName) where TLanguageService : ILanguageService
164public static TLanguageService GetRequiredLanguageService<TLanguageService>(this Solution solution, string languageName) where TLanguageService : ILanguageService
172public static HostLanguageServices GetExtendedLanguageServices(this Solution solution, string languageName)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SemanticModelReuse\SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs (1)
77var solution = e.NewSolution;
NavigationBar\CSharpNavigationBarItemService.cs (4)
63Solution solution, SemanticModel semanticModel, HashSet<INamedTypeSymbol> types, CancellationToken cancellationToken)
189Solution solution, ISymbol member, SemanticModel semanticModel, CancellationToken cancellationToken)
217Solution solution, SyntaxNode node, SemanticModel semanticModel, CancellationToken cancellationToken)
253Solution solution, ISymbol symbol, SyntaxTree tree, CancellationToken cancellationToken)
EditAndContinue\ActiveStatementTrackingService.cs (7)
55public ValueTask<ImmutableArray<ActiveStatementSpan>> GetSpansAsync(Solution solution, DocumentId? documentId, string filePath, CancellationToken cancellationToken)
69public void StartTracking(Solution solution, IActiveStatementSpanFactory spanProvider)
93public ValueTask<ImmutableArray<ActiveStatementSpan>> GetSpansAsync(Solution solution, DocumentId? documentId, string filePath, CancellationToken cancellationToken)
172var compileTimeSolution = _compileTimeSolutionProvider.GetCompileTimeSolution(designTimeDocument.Project.Solution);
192internal async Task TrackActiveSpansAsync(Solution solution)
315public async ValueTask<ImmutableArray<ActiveStatementSpan>> GetSpansAsync(Solution solution, DocumentId? documentId, string filePath, CancellationToken cancellationToken)
356var solution = document.Project.Solution;
RenameTracking\RenameTrackingTaggerProvider.RenameTrackingCommitter.cs (9)
86var solutionWithOriginalName = await CreateSolutionWithOriginalNameAsync(
93var renamedSolution = await Renamer.RenameSymbolAsync(solutionWithOriginalName, symbol, options, newName, cancellationToken).ConfigureAwait(false);
154var finalSolution = workspace.CurrentSolution;
182private async Task<Solution> CreateSolutionWithOriginalNameAsync(
198var solution = document.Project.Solution;
199var finalSolution = solution.WithDocumentTexts(
205private async Task<ISymbol> TryGetSymbolAsync(Solution solutionWithOriginalName, DocumentId documentId, CancellationToken cancellationToken)
223private (NotificationSeverity, string)? TryUpdateWorkspaceForResetOfTypedIdentifier(Workspace workspace, Solution newSolution, int trackingSessionId)
256Solution newSolution,
CodeLens\CodeLensReferencesService.cs (9)
43private static async Task<T?> FindAsync<T>(Solution solution, DocumentId documentId, SyntaxNode syntaxNode,
85public async ValueTask<VersionStamp> GetProjectCodeLensVersionAsync(Solution solution, ProjectId projectId, CancellationToken cancellationToken)
90public async Task<ReferenceCount?> GetReferenceCountAsync(Solution solution, DocumentId documentId, SyntaxNode syntaxNode, int maxSearchResults, CancellationToken cancellationToken)
102private static async Task<ReferenceLocationDescriptorAndDocument> GetDescriptorOfEnclosingSymbolAsync(Solution solution, Location location, CancellationToken cancellationToken)
198public async Task<ImmutableArray<ReferenceLocationDescriptorAndDocument>?> FindReferenceLocationsAsync(Solution solution, DocumentId documentId, SyntaxNode syntaxNode, CancellationToken cancellationToken)
213public async Task<ImmutableArray<ReferenceLocationDescriptor>> MapReferenceLocationsAsync(Solution solution, ImmutableArray<ReferenceLocationDescriptorAndDocument> referenceLocations, ClassificationOptions classificationOptions, CancellationToken cancellationToken)
356private static async Task<ReferenceMethodDescriptor> TryGetMethodDescriptorAsync(Location commonLocation, Solution solution, CancellationToken cancellationToken)
370public Task<ImmutableArray<ReferenceMethodDescriptor>?> FindReferenceMethodsAsync(Solution solution, DocumentId documentId, SyntaxNode syntaxNode, CancellationToken cancellationToken)
386public async Task<string> GetFullyQualifiedNameAsync(Solution solution, DocumentId documentId, SyntaxNode syntaxNode,
CodeLens\ICodeLensReferencesService.cs (6)
15ValueTask<VersionStamp> GetProjectCodeLensVersionAsync(Solution solution, ProjectId projectId, CancellationToken cancellationToken);
24Task<ReferenceCount?> GetReferenceCountAsync(Solution solution, DocumentId documentId, SyntaxNode? syntaxNode, int maxSearchResults, CancellationToken cancellationToken);
29Task<ImmutableArray<ReferenceLocationDescriptorAndDocument>?> FindReferenceLocationsAsync(Solution solution, DocumentId documentId, SyntaxNode? syntaxNode, CancellationToken cancellationToken);
34Task<ImmutableArray<ReferenceLocationDescriptor>> MapReferenceLocationsAsync(Solution solution, ImmutableArray<ReferenceLocationDescriptorAndDocument> referenceLocations, ClassificationOptions classificationOptions, CancellationToken cancellationToken);
39Task<ImmutableArray<ReferenceMethodDescriptor>?> FindReferenceMethodsAsync(Solution solution, DocumentId documentId, SyntaxNode? syntaxNode, CancellationToken cancellationToken);
44Task<string?> GetFullyQualifiedNameAsync(Solution solution, DocumentId documentId, SyntaxNode? syntaxNode, CancellationToken cancellationToken);
CodeRefactorings\SyncNamespace\AbstractChangeNamespaceService.cs (23)
42public abstract Task<Solution> ChangeNamespaceAsync(Document document, SyntaxNode container, string targetNamespace, CancellationToken cancellationToken);
44public abstract Task<Solution?> TryChangeTopLevelNamespacesAsync(Document document, string targetNamespace, CancellationToken cancellationToken);
126public override async Task<Solution?> TryChangeTopLevelNamespacesAsync(
144var solution = document.Project.Solution;
182public override async Task<Solution> ChangeNamespaceAsync(
201var solution = document.Project.Solution;
213var annotatedSolution = await AnnotateContainersAsync(solution, containersFromAllDocuments, cancellationToken).ConfigureAwait(false);
224var solutionAfterNamespaceChange = annotatedSolution;
235var solutionAfterFirstMerge = await MergeDiffAsync(solution, solutionAfterNamespaceChange, cancellationToken).ConfigureAwait(false);
254var solutionAfterImportsRemoved = await RemoveUnnecessaryImportsAsync(
270Solution solution,
312protected static async Task<Solution> AnnotateContainersAsync(Solution solution, ImmutableArray<(DocumentId, SyntaxNode)> containers, CancellationToken cancellationToken)
349var solution = document.Project.Solution;
428private async Task<(Solution, ImmutableArray<DocumentId>)> ChangeNamespaceInSingleDocumentAsync(
429Solution solution,
471var solutionWithChangedNamespace = documentWithNewNamespace.Project.Solution;
502var solutionWithFixedReferences = solutionWithChangedNamespace.WithDocumentSyntaxRoots(fixedDocuments);
800private static async Task<Solution> RemoveUnnecessaryImportsAsync(
801Solution solution,
890private static async Task<Solution> MergeDiffAsync(Solution oldSolution, Solution newSolution, CancellationToken cancellationToken)
EditAndContinue\IEditAndContinueService.cs (3)
22ValueTask<EmitSolutionUpdateResults> EmitSolutionUpdateAsync(DebuggingSessionId sessionId, Solution solution, ImmutableDictionary<ProjectId, RunningProjectOptions> runningProjects, ActiveStatementSpanProvider activeStatementSpanProvider, CancellationToken cancellationToken);
27DebuggingSessionId StartDebuggingSession(Solution solution, IManagedHotReloadService debuggerService, IPdbMatchingSourceTextProvider sourceTextProvider, bool reportDiagnostics);
31ValueTask<ImmutableArray<ImmutableArray<ActiveStatementSpan>>> GetBaseActiveStatementSpansAsync(DebuggingSessionId sessionId, Solution solution, ImmutableArray<DocumentId> documentIds, CancellationToken cancellationToken);
EncapsulateField\AbstractEncapsulateFieldService.cs (14)
110public async Task<Solution> EncapsulateFieldsAsync(
118var solution = document.Project.Solution;
141private async Task<Solution> EncapsulateFieldsInCurrentProcessAsync(Document document, ImmutableArray<IFieldSymbol> fields, bool updateReferences, CancellationToken cancellationToken)
146var currentSolution = document.Project.Solution;
157var nextSolution = await EncapsulateFieldAsync(document, currentField, updateReferences, cancellationToken).ConfigureAwait(false);
167private async Task<Solution?> EncapsulateFieldAsync(
182var solution = document.Project.Solution;
193var solutionNeedingProperty = await UpdateReferencesAsync(
230private async Task<Solution> UpdateReferencesAsync(
231bool updateReferences, Solution solution, Document document, IFieldSymbol field, string finalFieldName, string generatedPropertyName, CancellationToken cancellationToken)
275private static async Task<Solution> RenameAsync(
276Solution solution,
311private ISet<(DocumentId documentId, TextSpan span)> GetConstructorLocations(Solution solution, INamedTypeSymbol containingType)
318Solution destinationSolution,
ExternalAccess\UnitTesting\SolutionCrawler\UnitTestingWorkCoordinator.cs (15)
106var solution = Registration.GetSolutionToAnalyze();
218private void EnqueueSolutionChangedEvent(Solution oldSolution, Solution newSolution)
243private void EnqueueFullSolutionEvent(Solution solution, UnitTestingInvocationReasons invocationReasons)
255private void EnqueueProjectChangedEvent(Solution oldSolution, Solution newSolution, ProjectId projectId)
267private void EnqueueFullProjectEvent(Solution solution, ProjectId projectId, UnitTestingInvocationReasons invocationReasons)
273private void EnqueueFullDocumentEvent(Solution solution, DocumentId documentId, UnitTestingInvocationReasons invocationReasons)
283private void EnqueueDocumentChangedEvent(Solution oldSolution, Solution newSolution, DocumentId documentId)
388var solution = Registration.GetSolutionToAnalyze();
494var solution = _workCoordinator.Registration.GetSolutionToAnalyze();
545public string GetLanguagesStringForTelemetry(Solution solution)
591public int GetDocumentCount(Solution solution)
634public IEnumerable<(Project project, DocumentId documentId)> GetDocumentIds(Solution solution)
ExtractInterface\AbstractExtractInterfaceService.cs (17)
35protected abstract Task<Solution> UpdateMembersWithExplicitImplementationsAsync(
36Solution unformattedSolution,
138var solution = refactoringResult.DocumentToExtractFrom.Project.Solution;
174Solution solution, string containingNamespaceDisplay, INamedTypeSymbol extractedInterfaceSymbol,
194var completedUnformattedSolution = await GetSolutionWithOriginalTypeUpdatedAsync(
204var completedSolution = await GetFormattedSolutionAsync(
216Solution solution, ExtractInterfaceTypeAnalysisResult refactoringResult, INamedTypeSymbol extractedInterfaceSymbol,
234var unformattedSolution = documentWithInterface.Project.Solution;
237var unformattedSolutionWithUpdatedType = await GetSolutionWithOriginalTypeUpdatedAsync(
243var completedSolution = await GetFormattedSolutionAsync(
277private static async Task<Solution> GetFormattedSolutionAsync(Solution unformattedSolution, IEnumerable<DocumentId> documentIds, CancellationToken cancellationToken)
282var formattedSolution = unformattedSolution;
307private async Task<Solution> GetSolutionWithOriginalTypeUpdatedAsync(
308Solution solution,
325var unformattedSolution = solution;
352var updatedUnformattedSolution = await UpdateMembersWithExplicitImplementationsAsync(
FindUsages\DefinitionItemFactory.cs (9)
31Solution solution,
38Solution solution,
47Solution solution,
68Solution solution,
82Solution solution,
101Solution solution,
158internal static AssemblyLocation GetMetadataLocation(IAssemblySymbol assembly, Solution solution, out ProjectId originatingProjectId)
168internal static ImmutableArray<AssemblyLocation> GetMetadataLocations(ISymbol definition, Solution solution, out ProjectId? originatingProjectId)
229Solution solution,
InheritanceMargin\AbstractInheritanceMarginService_Helpers.cs (11)
58var solution = project.Solution;
282Solution solution,
342Solution solution,
400Solution solution,
439Solution solution,
465Solution solution,
506Solution solution,
557Solution solution,
625Solution solution,
679Solution solution,
715Solution solution, ISymbol symbol, CancellationToken cancellation)
MoveStaticMembers\MoveStaticMembersWithDialogCodeAction.cs (12)
68var fixedSolution = await RefactorAndMoveAsync(
120var solutionWithFixedReferences = await RefactorReferencesAsync(projectToLocations, newDoc.Project.Solution, newType, typeArgIndices, cancellationToken).ConfigureAwait(false);
141var movedSolution = await MembersPuller.PullMembersUpAsync(sourceDoc, pullMembersUpOptions, cancellationToken).ConfigureAwait(false);
167private static async Task<Solution> RefactorAndMoveAsync(
170Solution oldSolution,
203var solutionWithFixedReferences = await RefactorReferencesAsync(projectToLocations, oldSolution, newType, typeArgIndices, cancellationToken).ConfigureAwait(false);
233private static async Task<Solution> RefactorReferencesAsync(
235Solution solution,
241var updatedSolution = solution;
362Solution solution,
396private static async Task<Solution> QualifyStaticMemberReferencesAsync(
397Solution solution,
NavigateTo\NavigateToSearcher.cs (5)
46private readonly Solution _solution;
59Solution solution,
94Solution solution,
106Solution solution,
535public async Task SearchProjectsAsync(Solution solution, ImmutableArray<Project> projects, ImmutableArray<Document> priorityDocuments, string searchPattern, IImmutableSet<string> kinds, Document? activeDocument, Func<ImmutableArray<INavigateToSearchResult>, Task> onResultsFound, Func<Task> onProjectCompleted, CancellationToken cancellationToken)
NavigationBar\AbstractNavigationBarItemService.cs (3)
44Solution solution, ISymbol symbol, SyntaxTree tree, Func<SyntaxReference, TextSpan> computeFullSpan)
50Solution solution, ISymbol symbol, SyntaxTree tree,
91Solution solution, ISymbol symbol, SyntaxTree tree, ISymbolDeclarationService symbolDeclarationService)
ReplaceMethodWithProperty\ReplaceMethodWithPropertyCodeRefactoringProvider.cs (14)
151private static async Task<Solution> ReplaceMethodsWithPropertyAsync(
162var originalSolution = project.Solution;
180var updatedSolution = originalSolution;
188private static async Task<Solution> UpdateReferencesAsync(Solution updatedSolution, string propertyName, bool nameChanged, ILookup<Document, ReferenceLocation> getReferencesByDocument, ILookup<Document, ReferenceLocation> setReferencesByDocument, CancellationToken cancellationToken)
205private static async Task<Solution> UpdateReferencesInDocumentAsync(
208Solution updatedSolution,
311private static async Task<Solution> ReplaceGetMethodsAndRemoveSetMethodsAsync(
312Solution originalSolution,
313Solution updatedSolution,
339private static async Task<Solution> ReplaceGetMethodsAndRemoveSetMethodsAsync(
342Solution updatedSolution,
398Solution updatedSolution,
446Solution originalSolution,
src\Analyzers\Core\CodeFixes\MakeMethodSynchronous\AbstractMakeMethodSynchronousCodeFixProvider.cs (12)
51private async Task<Solution> FixNodeAsync(
73private async Task<Solution> RenameThenRemoveAsyncTokenAsync(Document document, SyntaxNode node, IMethodSymbol methodSymbol, CancellationToken cancellationToken)
77var solution = document.Project.Solution;
83var newSolution = await Renamer.RenameSymbolAsync(solution, methodSymbol, new SymbolRenameOptions(), newName, cancellationToken).ConfigureAwait(false);
96private async Task<Solution> RemoveAsyncTokenAsync(
110var newSolution = newDocument.Project.Solution;
119private static async Task<Solution> RemoveAwaitFromCallersAsync(
154private static async Task<Solution> RemoveAwaitFromCallersAsync(
155Solution solution, ImmutableArray<ReferenceLocation> locations, CancellationToken cancellationToken)
157var currentSolution = solution;
170private static async Task<Solution> RemoveAwaitFromCallersAsync(
171Solution currentSolution, IGrouping<Document, ReferenceLocation> group, CancellationToken cancellationToken)
src\Analyzers\Core\CodeFixes\UpgradeProject\AbstractUpgradeProjectCodeFixProvider.cs (7)
22public abstract Solution UpgradeProject(Project project, string version);
44var solution = project.Solution;
76public Solution UpgradeAllProjects(Solution solution, string language, string version, CancellationToken cancellationToken)
78var currentSolution = solution;
127private ProjectOptionsChangeAction(string title, Func<IProgress<CodeAnalysisProgress>, CancellationToken, Task<Solution>> createChangedSolution)
132public static ProjectOptionsChangeAction Create(string title, Func<IProgress<CodeAnalysisProgress>, CancellationToken, Task<Solution>> createChangedSolution)
src\Analyzers\Core\CodeFixes\UseAutoProperty\AbstractUseAutoPropertyCodeFixProvider.cs (12)
85var solution = context.Document.Project.Solution;
104private async Task<Solution> ProcessResultAsync(
105Solution originalSolution, Solution currentSolution, Diagnostic diagnostic, CancellationToken cancellationToken)
117private async Task<Solution> ProcessResultWorkerAsync(
118Solution originalSolution, Solution currentSolution, Diagnostic diagnostic, CancellationToken cancellationToken)
257var updatedSolution = currentSolution.WithDocumentSyntaxRoot(fieldDocument.Id, newFieldTreeRoot);
314private static async Task<Solution> UpdateReferencesAsync(
315Solution solution,
395Solution originalSolution,
396Solution currentSolution,
CodeActions\CodeAction.cs (32)
131static codeAction => new Func<CancellationToken, Task<Solution?>>(codeAction.GetChangedSolutionAsync).Method.DeclaringType != typeof(CodeAction));
239Solution originalSolution, IProgress<CodeAnalysisProgress> progress, CancellationToken cancellationToken)
245Solution originalSolution, IProgress<CodeAnalysisProgress> progress, CancellationToken cancellationToken)
264Solution originalSolution, CancellationToken cancellationToken)
284var changedSolution = await GetChangedSolutionAsync(CodeAnalysisProgress.None, cancellationToken).ConfigureAwait(false);
310var changedSolution = await GetChangedSolutionAsync(progress, cancellationToken).ConfigureAwait(false);
332protected virtual async Task<Solution?> GetChangedSolutionAsync(CancellationToken cancellationToken)
344protected virtual async Task<Solution?> GetChangedSolutionAsync(IProgress<CodeAnalysisProgress> progress, CancellationToken cancellationToken)
361internal async Task<Solution> GetRequiredChangedSolutionAsync(IProgress<CodeAnalysisProgress> progressTracker, CancellationToken cancellationToken)
363var solution = await this.GetChangedSolutionAsync(progressTracker, cancellationToken).ConfigureAwait(false);
402internal async Task<Solution?> GetChangedSolutionInternalAsync(
403Solution originalSolution, IProgress<CodeAnalysisProgress> progress, CancellationToken cancellationToken)
405var solution = await GetChangedSolutionAsync(progress, cancellationToken).ConfigureAwait(false);
427Solution? originalSolution, IEnumerable<CodeActionOperation> operations, CancellationToken cancellationToken)
453protected Task<Solution> PostProcessChangesAsync(Solution changedSolution, CancellationToken cancellationToken)
513/// Creates a <see cref="CodeAction"/> for a change to more than one <see cref="Document"/> within a <see cref="Solution"/>.
517/// <param name="createChangedSolution">Function to create the <see cref="Solution"/>.</param>
520public static CodeAction Create(string title, Func<CancellationToken, Task<Solution>> createChangedSolution, string? equivalenceKey)
524/// Creates a <see cref="CodeAction"/> for a change to more than one <see cref="Document"/> within a <see cref="Solution"/>.
528/// <param name="createChangedSolution">Function to create the <see cref="Solution"/>.</param>
531public static CodeAction Create(string title, Func<CancellationToken, Task<Solution>> createChangedSolution, string? equivalenceKey = null, CodeActionPriority priority = CodeActionPriority.Default)
534/// <inheritdoc cref="Create(string, Func{CancellationToken, Task{Solution}}, string?, CodeActionPriority)"/>
536public static CodeAction Create(string title, Func<IProgress<CodeAnalysisProgress>, CancellationToken, Task<Solution>> createChangedSolution, string? equivalenceKey = null, CodeActionPriority priority = CodeActionPriority.Default)
540string title, Func<IProgress<CodeAnalysisProgress>, CancellationToken, Task<Solution>> createChangedSolution, string? equivalenceKey, CodeActionPriority priority, CodeActionCleanup cleanup)
699private readonly Func<IProgress<CodeAnalysisProgress>, CancellationToken, Task<Solution>> _createChangedSolution;
705Func<IProgress<CodeAnalysisProgress>, CancellationToken, Task<Solution>> createChangedSolution,
718Func<IProgress<CodeAnalysisProgress>, CancellationToken, Task<Solution>> createChangedSolution,
728Func<IProgress<CodeAnalysisProgress>, CancellationToken, Task<Solution>> createChangedSolution,
734protected sealed override Task<Solution?> GetChangedSolutionAsync(IProgress<CodeAnalysisProgress> progress, CancellationToken cancellationToken)
755protected sealed override Task<Solution?> GetChangedSolutionAsync(IProgress<CodeAnalysisProgress> progress, CancellationToken cancellationToken)
756=> SpecializedTasks.Null<Solution>();
CodeActions\CodeAction_Cleanup.cs (15)
75Solution originalSolution,
76Solution changedSolution)
88internal static async Task<Solution> PostProcessChangesAsync(
89Solution? originalSolution,
90Solution changedSolution,
110private static async Task<Solution> CleanSyntaxAndSemanticsAsync(
111Solution originalSolution,
112Solution changedSolution,
121var cleanedSolution = await RunCleanupPassesInOrderAsync(
153var cleanedSolution = await RunCleanupPassesInOrderAsync(
163private static async Task<Solution> RunCleanupPassesInOrderAsync(
164Solution solution,
173var currentSolution = solution;
179async Task<Solution> RunParallelCleanupPassAsync(
180Solution solution, Func<Document, CodeCleanupOptions, CancellationToken, Task<Document>> cleanupDocumentAsync)
FindSymbols\Declarations\DeclarationFinder_SourceDeclarations.cs (4)
26Solution solution, string name, bool ignoreCase, SymbolFilter criteria, CancellationToken cancellationToken)
102Solution solution, string pattern, SymbolFilter criteria, CancellationToken cancellationToken)
176Solution solution, string name, bool ignoreCase, SymbolFilter criteria, CancellationToken cancellationToken)
238Solution solution, string pattern, SymbolFilter criteria, CancellationToken cancellationToken)
FindSymbols\FindReferences\DependentProjectsFinder.cs (8)
34Solution,
41Solution solution, ImmutableArray<ISymbol> symbols, IImmutableSet<Project> projects, CancellationToken cancellationToken)
74Solution solution, ImmutableArray<ISymbol> symbols, CancellationToken cancellationToken)
115Solution solution, ImmutableArray<ISymbol> symbols, CancellationToken cancellationToken)
145Solution solution,
173Solution solution,
203Solution solution, Project? sourceProject, HashSet<(Project project, bool hasInternalsAccess)> dependentProjects, CancellationToken cancellationToken)
268Solution solution,
FindSymbols\FindReferences\Finders\MethodTypeParameterSymbolReferenceFinder.cs (1)
28Solution solution,
FindSymbols\FindReferences\Finders\PropertyAccessorSymbolReferenceFinder.cs (1)
21Solution solution,
FindSymbols\SymbolFinder_Declarations_CustomQueries.cs (3)
28public static Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Solution solution, Func<string, bool> predicate, CancellationToken cancellationToken = default)
34public static async Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Solution solution, Func<string, bool> predicate, SymbolFilter filter, CancellationToken cancellationToken = default)
44Solution solution, SearchQuery query, SymbolFilter filter, CancellationToken cancellationToken)
FindSymbols\SymbolFinder_Declarations_SourceDeclarations.cs (4)
20public static Task<IEnumerable<ISymbol>> FindSourceDeclarationsAsync(Solution solution, string name, bool ignoreCase, CancellationToken cancellationToken = default)
27Solution solution, string name, bool ignoreCase, SymbolFilter filter, CancellationToken cancellationToken = default)
67public static Task<IEnumerable<ISymbol>> FindSourceDeclarationsWithPatternAsync(Solution solution, string pattern, CancellationToken cancellationToken = default)
78Solution solution, string pattern, SymbolFilter filter, CancellationToken cancellationToken = default)
FindSymbols\SymbolFinder_Hierarchy.cs (21)
27ISymbol symbol, Solution solution, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
37ISymbol symbol, Solution solution, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
76internal static bool IsOverride(Solution solution, ISymbol member, ISymbol symbol, bool allowLooseMatch)
93ISymbol symbol, Solution solution, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
102ISymbol symbol, Solution solution, CancellationToken cancellationToken)
115Solution solution,
203/// "derived", but can be found with <see cref="FindImplementationsAsync(ISymbol, Solution,
213INamedTypeSymbol type, Solution solution, IImmutableSet<Project>? projects, CancellationToken cancellationToken)
220/// "derived", but can be found with <see cref="FindImplementationsAsync(ISymbol, Solution,
231INamedTypeSymbol type, Solution solution, bool transitive = true, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
243/// <inheritdoc cref="FindDerivedClassesArrayAsync(INamedTypeSymbol, Solution, bool, IImmutableSet{Project}, CancellationToken)"/>
246INamedTypeSymbol type, Solution solution, bool transitive, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
267INamedTypeSymbol type, Solution solution, bool transitive = true, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
279/// <inheritdoc cref="FindDerivedInterfacesAsync(INamedTypeSymbol, Solution, bool, IImmutableSet{Project}, CancellationToken)"/>
282INamedTypeSymbol type, Solution solution, bool transitive, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
303INamedTypeSymbol type, Solution solution, bool transitive = true, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
315/// <inheritdoc cref="FindImplementationsAsync(INamedTypeSymbol, Solution, bool, IImmutableSet{Project}, CancellationToken)"/>
318INamedTypeSymbol type, Solution solution, bool transitive, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
332ISymbol symbol, Solution solution, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
351/// <inheritdoc cref="FindImplementationsAsync(ISymbol, Solution, IImmutableSet{Project}, CancellationToken)"/>
356ISymbol symbol, Solution solution, IImmutableSet<Project>? projects = null, CancellationToken cancellationToken = default)
Remote\RemoteArguments.cs (6)
60Solution solution, ISymbol symbol, CancellationToken cancellationToken)
72ISymbol symbol, Solution solution, CancellationToken cancellationToken,
100Solution solution, CancellationToken cancellationToken)
173Solution solution, CancellationToken cancellationToken)
190Solution solution, CancellationToken cancellationToken)
235public static SerializableSymbolGroup Dehydrate(Solution solution, SymbolGroup group, CancellationToken cancellationToken)
Remote\RemoteHostClient.cs (10)
103Solution solution,
122Solution solution,
134/// Equivalent to <see cref="TryInvokeAsync{TService}(Solution, Func{TService, Checksum, CancellationToken, ValueTask}, CancellationToken)"/>
161/// Equivalent to <see cref="TryInvokeAsync{TService}(Solution, Func{TService, Checksum, CancellationToken, ValueTask}, CancellationToken)"/>
179Solution solution,
190Solution solution,
203/// Equivalent to <see cref="TryInvokeAsync{TService}(Solution, Func{TService, Checksum, RemoteServiceCallbackId, CancellationToken, ValueTask}, object, CancellationToken)"/>
220/// Equivalent to <see cref="TryInvokeAsync{TService}(Solution, Func{TService, Checksum, RemoteServiceCallbackId, CancellationToken, ValueTask}, object, CancellationToken)"/>
239Solution solution1,
240Solution solution2,
Rename\IRenameRewriterLanguageService.cs (4)
57Solution baseSolution,
58Solution newSolution,
124public abstract Task<ImmutableArray<Location>> ComputeDeclarationConflictsAsync(string replacementText, ISymbol renamedSymbol, ISymbol renameSymbol, IEnumerable<ISymbol> referencedSymbols, Solution baseSolution, Solution newSolution, IDictionary<Location, Location> reverseMappedLocations, CancellationToken cancellationToken);
Rename\Renamer.cs (7)
38public static Task<Solution> RenameSymbolAsync(Solution solution, ISymbol symbol, string newName, OptionSet? optionSet, CancellationToken cancellationToken = default)
41public static async Task<Solution> RenameSymbolAsync(
42Solution solution, ISymbol symbol, SymbolRenameOptions options, string newName, CancellationToken cancellationToken = default)
139internal static Task<LightweightRenameLocations> FindRenameLocationsAsync(Solution solution, ISymbol symbol, SymbolRenameOptions options, CancellationToken cancellationToken)
143Solution solution,
185Solution solution,
Rename\Renamer.RenameDocumentActionSet.cs (11)
19/// document metadata will still be updated by calling <see cref="UpdateSolutionAsync(Solution, ImmutableArray{RenameDocumentAction}, CancellationToken)"/>
21/// To apply all actions use <see cref="UpdateSolutionAsync(Solution, CancellationToken)"/>, or use a subset
22/// of the actions by calling <see cref="UpdateSolutionAsync(Solution, ImmutableArray{RenameDocumentAction}, CancellationToken)"/>.
49/// contents rather than metadata. Document metadata will still not be updated unless <see cref="UpdateSolutionAsync(Solution, ImmutableArray{RenameDocumentAction}, CancellationToken)" />
55/// Same as calling <see cref="UpdateSolutionAsync(Solution, ImmutableArray{RenameDocumentAction}, CancellationToken)"/> with
58public Task<Solution> UpdateSolutionAsync(Solution solution, CancellationToken cancellationToken)
70/// immediately call <see cref="UpdateSolutionAsync(Solution, ImmutableArray{RenameDocumentAction}, CancellationToken)"/> without
73public async Task<Solution> UpdateSolutionAsync(Solution solution, ImmutableArray<RenameDocumentAction> actions, CancellationToken cancellationToken)
113private Document GetDocument(Solution solution)
Rename\SymbolicRenameLocations.ReferenceProcessing.cs (5)
32ISymbol referencedSymbol, ISymbol originalSymbol, Solution solution, bool considerSymbolReferences, CancellationToken cancellationToken)
137ISymbol symbol, Solution solution, CancellationToken cancellationToken)
162ISymbol referencedSymbol, ISymbol originalSymbol, Solution solution, CancellationToken cancellationToken)
246ISymbol referencedSymbol, ISymbol originalSymbol, ReferenceLocation location, Solution solution, CancellationToken cancellationToken)
327Solution solution,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (1)
133Solution solution,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationContext.cs (1)
12Solution Solution,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ISolutionExtensions.cs (19)
17public static IEnumerable<DocumentId> GetChangedDocuments(this Solution? newSolution, Solution oldSolution)
33public static TextDocument? GetTextDocument(this Solution solution, DocumentId? documentId)
36public static Document GetRequiredDocument(this Solution solution, SyntaxTree syntaxTree)
39public static Project GetRequiredProject(this Solution solution, ProjectId projectId)
50public static Document GetRequiredDocument(this Solution solution, DocumentId documentId)
77public static SourceGeneratedDocument GetRequiredSourceGeneratedDocumentForAlreadyGeneratedId(this Solution solution, DocumentId documentId)
90public static ValueTask<Document> GetRequiredDocumentAsync(this Solution solution, DocumentId documentId, CancellationToken cancellationToken)
93public static async ValueTask<Document> GetRequiredDocumentAsync(this Solution solution, DocumentId documentId, bool includeSourceGenerated, CancellationToken cancellationToken)
96public static async ValueTask<TextDocument> GetRequiredTextDocumentAsync(this Solution solution, DocumentId documentId, CancellationToken cancellationToken = default)
100public static TextDocument GetRequiredAdditionalDocument(this Solution solution, DocumentId documentId)
103public static TextDocument GetRequiredAnalyzerConfigDocument(this Solution solution, DocumentId documentId)
106public static TextDocument GetRequiredTextDocument(this Solution solution, DocumentId documentId)
124public static Solution WithUpToDateSourceGeneratorDocuments(this Solution solution, IEnumerable<ProjectId> projectIds)
147public static TextDocument? GetTextDocumentForLocation(this Solution solution, Location location)
161public static TLanguageService? GetLanguageService<TLanguageService>(this Solution? solution, string languageName) where TLanguageService : ILanguageService
164public static TLanguageService GetRequiredLanguageService<TLanguageService>(this Solution solution, string languageName) where TLanguageService : ILanguageService
172public static HostLanguageServices GetExtendedLanguageServices(this Solution solution, string languageName)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SemanticModelReuse\SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs (1)
77var solution = e.NewSolution;
Workspace\ProjectSystem\ProjectSystemProject.BatchingDocumentCollection.cs (14)
66private readonly Func<Solution, DocumentId, bool> _documentAlreadyInWorkspace;
69private readonly Func<Solution, DocumentId, TextLoader, Solution> _documentTextLoaderChangedAction;
85Func<Solution, DocumentId, bool> documentAlreadyInWorkspace,
88Func<Solution, DocumentId, TextLoader, Solution> documentTextLoaderChangedAction,
565Func<Solution, ImmutableArray<DocumentInfo>, Solution> addDocuments,
567Func<Solution, ImmutableArray<DocumentId>, Solution> removeDocuments,
580Func<Solution, ImmutableArray<DocumentInfo>, Solution> addDocuments,
582Func<Solution, ImmutableArray<DocumentId>, Solution> removeDocuments,
Workspace\ProjectSystem\ProjectSystemProject.cs (8)
220private void ChangeProjectProperty<T>(ref T field, T newValue, Func<Solution, Solution> updateSolution, bool logThrowAwayTelemetry = false)
306Solution solution, ProjectId projectId)
335private void ChangeProjectOutputPath(ref string? field, string? newValue, Func<Solution, Solution> withNewValue)
783public static (Solution newSolution, ProjectUpdateState newProjectUpdateState) UpdateProjectAnalyzerReferences(
784Solution solution,
840var newSolution = solution.WithProjectAnalyzerReferences(project.Id, isolatedReferences);
Workspace\ProjectSystem\ProjectSystemProjectFactory.cs (14)
156var newSolution = w.CreateSolution(solutionInfo);
271public void ApplyChangeToWorkspace(ProjectId projectId, Func<CodeAnalysis.Solution, CodeAnalysis.Solution> solutionTransformation)
547Constraint = "Avoid calling " + nameof(CodeAnalysis.Solution.GetProject) + " to avoid realizing all projects.")]
575var newSolution = solutionChanges.Solution
596Constraint = "Avoid calling " + nameof(CodeAnalysis.Solution.GetProject) + " to avoid realizing all projects.")]
597private static bool CanConvertMetadataReferenceToProjectReference(Solution solution, ProjectState projectWithMetadataReference, ProjectState candidateProjectToReference)
672var newSolution = solutionChanges.Solution.RemoveProjectReference(projectIdToRetarget, convertedReference.ProjectReference)
704Solution currentSolution,
834var newSolution = solution
899Func<Solution, ProjectId, ProjectUpdateState, TReference, TReference, (Solution newSolution, ProjectUpdateState newProjectUpdateState)> update,
906var initialSolution = solutionChanges.Solution;
921var newSolution = solutionChanges.Solution;
Workspace\Solution\Solution.cs (111)
37private readonly AsyncLazy<Solution> _cachedFrozenSolution;
43private readonly Dictionary<DocumentId, AsyncLazy<Solution>> _documentIdToFrozenSolution = [];
47AsyncLazy<Solution>? cachedFrozenSolution = null)
164private static readonly Func<ProjectId, Solution, Project> s_createProjectFunction = CreateProject;
165private static Project CreateProject(ProjectId projectId, Solution solution)
351private Solution WithCompilationState(SolutionCompilationState compilationState)
367public Solution AddProject(ProjectId projectId, string name, string assemblyName, string language)
371public Solution AddProject(ProjectInfo projectInfo)
379internal Solution AddProjects(ArrayBuilder<ProjectInfo> projectInfos)
383public Solution RemoveProject(ProjectId projectId)
391internal Solution RemoveProjects(ArrayBuilder<ProjectId> projectIds)
398public Solution WithProjectAssemblyName(ProjectId projectId, string assemblyName)
413public Solution WithProjectOutputFilePath(ProjectId projectId, string? outputFilePath)
423public Solution WithProjectOutputRefFilePath(ProjectId projectId, string? outputRefFilePath)
433public Solution WithProjectCompilationOutputInfo(ProjectId projectId, in CompilationOutputInfo info)
443public Solution WithProjectDefaultNamespace(ProjectId projectId, string? defaultNamespace)
453internal Solution WithProjectChecksumAlgorithm(ProjectId projectId, SourceHashAlgorithm checksumAlgorithm)
463public Solution WithProjectName(ProjectId projectId, string name)
478public Solution WithProjectFilePath(ProjectId projectId, string? filePath)
489public Solution WithProjectCompilationOptions(ProjectId projectId, CompilationOptions options)
505public Solution WithProjectParseOptions(ProjectId projectId, ParseOptions options)
520internal Solution WithFallbackAnalyzerOptions(ImmutableDictionary<string, StructuredAnalyzerConfigOptions> options)
528internal Solution WithHasAllInformation(ProjectId projectId, bool hasAllInformation)
540internal Solution WithRunAnalyzers(ProjectId projectId, bool runAnalyzers)
551internal Solution WithHasSdkCodeStyleAnalyzers(ProjectId projectId, bool hasSdkCodeStyleAnalyzers)
567public Solution WithProjectDocumentsOrder(ProjectId projectId, ImmutableList<DocumentId> documentIds)
582internal Solution WithProjectAttributes(ProjectInfo.ProjectAttributes attributes)
591internal Solution WithProjectInfo(ProjectInfo info)
605public Solution AddProjectReference(ProjectId projectId, ProjectReference projectReference)
621public Solution AddProjectReferences(ProjectId projectId, IEnumerable<ProjectReference> projectReferences)
651public Solution RemoveProjectReference(ProjectId projectId, ProjectReference projectReference)
682public Solution WithProjectReferences(ProjectId projectId, IEnumerable<ProjectReference>? projectReferences)
703public Solution AddMetadataReference(ProjectId projectId, MetadataReference metadataReference)
718public Solution AddMetadataReferences(ProjectId projectId, IEnumerable<MetadataReference> metadataReferences)
745public Solution RemoveMetadataReference(ProjectId projectId, MetadataReference metadataReference)
767public Solution WithProjectMetadataReferences(ProjectId projectId, IEnumerable<MetadataReference> metadataReferences)
783public Solution AddAnalyzerReference(ProjectId projectId, AnalyzerReference analyzerReference)
798public Solution AddAnalyzerReferences(ProjectId projectId, IEnumerable<AnalyzerReference> analyzerReferences)
832public Solution RemoveAnalyzerReference(ProjectId projectId, AnalyzerReference analyzerReference)
861public Solution WithProjectAnalyzerReferences(ProjectId projectId, IEnumerable<AnalyzerReference> analyzerReferences)
874public Solution AddAnalyzerReference(AnalyzerReference analyzerReference)
886public Solution AddAnalyzerReferences(IEnumerable<AnalyzerReference> analyzerReferences)
910public Solution RemoveAnalyzerReference(AnalyzerReference analyzerReference)
926public Solution WithAnalyzerReferences(IEnumerable<AnalyzerReference> analyzerReferences)
940public Solution AddDocument(DocumentId documentId, string name, string text, IEnumerable<string>? folders = null, string? filePath = null)
958public Solution AddDocument(DocumentId documentId, string name, SourceText text, IEnumerable<string>? folders = null, string? filePath = null, bool isGenerated = false)
977public Solution AddDocument(DocumentId documentId, string name, SyntaxNode syntaxRoot, IEnumerable<string>? folders = null, string? filePath = null, bool isGenerated = false, PreservationMode preservationMode = PreservationMode.PreserveValue)
997private Solution AddDocumentImpl(ProjectState project, DocumentId documentId, string name, SourceText text, IReadOnlyList<string>? folders, string? filePath, bool isGenerated)
1011public Solution AddDocument(DocumentId documentId, string name, TextLoader loader, IEnumerable<string>? folders = null)
1036public Solution AddDocument(DocumentInfo documentInfo)
1040/// Create a new <see cref="Solution"/> instance with the corresponding <see cref="Project"/>s updated to include
1043/// <returns>A new <see cref="Solution"/> with the documents added.</returns>
1044public Solution AddDocuments(ImmutableArray<DocumentInfo> documentInfos)
1051public Solution AddAdditionalDocument(DocumentId documentId, string name, string text, IEnumerable<string>? folders = null, string? filePath = null)
1058public Solution AddAdditionalDocument(DocumentId documentId, string name, SourceText text, IEnumerable<string>? folders = null, string? filePath = null)
1079public Solution AddAdditionalDocument(DocumentInfo documentInfo)
1082public Solution AddAdditionalDocuments(ImmutableArray<DocumentInfo> documentInfos)
1089public Solution AddAnalyzerConfigDocument(DocumentId documentId, string name, SourceText text, IEnumerable<string>? folders = null, string? filePath = null)
1134public Solution AddAnalyzerConfigDocuments(ImmutableArray<DocumentInfo> documentInfos)
1140public Solution RemoveDocument(DocumentId documentId)
1149public Solution RemoveDocuments(ImmutableArray<DocumentId> documentIds)
1155private Solution RemoveDocumentsImpl(ImmutableArray<DocumentId> documentIds)
1161public Solution RemoveAdditionalDocument(DocumentId documentId)
1170public Solution RemoveAdditionalDocuments(ImmutableArray<DocumentId> documentIds)
1176private Solution RemoveAdditionalDocumentsImpl(ImmutableArray<DocumentId> documentIds)
1182public Solution RemoveAnalyzerConfigDocument(DocumentId documentId)
1191public Solution RemoveAnalyzerConfigDocuments(ImmutableArray<DocumentId> documentIds)
1197private Solution RemoveAnalyzerConfigDocumentsImpl(ImmutableArray<DocumentId> documentIds)
1203public Solution WithDocumentName(DocumentId documentId, string name)
1222public Solution WithDocumentFolders(DocumentId documentId, IEnumerable<string>? folders)
1237public Solution WithDocumentFilePath(DocumentId documentId, string? filePath)
1251public Solution WithDocumentText(DocumentId documentId, SourceText text, PreservationMode mode = PreservationMode.PreserveValue)
1254internal Solution WithDocumentTexts(ImmutableArray<(DocumentId documentId, SourceText text)> texts, PreservationMode mode = PreservationMode.PreserveValue)
1274public Solution WithAdditionalDocumentText(DocumentId documentId, SourceText text, PreservationMode mode = PreservationMode.PreserveValue)
1295public Solution WithAnalyzerConfigDocumentText(DocumentId documentId, SourceText text, PreservationMode mode = PreservationMode.PreserveValue)
1316public Solution WithDocumentText(DocumentId documentId, TextAndVersion textAndVersion, PreservationMode mode = PreservationMode.PreserveValue)
1337public Solution WithAdditionalDocumentText(DocumentId documentId, TextAndVersion textAndVersion, PreservationMode mode = PreservationMode.PreserveValue)
1358public Solution WithAnalyzerConfigDocumentText(DocumentId documentId, TextAndVersion textAndVersion, PreservationMode mode = PreservationMode.PreserveValue)
1379public Solution WithDocumentSyntaxRoot(DocumentId documentId, SyntaxNode root, PreservationMode mode = PreservationMode.PreserveValue)
1383internal Solution WithDocumentSyntaxRoots(ImmutableArray<(DocumentId documentId, SyntaxNode root)> syntaxRoots, PreservationMode mode = PreservationMode.PreserveValue)
1399internal Solution WithDocumentContentsFrom(DocumentId documentId, DocumentState documentState)
1402internal Solution WithDocumentContentsFrom(ImmutableArray<(DocumentId documentId, DocumentState documentState)> documentIdsAndStates)
1413public Solution WithDocumentSourceCodeKind(DocumentId documentId, SourceCodeKind sourceCodeKind)
1436public Solution WithDocumentTextLoader(DocumentId documentId, TextLoader loader, PreservationMode mode)
1457public Solution WithAdditionalDocumentTextLoader(DocumentId documentId, TextLoader loader, PreservationMode mode)
1478public Solution WithAnalyzerConfigDocumentTextLoader(DocumentId documentId, TextLoader loader, PreservationMode mode)
1499internal Solution WithFrozenPartialCompilations(CancellationToken cancellationToken)
1503internal Task<Solution> WithFrozenPartialCompilationsAsync(CancellationToken cancellationToken)
1506private Solution ComputeFrozenSolution(CancellationToken cancellationToken)
1514var frozenSolution = new Solution(
1529internal Solution WithFrozenPartialCompilationIncludingSpecificDocument(DocumentId documentId, CancellationToken cancellationToken)
1533AsyncLazy<Solution> GetLazySolution()
1548static AsyncLazy<Solution> CreateLazyFrozenSolution(SolutionCompilationState compilationState, DocumentId documentId)
1553static Solution ComputeFrozenSolution(SolutionCompilationState compilationState, DocumentId documentId, CancellationToken cancellationToken)
1556var solution = new Solution(newCompilationState);
1567internal async Task<Solution> WithMergedLinkedFileChangesAsync(
1568Solution oldSolution,
1591internal Solution WithNewWorkspaceFrom(Solution oldSolution)
1599public Solution GetIsolatedSolution()
1608public Solution WithDocumentText(IEnumerable<DocumentId?> documentIds, SourceText text, PreservationMode mode = PreservationMode.PreserveValue)
1638var newSolution = WithCompilationState(newCompilationState);
1647internal Solution WithFrozenSourceGeneratedDocuments(ImmutableArray<(SourceGeneratedDocumentIdentity documentIdentity, DateTime generationDateTime, SourceText text)> documents)
1651internal Solution UpdateSpecificSourceGeneratorExecutionVersions(SourceGeneratorExecutionVersionMap sourceGeneratorExecutionVersionMap)
1658internal Solution WithoutFrozenSourceGeneratedDocuments()
1669internal Solution WithCachedSourceGeneratorState(ProjectId projectToUpdate, Project projectWithCachedGeneratorState)
1676public SolutionChanges GetChanges(Solution oldSolution)
1687/// Gets the set of <see cref="DocumentId"/>s in this <see cref="Solution"/> with a
1704/// Returns the options that should be applied to this solution. This is equivalent to <see cref="Workspace.Options" /> when the <see cref="Solution"/>
1725public Solution WithOptions(OptionSet options)
1738internal Solution WithOptions(SolutionOptionSet options)
Workspace\Workspace.cs (146)
35/// workspace's <see cref="TryApplyChanges(Solution)"/> method.
61private Solution _latestSolution;
65/// when they are applied to workspace via <see cref="TryApplyChanges(Solution, IProgress{CodeAnalysisProgress})"/>.
132protected internal Solution CreateSolution(SolutionInfo solutionInfo)
141private Solution CreateSolution(SolutionInfo solutionInfo, SolutionOptionSet options, IReadOnlyList<AnalyzerReference> analyzerReferences, ImmutableDictionary<string, StructuredAnalyzerConfigOptions> fallbackAnalyzerOptions)
147protected internal Solution CreateSolution(SolutionId id)
157/// after <see cref="TryApplyChanges(Solution)"/> is called.
159public Solution CurrentSolution
174protected Solution SetCurrentSolution(Solution solution)
186private protected (Solution oldSolution, Solution newSolution) SetCurrentSolutionEx(Solution solution)
193var oldSolution = this.CurrentSolution;
205/// <inheritdoc cref="SetCurrentSolution(Func{Solution, Solution}, Func{Solution, Solution, ValueTuple{WorkspaceChangeKind, ProjectId?, DocumentId?}}, Action{Solution, Solution}?, Action{Solution, Solution}?)"/>
207Func<Solution, Solution> transformation,
211Action<Solution, Solution>? onBeforeUpdate = null,
212Action<Solution, Solution>? onAfterUpdate = null)
235internal (bool updated, Solution newSolution) SetCurrentSolution(
236Func<Solution, Solution> transformation,
237Func<Solution, Solution, (WorkspaceChangeKind changeKind, ProjectId? projectId, DocumentId? documentId)> changeKind,
238Action<Solution, Solution>? onBeforeUpdate = null,
239Action<Solution, Solution>? onAfterUpdate = null)
254internal async ValueTask<(bool updated, Solution newSolution)> SetCurrentSolutionAsync(
256Func<Solution, Solution> transformation,
257Func<Solution, Solution, (WorkspaceChangeKind changeKind, ProjectId? projectId, DocumentId? documentId)> changeKind,
258Action<Solution, Solution>? onBeforeUpdate,
259Action<Solution, Solution>? onAfterUpdate,
267var newSolution = data.transformation(oldSolution);
300static Solution UnifyLinkedDocumentContents(Solution oldSolution, Solution newSolution)
340static Solution UpdateAddedDocumentToExistingContentsInSolution(
341Solution solution, ArrayBuilder<DocumentId> addedDocumentIds)
381static Solution UpdateExistingDocumentsToChangedDocumentContents(Solution solution, HashSet<DocumentId> changedDocumentIds)
419/// allow the host to initialize <see cref="Solution.FallbackAnalyzerOptions"/> for that language.
421/// we clear out its <see cref="Solution.FallbackAnalyzerOptions"/>.
428/// the host had the opportunity to initialize <see cref="Solution.FallbackAnalyzerOptions"/>
429/// of any <see cref="Solution"/> snapshot stored in <see cref="CurrentSolution"/>.
431private Solution InitializeAnalyzerFallbackOptions(Solution oldSolution, Solution newSolution)
481/// name="transformation"/> as it may its <see cref="Solution.SolutionStateContentVersion"/> updated
486/// name="transformation"/> as it may have its <see cref="Solution.SolutionStateContentVersion"/> updated
488private protected (Solution oldSolution, Solution newSolution) SetCurrentSolution<TData>(
490Func<Solution, TData, Solution> transformation,
492Action<Solution, Solution, TData>? onBeforeUpdate = null,
493Action<Solution, Solution, TData>? onAfterUpdate = null)
509/// <inheritdoc cref="SetCurrentSolution{TData}(TData, Func{Solution, TData, Solution}, bool, Action{Solution, Solution, TData}?, Action{Solution, Solution, TData}?)"/>
510private protected async ValueTask<(Solution oldSolution, Solution newSolution)> SetCurrentSolutionAsync<TData>(
513Func<Solution, TData, Solution> transformation,
515Action<Solution, Solution, TData>? onBeforeUpdate,
516Action<Solution, Solution, TData>? onAfterUpdate,
523var oldSolution = Volatile.Read(ref _latestSolution);
535var newSolution = transformation(oldSolution, data);
573/// Gets or sets the set of all global options and <see cref="Solution.Options"/>.
574/// Setter also force updates the <see cref="CurrentSolution"/> to have the updated <see cref="Solution.Options"/>.
784private static Solution CheckAndAddProjects(Solution solution, IReadOnlyList<ProjectInfo> projects)
796private static Solution CheckAndAddProject(Solution newSolution, ProjectInfo project)
812var newSolution = this.CreateSolution(solutionInfo);
828var newSolution = this.CreateSolution(reloadedSolutionInfo);
1058/// Call this method when <see cref="Solution.FallbackAnalyzerOptions"/> change in the host environment.
1151var newSolution = oldSolution;
1295Func<Solution, DocumentId, TextDocument?> getDocumentInSolution,
1296Func<Solution, DocumentId, TArg, Solution> updateSolutionWithText,
1331var newSolution = oldSolution;
1332var previousSolution = newSolution;
1486static Solution UpdateReferencesAfterAdd(Solution solution)
1543/// Determines if the specific kind of change is supported by the <see cref="TryApplyChanges(Solution)"/> method.
1565public virtual bool TryApplyChanges(Solution newSolution)
1568internal virtual bool TryApplyChanges(Solution newSolution, IProgress<CodeAnalysisProgress> progressTracker)
1579var oldSolution = this.CurrentSolution;
1600var solutionWithLinkedFileChangesMerged = newSolution.WithMergedLinkedFileChangesAsync(oldSolution, solutionChanges, cancellationToken: CancellationToken.None).Result;
1868/// Called during a call to <see cref="TryApplyChanges(Solution)"/> to determine if a specific change to <see cref="Project.CompilationOptions"/> is allowed.
1875/// <param name="newOptions">The new <see cref="CompilationOptions"/> of the project that was passed to <see cref="TryApplyChanges(Solution)"/>.</param>
1876/// <param name="project">The project contained in the <see cref="Solution"/> passed to <see cref="TryApplyChanges(Solution)"/>.</param>
1881/// Called during a call to <see cref="TryApplyChanges(Solution)"/> to determine if a specific change to <see cref="Project.ParseOptions"/> is allowed.
1888/// <param name="newOptions">The new <see cref="ParseOptions"/> of the project that was passed to <see cref="TryApplyChanges(Solution)"/>.</param>
1889/// <param name="project">The project contained in the <see cref="Solution"/> passed to <see cref="TryApplyChanges(Solution)"/>.</param>
1894/// This method is called during <see cref="TryApplyChanges(Solution)"/> for each project
2097/// This method is called during <see cref="TryApplyChanges(Solution)"/> to add a project to the current solution.
2108/// This method is called during <see cref="TryApplyChanges(Solution)"/> to remove a project from the current solution.
2119/// This method is called during <see cref="TryApplyChanges(Solution)"/> to change the compilation options.
2137/// This method is called during <see cref="TryApplyChanges(Solution)"/> to change the parse options.
2154/// This method is called during <see cref="TryApplyChanges(Solution)"/> to add a project reference to a project.
2165/// This method is called during <see cref="TryApplyChanges(Solution)"/> to remove a project reference from a project.
2176/// This method is called during <see cref="TryApplyChanges(Solution)"/> to add a metadata reference to a project.
2187/// This method is called during <see cref="TryApplyChanges(Solution)"/> to remove a metadata reference from a project.
2198/// This method is called during <see cref="TryApplyChanges(Solution)"/> to add an analyzer reference to a project.
2209/// This method is called during <see cref="TryApplyChanges(Solution)"/> to remove an analyzer reference from a project.
2220/// This method is called during <see cref="TryApplyChanges(Solution)"/> to add an analyzer reference to the solution.
2231/// This method is called during <see cref="TryApplyChanges(Solution)"/> to remove an analyzer reference from the solution.
2242/// This method is called during <see cref="TryApplyChanges(Solution)"/> to add a new document to a project.
2253/// This method is called during <see cref="TryApplyChanges(Solution)"/> to remove a document from a project.
2286/// This method is called during <see cref="TryApplyChanges(Solution)"/> to add a new additional document to a project.
2297/// This method is called during <see cref="TryApplyChanges(Solution)"/> to remove an additional document from a project.
2319/// This method is called during <see cref="TryApplyChanges(Solution)"/> to add a new analyzer config document to a project.
2330/// This method is called during <see cref="TryApplyChanges(Solution)"/> to remove an analyzer config document from a project.
2360private static void CheckSolutionIsEmpty(Solution solution)
2374private static void CheckProjectIsInSolution(Solution solution, ProjectId projectId)
2390private static void CheckProjectIsNotInSolution(Solution solution, ProjectId projectId)
2487internal static void CheckSolutionHasAnalyzerReference(Solution solution, AnalyzerReference analyzerReference)
2498internal static void CheckSolutionDoesNotHaveAnalyzerReference(Solution solution, AnalyzerReference analyzerReference)
2512private static void CheckDocumentIsInSolution(Solution solution, DocumentId documentId)
2528private static void CheckAdditionalDocumentIsInSolution(Solution solution, DocumentId documentId)
2544private static void CheckAnalyzerConfigDocumentIsInSolution(Solution solution, DocumentId documentId)
2573private static void CheckAdditionalDocumentIsNotInSolution(Solution solution, DocumentId documentId)
2589private static void CheckAnalyzerConfigDocumentIsNotInSolution(Solution solution, DocumentId documentId)
Workspace\Workspace_Editor.cs (15)
555Action<Solution, DocumentId> checkTextDocumentIsInSolution,
556Func<Solution, DocumentId, SourceText, PreservationMode, Solution> withDocumentText,
557Func<Solution, DocumentId, TextAndVersion, PreservationMode, Solution> withDocumentTextAndVersion,
749Action<Solution, DocumentId> checkTextDocumentIsInSolution,
750Func<Solution, DocumentId, TextLoader, PreservationMode, Solution> withTextDocumentTextLoader)
850private SourceText GetOpenDocumentText(Solution solution, DocumentId documentId)
863protected virtual Solution AdjustReloadedSolution(Solution oldSolution, Solution reloadedSolution)
865var newSolution = reloadedSolution;
882var oldSolution = oldProject.Solution;
883var newSolution = reloadedProject.Solution;
CodeLens\VisualStudioCodeLensReferencesService.cs (6)
26public ValueTask<VersionStamp> GetProjectCodeLensVersionAsync(Solution solution, ProjectId projectId, CancellationToken cancellationToken)
32public async Task<ReferenceCount?> GetReferenceCountAsync(Solution solution, DocumentId documentId, SyntaxNode? syntaxNode, int maxSearchResults,
57public async Task<ImmutableArray<ReferenceLocationDescriptorAndDocument>?> FindReferenceLocationsAsync(Solution solution, DocumentId documentId, SyntaxNode? syntaxNode,
83public Task<ImmutableArray<ReferenceLocationDescriptor>> MapReferenceLocationsAsync(Solution solution, ImmutableArray<ReferenceLocationDescriptorAndDocument> referenceLocations, ClassificationOptions classificationOptions, CancellationToken cancellationToken)
89public async Task<ImmutableArray<ReferenceMethodDescriptor>?> FindReferenceMethodsAsync(Solution solution, DocumentId documentId, SyntaxNode? syntaxNode,
114public async Task<string?> GetFullyQualifiedNameAsync(Solution solution, DocumentId documentId, SyntaxNode? syntaxNode,
Preview\PreviewEngine.cs (8)
29private readonly Solution _newSolution;
30private readonly Solution _oldSolution;
42public Solution FinalSolution { get; private set; }
45public PreviewEngine(string title, string helpString, string description, string topLevelItemName, Glyph topLevelGlyph, Solution newSolution, Solution oldSolution, IComponentModel componentModel, bool showCheckBoxes = true)
56Solution newSolution,
57Solution oldSolution,
214var updatedSolution = _topLevelChange.GetUpdatedSolution(applyingChanges: false);
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (1)
133Solution solution,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationContext.cs (1)
12Solution Solution,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ISolutionExtensions.cs (13)
17public static IEnumerable<DocumentId> GetChangedDocuments(this Solution? newSolution, Solution oldSolution)
33public static TextDocument? GetTextDocument(this Solution solution, DocumentId? documentId)
36public static Document GetRequiredDocument(this Solution solution, SyntaxTree syntaxTree)
39public static Project GetRequiredProject(this Solution solution, ProjectId projectId)
50public static Document GetRequiredDocument(this Solution solution, DocumentId documentId)
100public static TextDocument GetRequiredAdditionalDocument(this Solution solution, DocumentId documentId)
103public static TextDocument GetRequiredAnalyzerConfigDocument(this Solution solution, DocumentId documentId)
106public static TextDocument GetRequiredTextDocument(this Solution solution, DocumentId documentId)
147public static TextDocument? GetTextDocumentForLocation(this Solution solution, Location location)
161public static TLanguageService? GetLanguageService<TLanguageService>(this Solution? solution, string languageName) where TLanguageService : ILanguageService
164public static TLanguageService GetRequiredLanguageService<TLanguageService>(this Solution solution, string languageName) where TLanguageService : ILanguageService
172public static HostLanguageServices GetExtendedLanguageServices(this Solution solution, string languageName)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SemanticModelReuse\SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs (1)
77var solution = e.NewSolution;
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeFixes\FixAllContextHelper.cs (1)
133Solution solution,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\CodeGeneration\CodeGenerationContext.cs (1)
12Solution Solution,
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\Extensions\ISolutionExtensions.cs (13)
17public static IEnumerable<DocumentId> GetChangedDocuments(this Solution? newSolution, Solution oldSolution)
33public static TextDocument? GetTextDocument(this Solution solution, DocumentId? documentId)
36public static Document GetRequiredDocument(this Solution solution, SyntaxTree syntaxTree)
39public static Project GetRequiredProject(this Solution solution, ProjectId projectId)
50public static Document GetRequiredDocument(this Solution solution, DocumentId documentId)
100public static TextDocument GetRequiredAdditionalDocument(this Solution solution, DocumentId documentId)
103public static TextDocument GetRequiredAnalyzerConfigDocument(this Solution solution, DocumentId documentId)
106public static TextDocument GetRequiredTextDocument(this Solution solution, DocumentId documentId)
147public static TextDocument? GetTextDocumentForLocation(this Solution solution, Location location)
161public static TLanguageService? GetLanguageService<TLanguageService>(this Solution? solution, string languageName) where TLanguageService : ILanguageService
164public static TLanguageService GetRequiredLanguageService<TLanguageService>(this Solution solution, string languageName) where TLanguageService : ILanguageService
172public static HostLanguageServices GetExtendedLanguageServices(this Solution solution, string languageName)
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\SemanticModelReuse\SemanticModelWorkspaceServiceFactory.SemanticModelWorkspaceService.cs (1)
77var solution = e.NewSolution;