diff --git a/src/Compilers/CSharp/CSharpAnalyzerDriver/CSharpDeclarationComputer.cs b/src/Compilers/CSharp/CSharpAnalyzerDriver/CSharpDeclarationComputer.cs index 379b1fcb9e63caf34a45728e164f9b1365708fbc..eaf8264b90c2134c9640084ca3ffb61abef516fa 100644 --- a/src/Compilers/CSharp/CSharpAnalyzerDriver/CSharpDeclarationComputer.cs +++ b/src/Compilers/CSharp/CSharpAnalyzerDriver/CSharpDeclarationComputer.cs @@ -15,7 +15,7 @@ internal class CSharpDeclarationComputer : DeclarationComputer public static ImmutableArray GetDeclarationsInSpan(SemanticModel model, TextSpan span, bool getSymbol, CancellationToken cancellationToken) { var builder = ArrayBuilder.GetInstance(); - ComputeDeclarations(model, model.SyntaxTree.GetRoot(), + ComputeDeclarations(model, model.SyntaxTree.GetRoot(cancellationToken), (node, level) => !node.Span.OverlapsWith(span) || InvalidLevel(level), getSymbol, builder, null, cancellationToken); return builder.ToImmutable(); diff --git a/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs b/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs index 0a489870a72200babad928fb49303fbc8e5c332a..718e065f945368b4899555b9c0aeaa9adf502cec 100644 --- a/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs +++ b/src/Compilers/CSharp/Portable/Compilation/SyntaxTreeSemanticModel.cs @@ -1896,7 +1896,7 @@ public override IParameterSymbol GetDeclaredSymbol(ParameterSyntax declarationSy if (memberModel != null) { // Could be parameter of lambda. - return memberModel.GetDeclaredSymbol(declarationSyntax); + return memberModel.GetDeclaredSymbol(declarationSyntax, cancellationToken); } return GetDeclaredNonLambdaParameterSymbol(declarationSyntax, cancellationToken); diff --git a/src/Compilers/CSharp/Portable/Compiler/UnprocessedDocumentationCommentFinder.cs b/src/Compilers/CSharp/Portable/Compiler/UnprocessedDocumentationCommentFinder.cs index 0aace2eed8ecc169c49a429ed9b2426f92eb92f2..aef40685e4c4e4c40bb3c319c27d3d32e12467a9 100644 --- a/src/Compilers/CSharp/Portable/Compiler/UnprocessedDocumentationCommentFinder.cs +++ b/src/Compilers/CSharp/Portable/Compiler/UnprocessedDocumentationCommentFinder.cs @@ -27,7 +27,7 @@ public static void ReportUnprocessed(SyntaxTree tree, TextSpan? filterSpanWithin if (tree.ReportDocumentationCommentDiagnostics()) { UnprocessedDocumentationCommentFinder finder = new UnprocessedDocumentationCommentFinder(diagnostics, filterSpanWithinTree, cancellationToken); - finder.Visit(tree.GetRoot()); + finder.Visit(tree.GetRoot(cancellationToken)); } } diff --git a/src/Compilers/CSharp/Portable/Syntax/NamespaceDeclarationSyntaxReference.cs b/src/Compilers/CSharp/Portable/Syntax/NamespaceDeclarationSyntaxReference.cs index 41869f4b33ce92e4d20f5cdc99d989b36c0190f5..0777a7e5a7e572391243f3302a239e40c853b9d3 100644 --- a/src/Compilers/CSharp/Portable/Syntax/NamespaceDeclarationSyntaxReference.cs +++ b/src/Compilers/CSharp/Portable/Syntax/NamespaceDeclarationSyntaxReference.cs @@ -20,7 +20,7 @@ public NamespaceDeclarationSyntaxReference(SyntaxReference reference) protected override SyntaxNode Translate(SyntaxReference reference, CancellationToken cancellationToken) { - var node = (CSharpSyntaxNode)reference.GetSyntax(); + var node = (CSharpSyntaxNode)reference.GetSyntax(cancellationToken); // If the node is a name syntax, it's something like "X" or "X.Y" in : // namespace X.Y.Z diff --git a/src/Compilers/CSharp/Test/Symbol/DeclarationTests.cs b/src/Compilers/CSharp/Test/Symbol/DeclarationTests.cs index e0e2a4197cb3898b71ba05d6f11fdf6da3e52e9c..361578ec41d4ec07d293768b2a98d74c3aa5cf9d 100644 --- a/src/Compilers/CSharp/Test/Symbol/DeclarationTests.cs +++ b/src/Compilers/CSharp/Test/Symbol/DeclarationTests.cs @@ -344,10 +344,10 @@ public override SyntaxNode GetSyntax(CancellationToken cancellationToken) // Note: It's important for us to maintain identity of nodes/trees, so we find // the equivalent node in our CountedSyntaxTree. countedSyntaxTree.AccessCount++; - var nodeInUnderlying = underlyingSyntaxReference.GetSyntax(); + var nodeInUnderlying = underlyingSyntaxReference.GetSyntax(cancellationToken); - var token = countedSyntaxTree.GetCompilationUnitRoot().FindToken(nodeInUnderlying.SpanStart); + var token = countedSyntaxTree.GetCompilationUnitRoot(cancellationToken).FindToken(nodeInUnderlying.SpanStart); for (var node = token.Parent; node != null; node = node.Parent) { if (node.Span == nodeInUnderlying.Span && node.RawKind == nodeInUnderlying.RawKind) diff --git a/src/Diagnostics/FxCop/CSharp/Globalization/CodeFixes/CA1309CSharpCodeFixProvider.cs b/src/Diagnostics/FxCop/CSharp/Globalization/CodeFixes/CA1309CSharpCodeFixProvider.cs index 574f35b2f527cdeeeae6a257fff4c09a2e9cf262..0b6f91769b8f2d6e8e1b5fa66982c9f43c1f4bb2 100644 --- a/src/Diagnostics/FxCop/CSharp/Globalization/CodeFixes/CA1309CSharpCodeFixProvider.cs +++ b/src/Diagnostics/FxCop/CSharp/Globalization/CodeFixes/CA1309CSharpCodeFixProvider.cs @@ -47,7 +47,7 @@ internal override Task GetUpdatedDocumentAsync(Document document, Sema var invokeParent = identifier.GetAncestor(); if (invokeParent != null) { - var methodSymbol = model.GetSymbolInfo(identifier).Symbol as IMethodSymbol; + var methodSymbol = model.GetSymbolInfo(identifier, cancellationToken).Symbol as IMethodSymbol; if (methodSymbol != null && CanAddStringComparison(methodSymbol)) { // append a new StringComparison.Ordinal argument diff --git a/src/Diagnostics/FxCop/CSharp/Globalization/CodeFixes/CA2101CSharpCodeFixProvider.cs b/src/Diagnostics/FxCop/CSharp/Globalization/CodeFixes/CA2101CSharpCodeFixProvider.cs index fb7d6309e8dacf734ac25be3339e41e9f6a15929..6aeefee68a263dcb3c1776fa38eccb9207162187 100644 --- a/src/Diagnostics/FxCop/CSharp/Globalization/CodeFixes/CA2101CSharpCodeFixProvider.cs +++ b/src/Diagnostics/FxCop/CSharp/Globalization/CodeFixes/CA2101CSharpCodeFixProvider.cs @@ -39,7 +39,7 @@ internal override Task GetUpdatedDocumentAsync(Document document, Sema { // could be either a [DllImport] or [MarshalAs] attribute var attribute = (AttributeSyntax)nodeToFix; - var attributeType = model.GetSymbolInfo(attribute).Symbol; + var attributeType = model.GetSymbolInfo(attribute, cancellationToken).Symbol; var arguments = attribute.ArgumentList.Arguments; if (dllImportType.Equals(attributeType.ContainingType)) { diff --git a/src/Diagnostics/FxCop/CSharp/Usage/CodeFixes/CA2213CSharpCodeFixProvider.cs b/src/Diagnostics/FxCop/CSharp/Usage/CodeFixes/CA2213CSharpCodeFixProvider.cs index 8e9981bc8bfbbf96d807a9048f687350dde88f8a..1c8938201192e93c283aed65c86fb50de2002397 100644 --- a/src/Diagnostics/FxCop/CSharp/Usage/CodeFixes/CA2213CSharpCodeFixProvider.cs +++ b/src/Diagnostics/FxCop/CSharp/Usage/CodeFixes/CA2213CSharpCodeFixProvider.cs @@ -46,7 +46,7 @@ internal override Task GetUpdatedDocumentAsync(Document document, Sema } var factory = document.GetLanguageService(); - var symbol = model.GetDeclaredSymbol(syntaxNode); + var symbol = model.GetDeclaredSymbol(syntaxNode, cancellationToken); // handle a case where a local in the Dipose method with the same name by generating this (or ClassName) and simplifying it var path = symbol.IsStatic diff --git a/src/Diagnostics/FxCop/Core/Design/CodeFixes/CA1008CodeFixProviderBase.cs b/src/Diagnostics/FxCop/Core/Design/CodeFixes/CA1008CodeFixProviderBase.cs index ba1c3d08ae08866845565f2c753de76a5cdbf350..c82f0019b07d1e9381d9b93a298df996f80c5863 100644 --- a/src/Diagnostics/FxCop/Core/Design/CodeFixes/CA1008CodeFixProviderBase.cs +++ b/src/Diagnostics/FxCop/Core/Design/CodeFixes/CA1008CodeFixProviderBase.cs @@ -60,7 +60,7 @@ private SyntaxNode GetExplicitlyAssignedField(IFieldSymbol originalField, Syntax private async Task GetUpdatedDocumentForRuleNameRenameAsync(Document document, IFieldSymbol field, CancellationToken cancellationToken) { - var newSolution = await Rename.Renamer.RenameSymbolAsync(document.Project.Solution, field, "None", null).ConfigureAwait(false); + var newSolution = await Rename.Renamer.RenameSymbolAsync(document.Project.Solution, field, "None", null, cancellationToken).ConfigureAwait(false); return newSolution.GetDocument(document.Id); } @@ -93,7 +93,7 @@ private async Task ApplyRuleNameMultipleZeroAsync(SymbolEditor editor, INamedTyp } else { - await editor.EditOneDeclarationAsync(field, (e, d) => e.RemoveNode(d)); // removes the field declaration + await editor.EditOneDeclarationAsync(field, (e, d) => e.RemoveNode(d), cancellationToken); // removes the field declaration makeNextFieldExplicit = true; } } @@ -111,7 +111,7 @@ private async Task ApplyRuleNameNoZeroValueAsync(SymbolEditor editor, INamedType { if (CA1008DiagnosticAnalyzer.IsMemberNamedNone(field)) { - await editor.EditOneDeclarationAsync(field, (e, d) => e.RemoveNode(d)); + await editor.EditOneDeclarationAsync(field, (e, d) => e.RemoveNode(d), cancellationToken); } } diff --git a/src/Diagnostics/FxCop/Core/Design/CodeFixes/CA1012CodeFixProvider.cs b/src/Diagnostics/FxCop/Core/Design/CodeFixes/CA1012CodeFixProvider.cs index 28e7d9c1dc3520419370cbba09b44b0ef7587829..638aa67702fe418205af7a8f6879e44432dc37b8 100644 --- a/src/Diagnostics/FxCop/Core/Design/CodeFixes/CA1012CodeFixProvider.cs +++ b/src/Diagnostics/FxCop/Core/Design/CodeFixes/CA1012CodeFixProvider.cs @@ -37,7 +37,7 @@ private static SyntaxNode GetDeclaration(ISymbol symbol) internal override Task GetUpdatedDocumentAsync(Document document, SemanticModel model, SyntaxNode root, SyntaxNode nodeToFix, Diagnostic diagnostic, CancellationToken cancellationToken) { - var classSymbol = (INamedTypeSymbol)model.GetDeclaredSymbol(nodeToFix); + var classSymbol = (INamedTypeSymbol)model.GetDeclaredSymbol(nodeToFix, cancellationToken); var instanceConstructors = classSymbol.InstanceConstructors.Where(t => t.DeclaredAccessibility == Accessibility.Public).Select(t => GetDeclaration(t)).Where(d => d != null).ToList(); var generator = SyntaxGenerator.GetGenerator(document); var newRoot = root.ReplaceNodes(instanceConstructors, (original, rewritten) => generator.WithAccessibility(original, Accessibility.Protected)); diff --git a/src/Diagnostics/FxCop/Core/Design/CodeFixes/EnumWithFlagsCodeFixProviderBase.cs b/src/Diagnostics/FxCop/Core/Design/CodeFixes/EnumWithFlagsCodeFixProviderBase.cs index 0b44a625bc057c278b054958b07faa41ecfc7b3a..2fbcb362ffb4a403b7a0dedc1ca9bf1cabe97510 100644 --- a/src/Diagnostics/FxCop/Core/Design/CodeFixes/EnumWithFlagsCodeFixProviderBase.cs +++ b/src/Diagnostics/FxCop/Core/Design/CodeFixes/EnumWithFlagsCodeFixProviderBase.cs @@ -61,11 +61,11 @@ private static SyntaxNode AddFlagsAttribute(Workspace workspace, SyntaxNode enum private static SyntaxNode RemoveFlagsAttribute(Workspace workspace, SemanticModel model, SyntaxNode enumTypeSyntax, INamedTypeSymbol flagsAttributeType, CancellationToken cancellationToken) { - var enumType = model.GetDeclaredSymbol(enumTypeSyntax) as INamedTypeSymbol; + var enumType = model.GetDeclaredSymbol(enumTypeSyntax, cancellationToken) as INamedTypeSymbol; Contract.ThrowIfNull(enumType); var flagsAttribute = enumType.GetAttributes().First(a => a.AttributeClass == flagsAttributeType); - var attributeNode = flagsAttribute.ApplicationSyntaxReference.GetSyntax(); + var attributeNode = flagsAttribute.ApplicationSyntaxReference.GetSyntax(cancellationToken); var generator = SyntaxGenerator.GetGenerator(workspace, enumTypeSyntax.Language); return generator.RemoveNode(enumTypeSyntax, attributeNode); diff --git a/src/Diagnostics/FxCop/Core/Design/EnumWithFlagsDiagnosticAnalyzer.cs b/src/Diagnostics/FxCop/Core/Design/EnumWithFlagsDiagnosticAnalyzer.cs index f74425bf61098c827dada15fd0c469c81c0700be..ab562ad8f39dcfbc6da68a90838eb784885ba8c6 100644 --- a/src/Diagnostics/FxCop/Core/Design/EnumWithFlagsDiagnosticAnalyzer.cs +++ b/src/Diagnostics/FxCop/Core/Design/EnumWithFlagsDiagnosticAnalyzer.cs @@ -94,7 +94,7 @@ protected override void AnalyzeSymbol(INamedTypeSymbol symbol, Compilation compi Contract.ThrowIfNull(missingValues); var missingValuesString = missingValues.Select(v => v.ToString()).Aggregate((i, j) => i + ", " + j); - var location = GetDiagnosticLocation(symbol.DeclaringSyntaxReferences[0].GetSyntax()); + var location = GetDiagnosticLocation(symbol.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken)); addDiagnostic(location.CreateDiagnostic(Rule2217, symbol.Name, missingValuesString)); } } @@ -104,7 +104,7 @@ protected override void AnalyzeSymbol(INamedTypeSymbol symbol, Compilation compi // Ignore continguous value enums to reduce noise. if (!IsContiguous(memberValues) && ShouldBeFlags(memberValues)) { - var location = GetDiagnosticLocation(symbol.DeclaringSyntaxReferences[0].GetSyntax()); + var location = GetDiagnosticLocation(symbol.DeclaringSyntaxReferences[0].GetSyntax(cancellationToken)); addDiagnostic(location.CreateDiagnostic(Rule1027, symbol.Name)); } } diff --git a/src/Diagnostics/FxCop/Core/Usage/CodeFixes/CA2229CodeFixProvider.cs b/src/Diagnostics/FxCop/Core/Usage/CodeFixes/CA2229CodeFixProvider.cs index 894ade0c29608b8b2171eb1ece5d9c866ca3788b..6ba8e08c20db21c602fc289b5223bb51b2733251 100644 --- a/src/Diagnostics/FxCop/Core/Usage/CodeFixes/CA2229CodeFixProvider.cs +++ b/src/Diagnostics/FxCop/Core/Usage/CodeFixes/CA2229CodeFixProvider.cs @@ -31,7 +31,7 @@ protected sealed override string GetCodeFixDescription(Diagnostic diagnostic) internal async override Task GetUpdatedDocumentAsync(Document document, SemanticModel model, SyntaxNode root, SyntaxNode nodeToFix, Diagnostic diagnostic, CancellationToken cancellationToken) { - var symbol = model.GetDeclaredSymbol(nodeToFix); + var symbol = model.GetDeclaredSymbol(nodeToFix, cancellationToken); var generator = SyntaxGenerator.GetGenerator(document); // There was no constructor and so the diagnostic was on the type. Generate a serlialization ctor. diff --git a/src/Diagnostics/FxCop/Core/Usage/CodeFixes/CA2235CodeFixProviderBase.cs b/src/Diagnostics/FxCop/Core/Usage/CodeFixes/CA2235CodeFixProviderBase.cs index 02b79293c55dbb7f4ac7bddbea2cfbfc8ffb13c0..44e537cb21a08284e599cf4bc9c197b30bee47c8 100644 --- a/src/Diagnostics/FxCop/Core/Usage/CodeFixes/CA2235CodeFixProviderBase.cs +++ b/src/Diagnostics/FxCop/Core/Usage/CodeFixes/CA2235CodeFixProviderBase.cs @@ -37,11 +37,11 @@ internal async override Task> GetFixesAsync(Document doc actions = SpecializedCollections.SingletonEnumerable(codeAction); // Fix 2: If the type of the field is defined in source, then add the serializable attribute to the type. - var fieldSymbol = model.GetDeclaredSymbol(nodeToFix) as IFieldSymbol; + var fieldSymbol = model.GetDeclaredSymbol(nodeToFix, cancellationToken) as IFieldSymbol; var type = fieldSymbol.Type; if (type.Locations.Any(l => l.IsInSource)) { - var typeDeclNode = type.DeclaringSyntaxReferences.First().GetSyntax(); + var typeDeclNode = type.DeclaringSyntaxReferences.First().GetSyntax(cancellationToken); var serializableAttr = generator.Attribute(generator.TypeExpression(WellKnownTypes.SerializableAttribute(model.Compilation))); var newTypeDeclNode = generator.AddAttributes(typeDeclNode, serializableAttr); diff --git a/src/Diagnostics/Roslyn/CSharp/ApiDesign/CancellationTokenMustBeLastCodeFixProvider.cs b/src/Diagnostics/Roslyn/CSharp/ApiDesign/CancellationTokenMustBeLastCodeFixProvider.cs index e1e74a1576fa01799fd1c90c551a55054273f176..422b7d9c767a939bbef45d0d1549ae42ffe08896 100644 --- a/src/Diagnostics/Roslyn/CSharp/ApiDesign/CancellationTokenMustBeLastCodeFixProvider.cs +++ b/src/Diagnostics/Roslyn/CSharp/ApiDesign/CancellationTokenMustBeLastCodeFixProvider.cs @@ -67,7 +67,7 @@ public override string Title protected override async Task GetChangedDocumentAsync(CancellationToken cancellationToken) { var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); - var methodSymbol = semanticModel.GetDeclaredSymbol(declaration); + var methodSymbol = semanticModel.GetDeclaredSymbol(declaration, cancellationToken); var compilation = await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); var cancellationTokenType = compilation.GetTypeByMetadataName("System.Threading.CancellationToken"); @@ -75,7 +75,7 @@ protected override async Task GetChangedDocumentAsync(CancellationToke var nonCancellationTokenParameters = new List(); foreach (var param in declaration.ParameterList.Parameters) { - var paramSymbol = semanticModel.GetDeclaredSymbol(param); + var paramSymbol = semanticModel.GetDeclaredSymbol(param, cancellationToken); if (paramSymbol.Type.Equals(cancellationTokenType)) { cancellationTokenParameters.Add(param); diff --git a/src/EditorFeatures/CSharp/AutomaticCompletion/Sessions/CurlyBraceCompletionSession.cs b/src/EditorFeatures/CSharp/AutomaticCompletion/Sessions/CurlyBraceCompletionSession.cs index 83757c4f7b63affaeaf63750a5aa3ff0149736a8..b72e1198ee251d6b9b13448c575af3df9305a2c2 100644 --- a/src/EditorFeatures/CSharp/AutomaticCompletion/Sessions/CurlyBraceCompletionSession.cs +++ b/src/EditorFeatures/CSharp/AutomaticCompletion/Sessions/CurlyBraceCompletionSession.cs @@ -67,7 +67,7 @@ public override void AfterReturn(IBraceCompletionSession session, CancellationTo // first add one line in between, and format braces if (session.SubjectBuffer.GetOption(FeatureOnOffOptions.AutoFormattingOnCloseBrace)) { - document.InsertText(session.ClosingPoint.GetPosition(session.SubjectBuffer.CurrentSnapshot) - 1, Environment.NewLine); + document.InsertText(session.ClosingPoint.GetPosition(session.SubjectBuffer.CurrentSnapshot) - 1, Environment.NewLine, cancellationToken); FormatTrackingSpan(session, GetFormattingRules(document)); } diff --git a/src/EditorFeatures/CSharp/AutomaticCompletion/Sessions/LessAndGreaterThanCompletionSession.cs b/src/EditorFeatures/CSharp/AutomaticCompletion/Sessions/LessAndGreaterThanCompletionSession.cs index b98a59b787e135f56d0288ce889c9080d5ede7ba..88c700b4f169ee760f736bc7822c531a3074038e 100644 --- a/src/EditorFeatures/CSharp/AutomaticCompletion/Sessions/LessAndGreaterThanCompletionSession.cs +++ b/src/EditorFeatures/CSharp/AutomaticCompletion/Sessions/LessAndGreaterThanCompletionSession.cs @@ -58,7 +58,7 @@ private bool PossibleTypeArgument(ITextSnapshot snapshot, SyntaxToken token, Can } var model = document.GetSemanticModelAsync(cancellationToken).WaitAndGetResult(cancellationToken); - var info = model.GetSymbolInfo(node.Left); + var info = model.GetSymbolInfo(node.Left, cancellationToken); return info.CandidateSymbols.Any(IsGenericTypeOrMethod); } diff --git a/src/EditorFeatures/CSharp/Completion/CompletionProviders/XmlDocCommentCompletion/XmlDocCommentCompletionProvider.cs b/src/EditorFeatures/CSharp/Completion/CompletionProviders/XmlDocCommentCompletion/XmlDocCommentCompletionProvider.cs index 4f0e594b7ef323ea8df03238af90d5dd4c2c1073..8549f15eb5ca5e9dad4928aec1eb9374d13cbf42 100644 --- a/src/EditorFeatures/CSharp/Completion/CompletionProviders/XmlDocCommentCompletion/XmlDocCommentCompletionProvider.cs +++ b/src/EditorFeatures/CSharp/Completion/CompletionProviders/XmlDocCommentCompletion/XmlDocCommentCompletionProvider.cs @@ -81,7 +81,7 @@ protected override async Task> GetItemsWorkerAsync(D var typeDeclaration = attachedToken.GetAncestor(); if (typeDeclaration != null) { - declaredSymbol = semanticModel.GetDeclaredSymbol(typeDeclaration); + declaredSymbol = semanticModel.GetDeclaredSymbol(typeDeclaration, cancellationToken); } } diff --git a/src/EditorFeatures/CSharp/NavigationBar/CSharpNavigationBarItemService.cs b/src/EditorFeatures/CSharp/NavigationBar/CSharpNavigationBarItemService.cs index d5a891afc222541a92277510b94bf1a16ee2efb4..7369745870c645b27670fc0740c8d4e4edde94d9 100644 --- a/src/EditorFeatures/CSharp/NavigationBar/CSharpNavigationBarItemService.cs +++ b/src/EditorFeatures/CSharp/NavigationBar/CSharpNavigationBarItemService.cs @@ -307,7 +307,7 @@ private static void AddEnumMemberSpan(ISymbol symbol, SyntaxTree tree, List GetChangedSolutionAsync(CancellationToken canc solution = solution.AddProject(ProjectInfo.Create(s_addedProjectId, VersionStamp.Create(), AddedProjectName, AddedProjectName, LanguageNames.CSharp)); // Change a document - This will result in IWpfTextView previews. - solution = solution.WithDocumentSyntaxRoot(_oldDocument.Id, CSharpSyntaxTree.ParseText(ChangedDocumentText).GetRoot()); + solution = solution.WithDocumentSyntaxRoot(_oldDocument.Id, CSharpSyntaxTree.ParseText(ChangedDocumentText, cancellationToken: cancellationToken).GetRoot(cancellationToken)); return Task.FromResult(solution); } diff --git a/src/EditorFeatures/Core/Extensibility/NavigationBar/AbstractNavigationBarItemService.cs b/src/EditorFeatures/Core/Extensibility/NavigationBar/AbstractNavigationBarItemService.cs index a30ab470a032b3c55fdd3ed88fa6fac1f3244efb..17447fd8bcc6628a2698708118efda422cf2c6d9 100644 --- a/src/EditorFeatures/Core/Extensibility/NavigationBar/AbstractNavigationBarItemService.cs +++ b/src/EditorFeatures/Core/Extensibility/NavigationBar/AbstractNavigationBarItemService.cs @@ -28,7 +28,7 @@ public void NavigateToSymbolItem(Document document, NavigationBarSymbolItem item { var symbolNavigationService = document.Project.Solution.Workspace.Services.GetService(); - var symbolInfo = item.NavigationSymbolId.Resolve(document.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult(cancellationToken), ignoreAssemblyKey: true); + var symbolInfo = item.NavigationSymbolId.Resolve(document.Project.GetCompilationAsync(cancellationToken).WaitAndGetResult(cancellationToken), ignoreAssemblyKey: true, cancellationToken: cancellationToken); var symbol = symbolInfo.GetAnySymbol(); // Do not allow third party navigation to types or constructors diff --git a/src/EditorFeatures/Core/Implementation/CallHierarchy/CallHierarchyProvider.cs b/src/EditorFeatures/Core/Implementation/CallHierarchy/CallHierarchyProvider.cs index e9c0f8c2da876c01140790c7727ce164da90413b..c6b50f934900aeb3f37d548f3c0dd2f73ca7b3c3 100644 --- a/src/EditorFeatures/Core/Implementation/CallHierarchy/CallHierarchyProvider.cs +++ b/src/EditorFeatures/Core/Implementation/CallHierarchy/CallHierarchyProvider.cs @@ -131,7 +131,7 @@ public async Task> CreateFinders(ISymbol symbol, public void NavigateTo(SymbolKey id, Project project, CancellationToken cancellationToken) { var compilation = project.GetCompilationAsync(cancellationToken).WaitAndGetResult(cancellationToken); - var resolution = id.Resolve(compilation); + var resolution = id.Resolve(compilation, cancellationToken: cancellationToken); project.Solution.Workspace.Services.GetService().TryNavigateToSymbol(resolution.Symbol, project, usePreviewTab: true); } } diff --git a/src/EditorFeatures/Core/Implementation/CallHierarchy/Finders/AbstractCallFinder.cs b/src/EditorFeatures/Core/Implementation/CallHierarchy/Finders/AbstractCallFinder.cs index 72f95ada4ff8f23ace08f59002ce20328fe35601..ba76e102aa9adf7c2d6062f84e606b3d974d0c0e 100644 --- a/src/EditorFeatures/Core/Implementation/CallHierarchy/Finders/AbstractCallFinder.cs +++ b/src/EditorFeatures/Core/Implementation/CallHierarchy/Finders/AbstractCallFinder.cs @@ -73,7 +73,7 @@ private async Task SearchAsync(ICallHierarchySearchCallback callback, CallHierar var workspace = _project.Solution.Workspace; var currentProject = workspace.CurrentSolution.GetProject(_project.Id); var compilation = await currentProject.GetCompilationAsync(cancellationToken).ConfigureAwait(false); - var resolution = _symbol.Resolve(compilation); + var resolution = _symbol.Resolve(compilation, cancellationToken: cancellationToken); var documents = this.Documents ?? IncludeDocuments(scope, currentProject); diff --git a/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/CompletionProviders/AbstractMemberInsertingCompletionProvider.cs b/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/CompletionProviders/AbstractMemberInsertingCompletionProvider.cs index 126e16d2f78e71d149833c465058ac5166922e1f..dc89670041a7321e12de2cbe5e6e198a5cd8b7c3 100644 --- a/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/CompletionProviders/AbstractMemberInsertingCompletionProvider.cs +++ b/src/EditorFeatures/Core/Implementation/IntelliSense/Completion/CompletionProviders/AbstractMemberInsertingCompletionProvider.cs @@ -143,7 +143,7 @@ private Document DetermineNewDocument(MemberInsertionCompletionItem completionIt // Resolve member and type in our new, forked, solution var semanticModel = document.GetSemanticModelAsync(cancellationToken).WaitAndGetResult(cancellationToken); var containingType = semanticModel.GetEnclosingSymbol(line.Start, cancellationToken); - var resolution = completionItem.SymbolId.Resolve(semanticModel.Compilation); + var resolution = completionItem.SymbolId.Resolve(semanticModel.Compilation, cancellationToken: cancellationToken); var overriddenMember = GetResolvedSymbol(resolution, line.Extent.Span.ToTextSpan()); // CodeGenerationOptions containing before and after @@ -155,15 +155,15 @@ private Document DetermineNewDocument(MemberInsertionCompletionItem completionIt Document memberContainingDocument = null; if (generatedMember.Kind == SymbolKind.Method) { - memberContainingDocument = codeGenService.AddMethodAsync(document.Project.Solution, containingType, (IMethodSymbol)generatedMember, options).WaitAndGetResult(cancellationToken); + memberContainingDocument = codeGenService.AddMethodAsync(document.Project.Solution, containingType, (IMethodSymbol)generatedMember, options, cancellationToken).WaitAndGetResult(cancellationToken); } else if (generatedMember.Kind == SymbolKind.Property) { - memberContainingDocument = codeGenService.AddPropertyAsync(document.Project.Solution, containingType, (IPropertySymbol)generatedMember, options).WaitAndGetResult(cancellationToken); + memberContainingDocument = codeGenService.AddPropertyAsync(document.Project.Solution, containingType, (IPropertySymbol)generatedMember, options, cancellationToken).WaitAndGetResult(cancellationToken); } else if (generatedMember.Kind == SymbolKind.Event) { - memberContainingDocument = codeGenService.AddEventAsync(document.Project.Solution, containingType, (IEventSymbol)generatedMember, options).WaitAndGetResult(cancellationToken); + memberContainingDocument = codeGenService.AddEventAsync(document.Project.Solution, containingType, (IEventSymbol)generatedMember, options, cancellationToken).WaitAndGetResult(cancellationToken); } return memberContainingDocument; diff --git a/src/EditorFeatures/Core/Implementation/MetadataAsSource/MetadataAsSourceFileService.cs b/src/EditorFeatures/Core/Implementation/MetadataAsSource/MetadataAsSourceFileService.cs index 1d19b79f592d50219ae6908e2f5f46a6ceb78c49..eac6205a5cca4298cdeb6eb604b8c50ed3b7be83 100644 --- a/src/EditorFeatures/Core/Implementation/MetadataAsSource/MetadataAsSourceFileService.cs +++ b/src/EditorFeatures/Core/Implementation/MetadataAsSource/MetadataAsSourceFileService.cs @@ -282,7 +282,7 @@ internal async Task MapSymbolAsync(Document document, Symbo } var compilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); - var resolutionResult = symbolId.Resolve(compilation, ignoreAssemblyKey: true); + var resolutionResult = symbolId.Resolve(compilation, ignoreAssemblyKey: true, cancellationToken: cancellationToken); if (resolutionResult.Symbol == null) { return null; diff --git a/src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingTaggerProvider.RenameTrackingCodeAction.cs b/src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingTaggerProvider.RenameTrackingCodeAction.cs index 8cc423c6cde0c247486e529628db420a7d1bf033..9b309ad85827c92a9a10ec6feb7331e2d201b2ff 100644 --- a/src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingTaggerProvider.RenameTrackingCodeAction.cs +++ b/src/EditorFeatures/Core/Implementation/RenameTracking/RenameTrackingTaggerProvider.RenameTrackingCodeAction.cs @@ -52,7 +52,7 @@ protected override Task> ComputeOperationsAsync if (textBuffer.Properties.TryGetProperty(typeof(StateMachine), out stateMachine)) { TrackingSession trackingSession; - if (stateMachine.CanInvokeRename(out trackingSession)) + if (stateMachine.CanInvokeRename(out trackingSession, cancellationToken: cancellationToken)) { var snapshotSpan = stateMachine.TrackingSession.TrackingSpan.GetSpan(stateMachine.Buffer.CurrentSnapshot); var str = string.Format(EditorFeaturesResources.RenameTo, stateMachine.TrackingSession.OriginalName, snapshotSpan.GetText()); diff --git a/src/EditorFeatures/Core/SymbolMapping/SymbolMappingServiceFactory.cs b/src/EditorFeatures/Core/SymbolMapping/SymbolMappingServiceFactory.cs index d9bb18d75900acc88a9f1ad0642bc4b5985f7f00..2826cad578abe86ae4a148d9bba261a8637293a6 100644 --- a/src/EditorFeatures/Core/SymbolMapping/SymbolMappingServiceFactory.cs +++ b/src/EditorFeatures/Core/SymbolMapping/SymbolMappingServiceFactory.cs @@ -21,7 +21,7 @@ private sealed class SymbolMappingService : ISymbolMappingService public async Task MapSymbolAsync(Document document, SymbolKey symbolId, CancellationToken cancellationToken) { var compilation = await document.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); - var symbol = symbolId.Resolve(compilation).Symbol; + var symbol = symbolId.Resolve(compilation, cancellationToken: cancellationToken).Symbol; if (symbol != null) { return new SymbolMappingResult(document.Project, symbol); diff --git a/src/Features/CSharp/ChangeSignature/CSharpChangeSignatureService.cs b/src/Features/CSharp/ChangeSignature/CSharpChangeSignatureService.cs index 2114601936ab3d00633666a2da9ca8ffeec09c56..18a0c5600bb73979b9979461b1c965edec7677b9 100644 --- a/src/Features/CSharp/ChangeSignature/CSharpChangeSignatureService.cs +++ b/src/Features/CSharp/ChangeSignature/CSharpChangeSignatureService.cs @@ -26,7 +26,7 @@ internal sealed class CSharpChangeSignatureService : AbstractChangeSignatureServ public override ISymbol GetInvocationSymbol(Document document, int position, bool restrictToDeclarations, CancellationToken cancellationToken) { var tree = document.GetSyntaxTreeAsync(cancellationToken).WaitAndGetResult(cancellationToken); - var token = tree.GetRoot().FindToken(position != tree.Length ? position : Math.Max(0, position - 1)); + var token = tree.GetRoot(cancellationToken).FindToken(position != tree.Length ? position : Math.Max(0, position - 1)); var ancestorDeclarationKinds = restrictToDeclarations ? invokableAncestorKinds.Add(SyntaxKind.Block) : invokableAncestorKinds; SyntaxNode matchingNode = token.Parent.AncestorsAndSelf().FirstOrDefault(n => ancestorDeclarationKinds.Contains(n.Kind())); @@ -49,7 +49,7 @@ public override ISymbol GetInvocationSymbol(Document document, int position, boo if (token.Parent.AncestorsAndSelf().Any(a => a == objectCreation.Type)) { - var typeSymbol = semanticModel.GetSymbolInfo(objectCreation.Type).Symbol; + var typeSymbol = semanticModel.GetSymbolInfo(objectCreation.Type, cancellationToken).Symbol; if (typeSymbol != null && typeSymbol.IsKind(SymbolKind.NamedType) && (typeSymbol as ITypeSymbol).TypeKind == TypeKind.Delegate) { return typeSymbol; @@ -264,7 +264,7 @@ private SyntaxNode GetNodeContainingTargetNode(SyntaxNode matchingNode) var invocation = updatedNode as InvocationExpressionSyntax; var semanticModel = document.GetSemanticModelAsync(cancellationToken).WaitAndGetResult(cancellationToken); - var symbolInfo = semanticModel.GetSymbolInfo(originalNode as InvocationExpressionSyntax); + var symbolInfo = semanticModel.GetSymbolInfo(originalNode as InvocationExpressionSyntax, cancellationToken); var methodSymbol = symbolInfo.Symbol as IMethodSymbol; var isReducedExtensionMethod = false; @@ -516,12 +516,12 @@ public override async Task> DetermineCascadedSymbolsFromDel n => { if (!n.IsKind(SyntaxKind.IdentifierName) || - !semanticModel.GetMemberGroup(n).Any()) + !semanticModel.GetMemberGroup(n, cancellationToken).Any()) { return false; } - ISymbol convertedType = semanticModel.GetTypeInfo(n).ConvertedType; + ISymbol convertedType = semanticModel.GetTypeInfo(n, cancellationToken).ConvertedType; if (convertedType != null) { @@ -530,12 +530,12 @@ public override async Task> DetermineCascadedSymbolsFromDel if (convertedType != null) { - convertedType = SymbolFinder.FindSourceDefinitionAsync(convertedType, document.Project.Solution).WaitAndGetResult(cancellationToken) ?? convertedType; + convertedType = SymbolFinder.FindSourceDefinitionAsync(convertedType, document.Project.Solution, cancellationToken).WaitAndGetResult(cancellationToken) ?? convertedType; } return convertedType == symbol.ContainingType; }) - .Select(n => semanticModel.GetSymbolInfo(n).Symbol); + .Select(n => semanticModel.GetSymbolInfo(n, cancellationToken).Symbol); return convertedMethodGroups; } diff --git a/src/Features/CSharp/CodeFixes/Async/CSharpConvertToAsyncMethodCodeFixProvider.cs b/src/Features/CSharp/CodeFixes/Async/CSharpConvertToAsyncMethodCodeFixProvider.cs index 1432d260e57cc5aa7437235493bde4117d6aae1f..5d7554f53708cd5b343fa1c688b7094441e66a50 100644 --- a/src/Features/CSharp/CodeFixes/Async/CSharpConvertToAsyncMethodCodeFixProvider.cs +++ b/src/Features/CSharp/CodeFixes/Async/CSharpConvertToAsyncMethodCodeFixProvider.cs @@ -59,7 +59,7 @@ public override ImmutableArray FixableDiagnosticIds CancellationToken cancellationToken) { var invocationExpression = node.ChildNodes().FirstOrDefault(n => n.IsKind(SyntaxKind.InvocationExpression)); - var methodSymbol = semanticModel.GetSymbolInfo(invocationExpression).Symbol as IMethodSymbol; + var methodSymbol = semanticModel.GetSymbolInfo(invocationExpression, cancellationToken).Symbol as IMethodSymbol; if (methodSymbol == null) { return null; diff --git a/src/Features/CSharp/CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.ReferenceRewriter.cs b/src/Features/CSharp/CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.ReferenceRewriter.cs index 72ef88412d51f5204a3eeed853e22106c0fede05..3bae0ada5d0a3a8f692fc4a54a14f7ee25600f48 100644 --- a/src/Features/CSharp/CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.ReferenceRewriter.cs +++ b/src/Features/CSharp/CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.ReferenceRewriter.cs @@ -28,7 +28,7 @@ private class ReferenceRewriter : CSharpSyntaxRewriter CancellationToken cancellationToken) { this.semanticModel = semanticModel; - this.localSymbol = (ILocalSymbol)semanticModel.GetDeclaredSymbol(variableDeclarator); + this.localSymbol = (ILocalSymbol)semanticModel.GetDeclaredSymbol(variableDeclarator, cancellationToken); this.variableDeclarator = variableDeclarator; this.expressionToInline = expressionToInline; this.cancellationToken = cancellationToken; diff --git a/src/Features/CSharp/CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.cs b/src/Features/CSharp/CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.cs index 679101db06bf93d3de4f48a2cf3d3370236f3ea4..ce3db970a3a70666b5497a8eb028845ed689d4a6 100644 --- a/src/Features/CSharp/CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.cs +++ b/src/Features/CSharp/CodeRefactorings/InlineTemporary/InlineTemporaryCodeRefactoringProvider.cs @@ -199,7 +199,7 @@ private async Task InlineTemporaryAsync(Document document, VariableDec .Select(ident => GetTopMostParentingExpression(ident)) .Distinct(); - var originalInitializerSymbolInfo = semanticModel.GetSymbolInfo(variableDeclarator.Initializer.Value); + var originalInitializerSymbolInfo = semanticModel.GetSymbolInfo(variableDeclarator.Initializer.Value, cancellationToken); // Make each topmost parenting statement or Equals Clause Expressions semantically explicit. updatedDocument = await updatedDocument.ReplaceNodesAsync(topmostParentingExpressions, (o, n) => Simplifier.Expand(n, semanticModel, workspace, cancellationToken: cancellationToken), cancellationToken).ConfigureAwait(false); diff --git a/src/Features/CSharp/CodeRefactorings/InvertIf/InvertIfCodeRefactoringProvider.cs b/src/Features/CSharp/CodeRefactorings/InvertIf/InvertIfCodeRefactoringProvider.cs index f80741545f52d669cc84942fa2064158f61ac2b3..bde2bc06631ba9a7b3b3647bf1859871f934c6e4 100644 --- a/src/Features/CSharp/CodeRefactorings/InvertIf/InvertIfCodeRefactoringProvider.cs +++ b/src/Features/CSharp/CodeRefactorings/InvertIf/InvertIfCodeRefactoringProvider.cs @@ -143,7 +143,7 @@ private bool IsComparisonOfZeroAndSomethingNeverLessThanZero(BinaryExpressionSyn SemanticModel semanticModel, CancellationToken cancellationToken) { - var numericValue = semanticModel.GetConstantValue(numericLiteralExpression); + var numericValue = semanticModel.GetConstantValue(numericLiteralExpression, cancellationToken); if (numericValue.HasValue && numericValue.Value is int && (int)numericValue.Value == 0) { var symbol = semanticModel.GetSymbolInfo(variableExpression, cancellationToken).Symbol; diff --git a/src/Features/CSharp/CodeRefactorings/MoveDeclarationNearReference/MoveDeclarationNearReferenceCodeRefactoringProvider.State.cs b/src/Features/CSharp/CodeRefactorings/MoveDeclarationNearReference/MoveDeclarationNearReferenceCodeRefactoringProvider.State.cs index 91e47a0b579bafead885531870708b06116c8e8a..b29a5dc5a977feca54418f634dda70a0b91d3bf0 100644 --- a/src/Features/CSharp/CodeRefactorings/MoveDeclarationNearReference/MoveDeclarationNearReferenceCodeRefactoringProvider.State.cs +++ b/src/Features/CSharp/CodeRefactorings/MoveDeclarationNearReference/MoveDeclarationNearReferenceCodeRefactoringProvider.State.cs @@ -60,7 +60,7 @@ private class State this.VariableDeclaration = this.DeclarationStatement.Declaration; this.VariableDeclarator = this.VariableDeclaration.Variables[0]; this.OutermostBlock = (BlockSyntax)this.DeclarationStatement.Parent; - this.LocalSymbol = (ILocalSymbol)document.SemanticModel.GetDeclaredSymbol(this.VariableDeclarator); + this.LocalSymbol = (ILocalSymbol)document.SemanticModel.GetDeclaredSymbol(this.VariableDeclarator, cancellationToken); if (this.LocalSymbol == null) { // This can happen in broken code, for example: "{ object x; object }" diff --git a/src/Features/CSharp/CodeRefactorings/MoveDeclarationNearReference/MoveDeclarationNearReferenceCodeRefactoringProvider.cs b/src/Features/CSharp/CodeRefactorings/MoveDeclarationNearReference/MoveDeclarationNearReferenceCodeRefactoringProvider.cs index 970ec5ec0f5a6e7bfba7e28ab96ff80ef11801e9..1ca53d313a0ff28ce23f9e6d5f170676150be5f2 100644 --- a/src/Features/CSharp/CodeRefactorings/MoveDeclarationNearReference/MoveDeclarationNearReferenceCodeRefactoringProvider.cs +++ b/src/Features/CSharp/CodeRefactorings/MoveDeclarationNearReference/MoveDeclarationNearReferenceCodeRefactoringProvider.cs @@ -174,7 +174,7 @@ private StatementSyntax CreateMergedDeclarationStatement(State state, StatementS { // Type inference. Only merge if types match. var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); - var rightType = semanticModel.GetTypeInfo(expression.Right); + var rightType = semanticModel.GetTypeInfo(expression.Right, cancellationToken); return (localSymbol.Type == null && rightType.Type == null) || localSymbol.Type.Equals(rightType.Type); } else diff --git a/src/Features/CSharp/Completion/CompletionProviders/CrefCompletionProvider.cs b/src/Features/CSharp/Completion/CompletionProviders/CrefCompletionProvider.cs index dda4e924cf3046fba8459e8cdb362eaa360ec1bb..8a65dbd464b225c9c656208122500469ffdd1b45 100644 --- a/src/Features/CSharp/Completion/CompletionProviders/CrefCompletionProvider.cs +++ b/src/Features/CSharp/Completion/CompletionProviders/CrefCompletionProvider.cs @@ -95,8 +95,8 @@ protected override async Task> GetItemsWorkerAsync(D { // cref "a.|" var parent = token.Parent as QualifiedCrefSyntax; - var leftType = semanticModel.GetTypeInfo(parent.Container).Type; - var leftSymbol = semanticModel.GetSymbolInfo(parent.Container).Symbol; + var leftType = semanticModel.GetTypeInfo(parent.Container, cancellationToken).Type; + var leftSymbol = semanticModel.GetSymbolInfo(parent.Container, cancellationToken).Symbol; var container = leftSymbol ?? leftType; diff --git a/src/Features/CSharp/Completion/CompletionProviders/ObjectCreationCompletionProvider.cs b/src/Features/CSharp/Completion/CompletionProviders/ObjectCreationCompletionProvider.cs index d4dde658a0fd2c559c22851cea5e56b00978f35d..868c556c0ca338f2c1854b2181a72d763e1c45bf 100644 --- a/src/Features/CSharp/Completion/CompletionProviders/ObjectCreationCompletionProvider.cs +++ b/src/Features/CSharp/Completion/CompletionProviders/ObjectCreationCompletionProvider.cs @@ -73,7 +73,7 @@ protected override SyntaxNode GetObjectCreationNewExpression(SyntaxTree tree, in protected override async Task CreateContext(Document document, int position, CancellationToken cancellationToken) { - var semanticModel = await document.GetCSharpSemanticModelForSpanAsync(new TextSpan(position, 0)).ConfigureAwait(false); + var semanticModel = await document.GetCSharpSemanticModelForSpanAsync(new TextSpan(position, 0), cancellationToken).ConfigureAwait(false); return CSharpSyntaxContext.CreateContext(document.Project.Solution.Workspace, semanticModel, position, cancellationToken); } diff --git a/src/Features/CSharp/Completion/KeywordRecommenders/EnumKeywordRecommender.cs b/src/Features/CSharp/Completion/KeywordRecommenders/EnumKeywordRecommender.cs index 7f83c93b34c816440284df6451ce4a3f976d6868..fb3c9ff8ca14b9ccba68ca6b5d502946dcd201c2 100644 --- a/src/Features/CSharp/Completion/KeywordRecommenders/EnumKeywordRecommender.cs +++ b/src/Features/CSharp/Completion/KeywordRecommenders/EnumKeywordRecommender.cs @@ -29,7 +29,8 @@ protected override bool IsValidContext(int position, CSharpSyntaxContext context context.IsTypeDeclarationContext( validModifiers: ValidModifiers, validTypeDeclarations: SyntaxKindSet.ClassStructTypeDeclarations, - canBePartial: false); + canBePartial: false, + cancellationToken: cancellationToken); } } } diff --git a/src/Features/CSharp/EncapsulateField/CSharpEncapsulateFieldService.cs b/src/Features/CSharp/EncapsulateField/CSharpEncapsulateFieldService.cs index 396c17c4be150f9eadfa51ff304324497919a54f..4f76d2655b4fc10d9bc5b399dea9be884464e2b7 100644 --- a/src/Features/CSharp/EncapsulateField/CSharpEncapsulateFieldService.cs +++ b/src/Features/CSharp/EncapsulateField/CSharpEncapsulateFieldService.cs @@ -78,7 +78,7 @@ protected async override Task RewriteFieldNameAndAccessibility(strin declarator = root.GetAnnotatedNodes(tempAnnotation).First(); declaration = declarator.Parent as VariableDeclarationSyntax; - var field = semanticModel.GetDeclaredSymbol(declarator) as IFieldSymbol; + var field = semanticModel.GetDeclaredSymbol(declarator, cancellationToken) as IFieldSymbol; var fieldToAdd = declarationAnnotation.AddAnnotationToSymbol(CodeGenerationSymbolFactory.CreateFieldSymbol( field.GetAttributes(), @@ -125,7 +125,7 @@ protected override async Task> GetFieldsAsync(Document declarators = declarations.SelectMany(d => d.Variables.Where(v => v.Span.IntersectsWith(span))); } - return declarators.Select(d => semanticModel.GetDeclaredSymbol(d) as IFieldSymbol) + return declarators.Select(d => semanticModel.GetDeclaredSymbol(d, cancellationToken) as IFieldSymbol) .WhereNotNull() .Where(f => f.Name.Length != 0); } diff --git a/src/Features/CSharp/GenerateType/CSharpGenerateTypeService.cs b/src/Features/CSharp/GenerateType/CSharpGenerateTypeService.cs index 618c060f2c49510c1672943ccab5cd9487ebecf7..8d885a79dcd9858b883b9c70cbd315b1a55308ab 100644 --- a/src/Features/CSharp/GenerateType/CSharpGenerateTypeService.cs +++ b/src/Features/CSharp/GenerateType/CSharpGenerateTypeService.cs @@ -230,7 +230,7 @@ protected override bool TryGetNameParts(ExpressionSyntax expression, out IList p.ContainingSymbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).AsEnumerable()) + var lambdas = anonymousMethodParameters.SelectMany(p => p.ContainingSymbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax(cancellationToken)).AsEnumerable()) .Where(n => n is ParenthesizedLambdaExpressionSyntax || n is SimpleLambdaExpressionSyntax) .ToSet(); diff --git a/src/Features/Core/ChangeSignature/DelegateInvokeMethodReferenceFinder.cs b/src/Features/Core/ChangeSignature/DelegateInvokeMethodReferenceFinder.cs index c055ad754f9037a7f5df133e9c365e5c2fc14ce3..900e5f3418d5b3df6871c9b364a1d7d84f2f58c5 100644 --- a/src/Features/Core/ChangeSignature/DelegateInvokeMethodReferenceFinder.cs +++ b/src/Features/Core/ChangeSignature/DelegateInvokeMethodReferenceFinder.cs @@ -83,7 +83,7 @@ protected override bool CanFind(IMethodSymbol symbol) var convertedAnonymousFunctions = nodes.Where(n => syntaxFactsService.IsAnonymousFunction(n)) .Where(n => { - ISymbol convertedType = semanticModel.GetTypeInfo(n).ConvertedType; + ISymbol convertedType = semanticModel.GetTypeInfo(n, cancellationToken).ConvertedType; if (convertedType != null) { diff --git a/src/Features/Core/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs b/src/Features/Core/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs index 4e2506ff69239e85baccd660bef97d26df6cc1e7..9adf2a97aeca9f267e6cdd120ce63d838189fec5 100644 --- a/src/Features/Core/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs +++ b/src/Features/Core/CodeFixes/AddImport/AbstractAddImportCodeFixProvider.cs @@ -370,7 +370,7 @@ protected bool ExpressionBinds(SyntaxNode expression, SemanticModel semanticMode // See if the name binds to something other then the error type. If it does, there's nothing further we need to do. // For extension methods, however, we will continue to search if there exists any better matched method. cancellationToken.ThrowIfCancellationRequested(); - var symbolInfo = semanticModel.GetSymbolInfo(expression); + var symbolInfo = semanticModel.GetSymbolInfo(expression, cancellationToken); if (symbolInfo.CandidateReason == CandidateReason.OverloadResolutionFailure && !checkForExtensionMethods) { return true; diff --git a/src/Features/Core/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.cs b/src/Features/Core/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.cs index f6b770e1b70f1314c0ebe3c872283fc5ae678df5..b13c41efb3cf75fcdd18ad11e0c429fa2fb4ac82 100644 --- a/src/Features/Core/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.cs +++ b/src/Features/Core/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.cs @@ -107,7 +107,7 @@ public async Task> GetSuppressionsAsync(Document document, // Find the start token to attach leading pragma disable warning directive. var root = await syntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false); SyntaxTrivia containingTrivia = root.FindTrivia(span.Start); - var lines = syntaxTree.GetText().Lines; + var lines = syntaxTree.GetText(cancellationToken).Lines; int indexOfLine; if (containingTrivia == default(SyntaxTrivia)) { diff --git a/src/Features/Core/EncapsulateField/AbstractEncapsulateFieldService.cs b/src/Features/Core/EncapsulateField/AbstractEncapsulateFieldService.cs index 6d099fe1e7c1408b504d5d44399a9d2ad6bfc427..dcce8ab0fec81ecc37ac2a5a99861f90c66a4783 100644 --- a/src/Features/Core/EncapsulateField/AbstractEncapsulateFieldService.cs +++ b/src/Features/Core/EncapsulateField/AbstractEncapsulateFieldService.cs @@ -116,7 +116,7 @@ private async Task EncapsulateFieldResultAsync(Document document, TextSp { var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); var compilation = semanticModel.Compilation; - var currentField = field.GetSymbolKey().Resolve(compilation).Symbol as IFieldSymbol; + var currentField = field.GetSymbolKey().Resolve(compilation, cancellationToken: cancellationToken).Symbol as IFieldSymbol; // We couldn't resolve this field. skip it if (currentField == null) @@ -154,8 +154,8 @@ private async Task EncapsulateFieldAsync(IFieldSymbol field, Document do // Annotate the field declarations so we can find it after rename. var fieldDeclaration = field.DeclaringSyntaxReferences.First(); var declarationAnnotation = new SyntaxAnnotation(); - document = document.WithSyntaxRoot(fieldDeclaration.SyntaxTree.GetRoot().ReplaceNode(fieldDeclaration.GetSyntax(), - fieldDeclaration.GetSyntax().WithAdditionalAnnotations(declarationAnnotation))); + document = document.WithSyntaxRoot(fieldDeclaration.SyntaxTree.GetRoot(cancellationToken).ReplaceNode(fieldDeclaration.GetSyntax(cancellationToken), + fieldDeclaration.GetSyntax(cancellationToken).WithAdditionalAnnotations(declarationAnnotation))); var solution = document.Project.Solution; @@ -179,7 +179,7 @@ private async Task EncapsulateFieldAsync(IFieldSymbol field, Document do var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); var compilation = semanticModel.Compilation; - field = field.GetSymbolKey().Resolve(compilation).Symbol as IFieldSymbol; + field = field.GetSymbolKey().Resolve(compilation, cancellationToken: cancellationToken).Symbol as IFieldSymbol; Solution solutionNeedingProperty = null; // We couldn't resolve field after annotating its declaration. Bail @@ -209,7 +209,7 @@ private async Task EncapsulateFieldAsync(IFieldSymbol field, Document do semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); compilation = semanticModel.Compilation; - field = field.GetSymbolKey().Resolve(compilation).Symbol as IFieldSymbol; + field = field.GetSymbolKey().Resolve(compilation, cancellationToken: cancellationToken).Symbol as IFieldSymbol; } } diff --git a/src/Features/Core/ExtractInterface/AbstractExtractInterfaceService.cs b/src/Features/Core/ExtractInterface/AbstractExtractInterfaceService.cs index 2727a3490017e70ba0398503617c1e648df01072..cd0b2c44f381ffa352951c2a0507338ce5da88d8 100644 --- a/src/Features/Core/ExtractInterface/AbstractExtractInterfaceService.cs +++ b/src/Features/Core/ExtractInterface/AbstractExtractInterfaceService.cs @@ -276,7 +276,7 @@ public ExtractInterfaceResult ExtractInterfaceFromAnalyzedType(ExtractInterfaceT private static Solution GetSolutionWithFormattedInterfaceDocument(Document unformattedInterfaceDocument, CancellationToken cancellationToken) { Solution solutionWithInterfaceDocument; - var formattedRoot = Formatter.Format(unformattedInterfaceDocument.GetSyntaxRootAsync(cancellationToken).WaitAndGetResult(cancellationToken), unformattedInterfaceDocument.Project.Solution.Workspace); + var formattedRoot = Formatter.Format(unformattedInterfaceDocument.GetSyntaxRootAsync(cancellationToken).WaitAndGetResult(cancellationToken), unformattedInterfaceDocument.Project.Solution.Workspace, cancellationToken: cancellationToken); var rootToSimplify = formattedRoot.WithAdditionalAnnotations(Simplifier.Annotation); var finalInterfaceDocument = Simplifier.ReduceAsync(unformattedInterfaceDocument.WithSyntaxRoot(rootToSimplify), cancellationToken: cancellationToken).WaitAndGetResult(cancellationToken); diff --git a/src/Features/Core/GenerateFromMembers/AddConstructorParameters/AbstractAddConstructorParametersService.CodeAction.cs b/src/Features/Core/GenerateFromMembers/AddConstructorParameters/AbstractAddConstructorParametersService.CodeAction.cs index e9f89ae60fe9886fd10a841ad51d6fe6c60031fe..d1de2fa7d3c0f2ac6154d9c4abb70b2b3b2b2383 100644 --- a/src/Features/Core/GenerateFromMembers/AddConstructorParameters/AbstractAddConstructorParametersService.CodeAction.cs +++ b/src/Features/Core/GenerateFromMembers/AddConstructorParameters/AbstractAddConstructorParametersService.CodeAction.cs @@ -40,7 +40,7 @@ protected override Task GetChangedDocumentAsync(CancellationToken canc { var workspace = document.Project.Solution.Workspace; var declarationService = document.Project.LanguageServices.GetService(); - var constructor = declarationService.GetDeclarations(state.DelegatedConstructor).Select(r => r.GetSyntax()).First(); + var constructor = declarationService.GetDeclarations(state.DelegatedConstructor).Select(r => r.GetSyntax(cancellationToken)).First(); var newConstructor = constructor; newConstructor = CodeGenerator.AddParameterDeclarations(newConstructor, parameters.Skip(state.DelegatedConstructor.Parameters.Length), workspace); diff --git a/src/Features/Core/GenerateMember/GenerateEnumMember/AbstractGenerateEnumMemberService.State.cs b/src/Features/Core/GenerateMember/GenerateEnumMember/AbstractGenerateEnumMemberService.State.cs index 615ebb2b12c51db3a87aaaf26512f4fd87125f37..0c36a4ebf7caa3aad83a2b5ce5d417b53d0e87da 100644 --- a/src/Features/Core/GenerateMember/GenerateEnumMember/AbstractGenerateEnumMemberService.State.cs +++ b/src/Features/Core/GenerateMember/GenerateEnumMember/AbstractGenerateEnumMemberService.State.cs @@ -116,7 +116,7 @@ private partial class State return false; } - var semanticInfo = semanticModel.GetSymbolInfo(this.SimpleNameOrMemberAccessExpression); + var semanticInfo = semanticModel.GetSymbolInfo(this.SimpleNameOrMemberAccessExpression, cancellationToken); if (cancellationToken.IsCancellationRequested) { return false; diff --git a/src/Features/Core/GenerateMember/GenerateParameterizedMember/AbstractGenerateMethodService.State.cs b/src/Features/Core/GenerateMember/GenerateParameterizedMember/AbstractGenerateMethodService.State.cs index 99ee898efe359d65efafe8eb60c1291bcabedee1..ba54078e0ae6dbb093e0bff520ac587cbe116df6 100644 --- a/src/Features/Core/GenerateMember/GenerateParameterizedMember/AbstractGenerateMethodService.State.cs +++ b/src/Features/Core/GenerateMember/GenerateParameterizedMember/AbstractGenerateMethodService.State.cs @@ -185,7 +185,7 @@ internal new class State : AbstractGenerateParameterizedMemberService s.Kind == SymbolKind.Local || s.Kind == SymbolKind.Parameter) && !service.AreSpecialOptionsActive(semanticModel)) { diff --git a/src/Features/Core/GenerateMember/GenerateVariable/AbstractGenerateVariableService.GenerateLocalCodeAction.cs b/src/Features/Core/GenerateMember/GenerateVariable/AbstractGenerateVariableService.GenerateLocalCodeAction.cs index 95c2761f0d451780a8de91f69020fbc30529a3f4..ca8f27792c996b93f1f2073a3c6fa453f375f129 100644 --- a/src/Features/Core/GenerateMember/GenerateVariable/AbstractGenerateVariableService.GenerateLocalCodeAction.cs +++ b/src/Features/Core/GenerateMember/GenerateVariable/AbstractGenerateVariableService.GenerateLocalCodeAction.cs @@ -70,7 +70,8 @@ private SyntaxNode GetNewRoot(CancellationToken cancellationToken) return codeGenService.AddStatements( root, SpecializedCollections.SingletonEnumerable(localStatement), - options: new CodeGenerationOptions(beforeThisLocation: state.IdentifierToken.GetLocation())); + options: new CodeGenerationOptions(beforeThisLocation: state.IdentifierToken.GetLocation()), + cancellationToken: cancellationToken); } } } diff --git a/src/Features/Core/GenerateMember/GenerateVariable/AbstractGenerateVariableService.State.cs b/src/Features/Core/GenerateMember/GenerateVariable/AbstractGenerateVariableService.State.cs index 33ea1ce007f26cd74781e8c35461c01f13ad6367..6fb8a71554d67519ebc5d19019b496a790a428d6 100644 --- a/src/Features/Core/GenerateMember/GenerateVariable/AbstractGenerateVariableService.State.cs +++ b/src/Features/Core/GenerateMember/GenerateVariable/AbstractGenerateVariableService.State.cs @@ -228,7 +228,7 @@ internal bool CanGenerateLocal() // Now, try to bind the invocation and see if it succeeds or not. if it succeeds and // binds uniquely, then we don't need to offer this quick fix. cancellationToken.ThrowIfCancellationRequested(); - var semanticInfo = semanticModel.GetSymbolInfo(this.SimpleNameOrMemberAccessExpressionOpt); + var semanticInfo = semanticModel.GetSymbolInfo(this.SimpleNameOrMemberAccessExpressionOpt, cancellationToken); cancellationToken.ThrowIfCancellationRequested(); if (semanticInfo.Symbol != null) diff --git a/src/Features/Core/GenerateType/AbstractGenerateTypeService.State.cs b/src/Features/Core/GenerateType/AbstractGenerateTypeService.State.cs index 9e588f22c9a2c30c884c2744126abf31081d9247..4a5355f99fb54356692b344bf46a928989c7b73a 100644 --- a/src/Features/Core/GenerateType/AbstractGenerateTypeService.State.cs +++ b/src/Features/Core/GenerateType/AbstractGenerateTypeService.State.cs @@ -364,7 +364,7 @@ private bool GenerateStruct(TService service, SemanticModel semanticModel, Cance TExpressionSyntax leftSide, CancellationToken cancellationToken) { - var leftSideInfo = semanticModel.GetSymbolInfo(leftSide); + var leftSideInfo = semanticModel.GetSymbolInfo(leftSide, cancellationToken); if (leftSideInfo.Symbol != null) { diff --git a/src/Features/Core/GenerateType/AbstractGenerateTypeService.cs b/src/Features/Core/GenerateType/AbstractGenerateTypeService.cs index 3b5352b0351a1f231d186d71a2db29a58e84a752..f1916eee90cda71b892c43b5f02879fa8f06caac 100644 --- a/src/Features/Core/GenerateType/AbstractGenerateTypeService.cs +++ b/src/Features/Core/GenerateType/AbstractGenerateTypeService.cs @@ -129,7 +129,7 @@ private bool CanGenerateIntoContainingNamespace(SemanticDocument document, Synta var declarationService = document.Project.LanguageServices.GetService(); var decl = declarationService.GetDeclarations(containingNamespace) .Where(r => r.SyntaxTree == node.SyntaxTree) - .Select(r => r.GetSyntax()) + .Select(r => r.GetSyntax(cancellationToken)) .FirstOrDefault(node.GetAncestorsOrThis().Contains); return diff --git a/src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State.cs b/src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State.cs index c5c7e4576fcddddce30a793acd34dd0cfef20d87..d3e9c34a3c3203396cc5987b51204b0ca6f3cb0e 100644 --- a/src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State.cs +++ b/src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State.cs @@ -86,7 +86,7 @@ public State(TService service, SemanticDocument document) return false; } - this.IsConstant = this.Document.SemanticModel.GetConstantValue(this.Expression).HasValue; + this.IsConstant = this.Document.SemanticModel.GetConstantValue(this.Expression, cancellationToken).HasValue; // Note: the ordering of these clauses are important. They go, generally, from // innermost to outermost order. diff --git a/src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State_ConstructorInitializer.cs b/src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State_ConstructorInitializer.cs index 90b370619eaa59ea17b73a49cafcf7740f01d1a6..5a4d06be9fa9aebae7dadbeded37ed5bb671f5c2 100644 --- a/src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State_ConstructorInitializer.cs +++ b/src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State_ConstructorInitializer.cs @@ -30,7 +30,7 @@ private partial class State } // Can't extract out an anonymous type used in a constructor initializer. - var info = this.Document.SemanticModel.GetTypeInfo(this.Expression); + var info = this.Document.SemanticModel.GetTypeInfo(this.Expression, cancellationToken); if (info.Type.ContainsAnonymousType()) { return false; diff --git a/src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State_Field.cs b/src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State_Field.cs index 42992bd2b9040963e90846042c125c75ab8b1d2d..38ee3596bc16a056f2cccec14488295695936720 100644 --- a/src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State_Field.cs +++ b/src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State_Field.cs @@ -37,7 +37,7 @@ private partial class State } // Can't extract out an anonymous type used in a field initializer. - var info = this.Document.SemanticModel.GetTypeInfo(this.Expression); + var info = this.Document.SemanticModel.GetTypeInfo(this.Expression, cancellationToken); if (info.Type.ContainsAnonymousType()) { return false; diff --git a/src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State_Query.cs b/src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State_Query.cs index eaff71da849d2fd1848c8ccd979789d8dcd94d06..d7b75676a646c70812ff2e6872c4510311eb50aa 100644 --- a/src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State_Query.cs +++ b/src/Features/Core/IntroduceVariable/AbstractIntroduceVariableService.State_Query.cs @@ -24,7 +24,7 @@ private partial class State return false; } - var info = this.Document.SemanticModel.GetTypeInfo(this.Expression); + var info = this.Document.SemanticModel.GetTypeInfo(this.Expression, cancellationToken); if (info.Type == null || info.Type.SpecialType == SpecialType.System_Void) { return false; diff --git a/src/Features/Core/MetadataAsSource/MetadataAsSourceHelpers.cs b/src/Features/Core/MetadataAsSource/MetadataAsSourceHelpers.cs index 4eebf433fa6904cf5aeaf807cffbb5dadd1c7712..b2e97b4ae5b42a4b5fa1cc0d1042daa2a60e16fe 100644 --- a/src/Features/Core/MetadataAsSource/MetadataAsSourceHelpers.cs +++ b/src/Features/Core/MetadataAsSource/MetadataAsSourceHelpers.cs @@ -85,7 +85,7 @@ public static async Task GetLocationInGeneratedSourceAsync(SymbolKey s { var location = symbolId.Resolve( await generatedDocument.Project.GetCompilationAsync(cancellationToken).ConfigureAwait(false), - ignoreAssemblyKey: true) + ignoreAssemblyKey: true, cancellationToken: cancellationToken) .GetAllSymbols() .Select(s => s.Locations.Where(loc => loc.IsInSource).FirstOrDefault()) .WhereNotNull() diff --git a/src/Features/Core/Shared/Extensions/ISymbolExtensions_2.cs b/src/Features/Core/Shared/Extensions/ISymbolExtensions_2.cs index fe6f1fb9d07fda00252099f981d3c766589e33c7..d2cc1580d77147f0bee5a20c897c20f2b926f1ce 100644 --- a/src/Features/Core/Shared/Extensions/ISymbolExtensions_2.cs +++ b/src/Features/Core/Shared/Extensions/ISymbolExtensions_2.cs @@ -173,11 +173,11 @@ public static IEnumerable GetDocumentationParts(this ISymbol var globalNamespace = semanticModel.Compilation.GlobalNamespace; var documentation = symbol.TypeSwitch( - (IParameterSymbol parameter) => parameter.ContainingSymbol.OriginalDefinition.GetDocumentationComment().GetParameterText(symbol.Name), - (ITypeParameterSymbol typeParam) => typeParam.ContainingSymbol.GetDocumentationComment().GetTypeParameterText(symbol.Name), + (IParameterSymbol parameter) => parameter.ContainingSymbol.OriginalDefinition.GetDocumentationComment(cancellationToken: cancellationToken).GetParameterText(symbol.Name), + (ITypeParameterSymbol typeParam) => typeParam.ContainingSymbol.GetDocumentationComment(cancellationToken: cancellationToken).GetTypeParameterText(symbol.Name), (IMethodSymbol method) => GetMethodDocumentation(method), - (IAliasSymbol alias) => alias.Target.GetDocumentationComment().SummaryText, - _ => symbol.GetDocumentationComment().SummaryText); + (IAliasSymbol alias) => alias.Target.GetDocumentationComment(cancellationToken: cancellationToken).SummaryText, + _ => symbol.GetDocumentationComment(cancellationToken: cancellationToken).SummaryText); if (documentation != null) { diff --git a/src/Workspaces/CSharp/Portable/Extensions/ArgumentSyntaxExtensions.cs b/src/Workspaces/CSharp/Portable/Extensions/ArgumentSyntaxExtensions.cs index ec8e7231fe077ed0fa6dc6950bf0ed99be27b5bf..1af8d3cf6f4662fd8030e17ca53635e6532b13c2 100644 --- a/src/Workspaces/CSharp/Portable/Extensions/ArgumentSyntaxExtensions.cs +++ b/src/Workspaces/CSharp/Portable/Extensions/ArgumentSyntaxExtensions.cs @@ -107,7 +107,7 @@ public static RefKind GetRefKind(this ArgumentSyntax argument) { // If a parameter appears to have a void return type, then just use 'object' // instead. - var typeInfo = semanticModel.GetTypeInfo(argument.Expression); + var typeInfo = semanticModel.GetTypeInfo(argument.Expression, cancellationToken); if (typeInfo.Type != null && typeInfo.Type.SpecialType == SpecialType.System_Void) { return semanticModel.Compilation.ObjectType; diff --git a/src/Workspaces/CSharp/Portable/Extensions/ContextQuery/SyntaxTreeExtensions.cs b/src/Workspaces/CSharp/Portable/Extensions/ContextQuery/SyntaxTreeExtensions.cs index 81aa441443fcbb38caf06d909f29e2574de007e7..0d699b08a1108459dc58c9fd2bfa4dd5680a930e 100644 --- a/src/Workspaces/CSharp/Portable/Extensions/ContextQuery/SyntaxTreeExtensions.cs +++ b/src/Workspaces/CSharp/Portable/Extensions/ContextQuery/SyntaxTreeExtensions.cs @@ -2176,7 +2176,7 @@ public static bool IsNameOfContext(this SyntaxTree syntaxTree, int position, Sem return true; } - return semanticModelOpt.GetSymbolInfo(parentExpression).Symbol == null; + return semanticModelOpt.GetSymbolInfo(parentExpression, cancellationToken).Symbol == null; } return false; @@ -2369,7 +2369,7 @@ public static bool IsEnumTypeMemberAccessContext(this SyntaxTree syntaxTree, Sem } var memberAccess = (MemberAccessExpressionSyntax)token.Parent; - var leftHandBinding = semanticModel.GetSymbolInfo(memberAccess.Expression); + var leftHandBinding = semanticModel.GetSymbolInfo(memberAccess.Expression, cancellationToken); var symbol = leftHandBinding.GetBestOrAllSymbols().FirstOrDefault(); if (symbol == null) diff --git a/src/Workspaces/CSharp/Portable/Extensions/CrefSyntaxExtensions.cs b/src/Workspaces/CSharp/Portable/Extensions/CrefSyntaxExtensions.cs index 1cf2d39d7a065cf4d85fc4ec94d6c7e48103acca..9021030a87db435d8b450eb049b5b1f513a1fd8b 100644 --- a/src/Workspaces/CSharp/Portable/Extensions/CrefSyntaxExtensions.cs +++ b/src/Workspaces/CSharp/Portable/Extensions/CrefSyntaxExtensions.cs @@ -35,7 +35,7 @@ internal static class CrefSyntaxExtensions (memberCref.Kind() == SyntaxKind.NameMemberCref)) { var nameMemberCref = ((NameMemberCrefSyntax)memberCref).Name; - var symbolInfo = semanticModel.GetSymbolInfo(nameMemberCref); + var symbolInfo = semanticModel.GetSymbolInfo(nameMemberCref, cancellationToken); var symbol = symbolInfo.Symbol; if (symbol == null) diff --git a/src/Workspaces/CSharp/Portable/Extensions/ExpressionSyntaxExtensions.cs b/src/Workspaces/CSharp/Portable/Extensions/ExpressionSyntaxExtensions.cs index 0591756bd2e6c4d1bbf0f68e1b83de57fb0a4168..f688db43b60f92fe5aaaf6c6193fc9235b7bb1e7 100644 --- a/src/Workspaces/CSharp/Portable/Extensions/ExpressionSyntaxExtensions.cs +++ b/src/Workspaces/CSharp/Portable/Extensions/ExpressionSyntaxExtensions.cs @@ -821,7 +821,7 @@ private static bool TryReplaceWithAlias(this ExpressionSyntax node, SemanticMode return false; } - var symbol = semanticModel.GetSymbolInfo(node).Symbol; + var symbol = semanticModel.GetSymbolInfo(node, cancellationToken).Symbol; // If the Symbol is a contrcutor get its containing type if (symbol.IsConstructor()) @@ -869,7 +869,7 @@ private static bool TryReplaceWithAlias(this ExpressionSyntax node, SemanticMode } if (node.Kind() == SyntaxKind.IdentifierName && - semanticModel.GetAliasInfo((IdentifierNameSyntax)node) != null) + semanticModel.GetAliasInfo((IdentifierNameSyntax)node, cancellationToken) != null) { return false; } @@ -886,7 +886,7 @@ private static bool TryReplaceWithAlias(this ExpressionSyntax node, SemanticMode var qualifiedName = (QualifiedNameSyntax)node; if (!qualifiedName.Right.HasAnnotation(Simplifier.SpecialTypeAnnotation)) { - var type = semanticModel.GetTypeInfo(node).Type; + var type = semanticModel.GetTypeInfo(node, cancellationToken).Type; if (type != null) { var keywordKind = GetPredefinedKeywordKind(type.SpecialType); @@ -903,7 +903,7 @@ private static bool TryReplaceWithAlias(this ExpressionSyntax node, SemanticMode var aliasQualifiedNameSyntax = (AliasQualifiedNameSyntax)node; if (!aliasQualifiedNameSyntax.Name.HasAnnotation(Simplifier.SpecialTypeAnnotation)) { - var type = semanticModel.GetTypeInfo(node).Type; + var type = semanticModel.GetTypeInfo(node, cancellationToken).Type; if (type != null) { var keywordKind = GetPredefinedKeywordKind(type.SpecialType); @@ -1290,7 +1290,7 @@ private static int GetNamespaceId(SyntaxList members, N if (PreferPredefinedTypeKeywordInDeclarations(name, optionSet, semanticModel) || PreferPredefinedTypeKeywordInMemberAccess(name, optionSet, semanticModel)) { - var type = semanticModel.GetTypeInfo(name).Type; + var type = semanticModel.GetTypeInfo(name, cancellationToken).Type; if (type != null) { var keywordKind = GetPredefinedKeywordKind(type.SpecialType); @@ -1700,7 +1700,7 @@ private static bool HidingTypeParameterSymbolExists(ISymbol candidateSymbol, Lis if (memberAccess.Expression.Kind() == SyntaxKind.BaseExpression) { var enclosingNamedType = semanticModel.GetEnclosingNamedType(memberAccess.SpanStart, cancellationToken); - var symbol = semanticModel.GetSymbolInfo(memberAccess.Name).Symbol; + var symbol = semanticModel.GetSymbolInfo(memberAccess.Name, cancellationToken).Symbol; if (enclosingNamedType != null && !enclosingNamedType.IsSealed && symbol != null && @@ -1985,7 +1985,7 @@ private static bool IsThisOrTypeOrNamespace(MemberAccessExpressionSyntax memberA return true; } - var type = semanticModel.GetTypeInfo(simpleName).Type; + var type = semanticModel.GetTypeInfo(simpleName, cancellationToken).Type; // the variable cannot be initialized to a method group or an anonymous function if (type != null && @@ -1994,7 +1994,7 @@ private static bool IsThisOrTypeOrNamespace(MemberAccessExpressionSyntax memberA return true; } - var initializerType = semanticModel.GetTypeInfo(equalsValueClause.Value).Type; + var initializerType = semanticModel.GetTypeInfo(equalsValueClause.Value, cancellationToken).Type; if (!type.Equals(initializerType)) { @@ -2005,7 +2005,7 @@ private static bool IsThisOrTypeOrNamespace(MemberAccessExpressionSyntax memberA var possibleSameLocals = equalsValueClause.DescendantNodesAndSelf().Where(n => n.Kind() == SyntaxKind.IdentifierName && ((IdentifierNameSyntax)n).Identifier.ValueText.Equals(identifier.ValueText)); var anyUse = possibleSameLocals.Any(n => { - var symbol = semanticModel.GetSymbolInfo(n).Symbol; + var symbol = semanticModel.GetSymbolInfo(n, cancellationToken).Symbol; if (symbol != null && symbol.Kind == SymbolKind.Local) { return true; diff --git a/src/Workspaces/CSharp/Portable/Extensions/TypeDeclarationSyntaxExtensions.cs b/src/Workspaces/CSharp/Portable/Extensions/TypeDeclarationSyntaxExtensions.cs index f35a08f58026089772e0206c26257a5f8ecb712c..66effcb352b040d7b17d22f2f29b81224799089f 100644 --- a/src/Workspaces/CSharp/Portable/Extensions/TypeDeclarationSyntaxExtensions.cs +++ b/src/Workspaces/CSharp/Portable/Extensions/TypeDeclarationSyntaxExtensions.cs @@ -234,7 +234,7 @@ public static IEnumerable GetAllBaseListTypes(this TypeDeclarati var isPartialType = typeNode.Modifiers.Any(m => m.Kind() == SyntaxKind.PartialKeyword); if (isPartialType) { - var typeSymbol = model.GetDeclaredSymbol(typeNode); + var typeSymbol = model.GetDeclaredSymbol(typeNode, cancellationToken); if (typeSymbol != null) { foreach (var syntaxRef in typeSymbol.DeclaringSyntaxReferences) diff --git a/src/Workspaces/CSharp/Portable/Recommendations/CSharpRecommendationService.cs b/src/Workspaces/CSharp/Portable/Recommendations/CSharpRecommendationService.cs index f426421588c23baf113dd84998f400625dbbcf68..5dd71c67280f1ebae4e1abb326cba8a9149cf3fd 100644 --- a/src/Workspaces/CSharp/Portable/Recommendations/CSharpRecommendationService.cs +++ b/src/Workspaces/CSharp/Portable/Recommendations/CSharpRecommendationService.cs @@ -93,7 +93,7 @@ internal class CSharpRecommendationService : AbstractRecommendationService } else if (context.IsDestructorTypeContext) { - return SpecializedCollections.SingletonEnumerable(context.SemanticModel.GetDeclaredSymbol(context.ContainingTypeOrEnumDeclaration)); + return SpecializedCollections.SingletonEnumerable(context.SemanticModel.GetDeclaredSymbol(context.ContainingTypeOrEnumDeclaration, cancellationToken)); } return SpecializedCollections.EmptyEnumerable(); @@ -173,7 +173,7 @@ internal class CSharpRecommendationService : AbstractRecommendationService { var enclosingSymbol = context.LeftToken.Parent .AncestorsAndSelf() - .Select(n => context.SemanticModel.GetDeclaredSymbol(n)) + .Select(n => context.SemanticModel.GetDeclaredSymbol(n, cancellationToken)) .WhereNotNull() .FirstOrDefault(); diff --git a/src/Workspaces/Core/Desktop/Workspace/MSBuild/MSBuildWorkspace.cs b/src/Workspaces/Core/Desktop/Workspace/MSBuild/MSBuildWorkspace.cs index 6907135864be118b3647204f05abc3f0d7d16cef..fb42bea9171d8e86a581719cd41a67a6dd8d9fc1 100644 --- a/src/Workspaces/Core/Desktop/Workspace/MSBuild/MSBuildWorkspace.cs +++ b/src/Workspaces/Core/Desktop/Workspace/MSBuild/MSBuildWorkspace.cs @@ -366,7 +366,7 @@ public async Task OpenSolutionAsync(string solutionFilePath, Cancellat var absoluteSolutionPath = this.GetAbsoluteSolutionPath(solutionFilePath, Environment.CurrentDirectory); - using (this.dataGuard.DisposableWait()) + using (this.dataGuard.DisposableWait(cancellationToken)) { this.SetSolutionProperties(absoluteSolutionPath); } @@ -379,7 +379,7 @@ public async Task OpenSolutionAsync(string solutionFilePath, Cancellat var invalidProjects = new List(); // seed loaders from known project types - using (this.dataGuard.DisposableWait()) + using (this.dataGuard.DisposableWait(cancellationToken)) { foreach (var project in solutionFile.ProjectsInOrder) { diff --git a/src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/BatchFixAllProvider.cs b/src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/BatchFixAllProvider.cs index d637f515405e86cfb83936c40d76888c79b212e8..d2a69735e53912f7ef7d6b310220d116c2a0f0b7 100644 --- a/src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/BatchFixAllProvider.cs +++ b/src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/BatchFixAllProvider.cs @@ -380,7 +380,7 @@ public virtual async Task TryMergeFixesAsync(Solution oldSolution, IEn mergeTasks[i] = Task.Run(async () => { - var appliedChanges = (await documentsToMerge[0].GetTextChangesAsync(oldDocument).ConfigureAwait(false)).ToList(); + var appliedChanges = (await documentsToMerge[0].GetTextChangesAsync(oldDocument, cancellationToken).ConfigureAwait(false)).ToList(); foreach (var document in documentsToMerge.Skip(1)) { @@ -431,7 +431,7 @@ public virtual async Task TryMergeFixesAsync(Solution oldSolution, IEn var successfullyMergedChanges = new List(); int cumulativeChangeIndex = 0; - foreach (var change in await newDocument.GetTextChangesAsync(oldDocument).ConfigureAwait(false)) + foreach (var change in await newDocument.GetTextChangesAsync(oldDocument, cancellationToken).ConfigureAwait(false)) { while (cumulativeChangeIndex < cumulativeChanges.Count && cumulativeChanges[cumulativeChangeIndex].Span.End < change.Span.Start) { diff --git a/src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs b/src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs index 8ac0b275b7c1c4ca49c3a827bfc457594d954c96..f8e79aefb9d996cda57bc3aedd7b36b66086cc0f 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs @@ -24,7 +24,7 @@ internal abstract partial class AbstractCodeGenerationService public bool CanAddTo(ISymbol destination, Solution solution, CancellationToken cancellationToken) { var declarations = symbolDeclarationService.GetDeclarations(destination); - return declarations.Any(r => CanAddTo(r.GetSyntax(), solution, cancellationToken)); + return declarations.Any(r => CanAddTo(r.GetSyntax(cancellationToken), solution, cancellationToken)); } protected static SyntaxToken GetEndToken(SyntaxNode node) diff --git a/src/Workspaces/Core/Portable/Editing/SymbolEditor.cs b/src/Workspaces/Core/Portable/Editing/SymbolEditor.cs index 977a998cee598b57e9fa8c4fb7aea83a083af634..42f39e69952e0865ae0a8b12c2bfb4969df5fa8e 100644 --- a/src/Workspaces/Core/Portable/Editing/SymbolEditor.cs +++ b/src/Workspaces/Core/Portable/Editing/SymbolEditor.cs @@ -104,14 +104,14 @@ public async Task GetCurrentSymbolAsync(ISymbol symbol, CancellationTok var symbolId = DocumentationCommentId.CreateDeclarationId(symbol); // check to see if symbol is from current solution - var project = this.currentSolution.GetProject(symbol.ContainingAssembly); + var project = this.currentSolution.GetProject(symbol.ContainingAssembly, cancellationToken); if (project != null) { return await GetSymbolAsync(this.currentSolution, project.Id, symbolId, cancellationToken).ConfigureAwait(false); } // check to see if it is from original solution - project = this.originalSolution.GetProject(symbol.ContainingAssembly); + project = this.originalSolution.GetProject(symbol.ContainingAssembly, cancellationToken); if (project != null) { return await GetSymbolAsync(this.currentSolution, project.Id, symbolId, cancellationToken).ConfigureAwait(false); @@ -298,7 +298,7 @@ private void CheckSymbolArgument(ISymbol currentSymbol, ISymbol argSymbol) // try to find new symbol by looking up via original declaration var model = await newDoc.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); - var newDeclaration = model.SyntaxTree.GetRoot().GetCurrentNode(declaration); + var newDeclaration = model.SyntaxTree.GetRoot(cancellationToken).GetCurrentNode(declaration); if (newDeclaration != null) { var newSymbol = model.GetDeclaredSymbol(newDeclaration, cancellationToken); diff --git a/src/Workspaces/Core/Portable/Editing/SymbolEditorExtensions.cs b/src/Workspaces/Core/Portable/Editing/SymbolEditorExtensions.cs index de00c703fdcb2b835e49ef41c33b266edf19700c..ff8580263c7ce976298dcd1c5110e3a523f57661 100644 --- a/src/Workspaces/Core/Portable/Editing/SymbolEditorExtensions.cs +++ b/src/Workspaces/Core/Portable/Editing/SymbolEditorExtensions.cs @@ -40,7 +40,7 @@ public static class SymbolEditorExtensions var model = await doc.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); var gen = SyntaxGenerator.GetGenerator(doc); - var typeRef = gen.GetBaseAndInterfaceTypes(decl).FirstOrDefault(r => model.GetTypeInfo(r).Type.Equals(baseOrInterfaceType)); + var typeRef = gen.GetBaseAndInterfaceTypes(decl).FirstOrDefault(r => model.GetTypeInfo(r, cancellationToken).Type.Equals(baseOrInterfaceType)); if (typeRef != null) { return typeRef; diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentProjectsFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentProjectsFinder.cs index bd6cad562db203e8367e135bfe95d82190de2959..1950277f477ca934283634c99c2450e6fcd67c79 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentProjectsFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentProjectsFinder.cs @@ -140,7 +140,7 @@ private static IEnumerable GetProjects(Solution solution, IEnumerable

referencingSubmissions = null; if (!projectIdsToReferencingSubmissionIds.TryGetValue(referencedProject.Id, out referencingSubmissions)) diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder.cs index b3d71789821dc42aadb299e0dd04e945e7b177ee..08573ccd81657d4c2eb747b13d50f55e40ac3a87 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/DependentTypeFinder.cs @@ -249,7 +249,7 @@ internal static class DependentTypeFinder { cancellationToken.ThrowIfCancellationRequested(); - var resolvedSymbols = id.Resolve(compilation).GetAllSymbols(); + var resolvedSymbols = id.Resolve(compilation, cancellationToken: cancellationToken).GetAllSymbols(); foreach (var resolvedSymbol in resolvedSymbols) { var mappedSymbol = await SymbolFinder.FindSourceDefinitionAsync(resolvedSymbol, solution, cancellationToken).ConfigureAwait(false) ?? resolvedSymbol; diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractMemberScopedReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractMemberScopedReferenceFinder.cs index 56af740218056a54a5996657e29e19a05f46098b..3bb9963141e706b19721fb5ef3f55fb4552b05a6 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractMemberScopedReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractMemberScopedReferenceFinder.cs @@ -117,7 +117,7 @@ private static ISymbol GetContainer(ISymbol symbol) { var service = document.GetLanguageService(); var declarations = service.GetDeclarations(container); - var tokens = declarations.SelectMany(r => r.GetSyntax().DescendantTokens()); + var tokens = declarations.SelectMany(r => r.GetSyntax(cancellationToken).DescendantTokens()); var name = symbol.Name; var syntaxFacts = document.GetLanguageService(); diff --git a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ParameterSymbolReferenceFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ParameterSymbolReferenceFinder.cs index 78bb686bdf6e5c8f2f25fc7abc572850287ffd8c..63ac1d80ad2e8aeb1c18a96e6e234415e98cfdad 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ParameterSymbolReferenceFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/ParameterSymbolReferenceFinder.cs @@ -70,7 +70,7 @@ protected override bool CanFind(IParameterSymbol symbol) if (parameter.ContainingSymbol.IsAnonymousFunction()) { - var parameterNode = parameter.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).FirstOrDefault(); + var parameterNode = parameter.DeclaringSyntaxReferences.Select(r => r.GetSyntax(cancellationToken)).FirstOrDefault(); if (parameterNode != null) { var document = solution.GetDocument(parameterNode.SyntaxTree); @@ -81,7 +81,7 @@ protected override bool CanFind(IParameterSymbol symbol) { var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); - var lambdaNode = parameter.ContainingSymbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).FirstOrDefault(); + var lambdaNode = parameter.ContainingSymbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax(cancellationToken)).FirstOrDefault(); var convertedType = semanticModel.GetTypeInfo(lambdaNode, cancellationToken).ConvertedType; if (convertedType != null) @@ -138,7 +138,7 @@ protected override bool CanFind(IParameterSymbol symbol) SignatureComparer.Instance.HaveSameSignatureAndConstraintsAndReturnTypeAndAccessors(parameter.ContainingSymbol, symbol.ContainingSymbol, syntaxFacts.IsCaseSensitive) && ParameterNamesMatch(syntaxFacts, (IMethodSymbol)parameter.ContainingSymbol, (IMethodSymbol)symbol.ContainingSymbol)) { - var lambdaNode = symbol.ContainingSymbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).FirstOrDefault(); + var lambdaNode = symbol.ContainingSymbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax(cancellationToken)).FirstOrDefault(); var convertedType2 = semanticModel.GetTypeInfo(lambdaNode, cancellationToken).ConvertedType; if (convertedType1.Equals(convertedType2)) @@ -203,7 +203,7 @@ private SyntaxNode GetContainer(SemanticModel semanticModel, SyntaxNode paramete var namedType = containingMethod.ContainingType as INamedTypeSymbol; if (namedType != null && namedType.IsDelegateType() && namedType.AssociatedSymbol != null) { - var eventNode = namedType.AssociatedSymbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax()).FirstOrDefault(); + var eventNode = namedType.AssociatedSymbol.DeclaringSyntaxReferences.Select(r => r.GetSyntax(cancellationToken)).FirstOrDefault(); if (eventNode != null) { var document = solution.GetDocument(eventNode.SyntaxTree); diff --git a/src/Workspaces/Core/Portable/FindSymbols/SymbolFinder.cs b/src/Workspaces/Core/Portable/FindSymbols/SymbolFinder.cs index c238e5953c6940f66a9d6ca9d382654711845a1f..c5478fd1905f9a314074db05a30bc93127f45d86 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/SymbolFinder.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/SymbolFinder.cs @@ -106,7 +106,7 @@ public static partial class SymbolFinder return null; } - var project = solution.GetProject(symbol.ContainingAssembly); + var project = solution.GetProject(symbol.ContainingAssembly, cancellationToken); if (project != null) { var symbolId = symbol.GetSymbolKey(); diff --git a/src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_Declarations.cs b/src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_Declarations.cs index 8d874d79948c1a42c87b17a1b4c0b7c930723936..8870f382fa118ede7746c84610e613bf258a2314 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_Declarations.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/SymbolFinder_Declarations.cs @@ -141,7 +141,7 @@ private static async Task AddDeclarationsAsync(Project project, Compilation star // Return symbols from skeleton assembly in this case so that symbols have the same language as startingCompilation. list.AddRange( FilterByCriteria(compilation.GetSymbolsWithName(predicate, filter, cancellationToken), filter) - .Select(s => s.GetSymbolKey().Resolve(startingCompilation).Symbol).WhereNotNull()); + .Select(s => s.GetSymbolKey().Resolve(startingCompilation, cancellationToken: cancellationToken).Symbol).WhereNotNull()); } else { diff --git a/src/Workspaces/Core/Portable/LinkedFileDiffMerging/LinkedFileDiffMergingSession.cs b/src/Workspaces/Core/Portable/LinkedFileDiffMerging/LinkedFileDiffMergingSession.cs index 5868a297c6e1f59aa64df03e4a1406ba0b323056..81a5f17d653b991664f18f57d61c5a0556310345 100644 --- a/src/Workspaces/Core/Portable/LinkedFileDiffMerging/LinkedFileDiffMergingSession.cs +++ b/src/Workspaces/Core/Portable/LinkedFileDiffMerging/LinkedFileDiffMergingSession.cs @@ -102,7 +102,7 @@ internal async Task MergeDiffsAsync(IMergeConflict } var originalDocument = oldSolution.GetDocument(linkedDocumentGroup.First()); - var originalSourceText = await originalDocument.GetTextAsync().ConfigureAwait(false); + var originalSourceText = await originalDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); // Add comments in source explaining diffs that could not be merged diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/ICodeDefinitionFactoryExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/ICodeDefinitionFactoryExtensions.cs index 47ceae29fd51935918b6a18205c8603b1f4885f4..9a8d2481b82534a9ad89d17ea413c06defb6b1ec 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/ICodeDefinitionFactoryExtensions.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/ICodeDefinitionFactoryExtensions.cs @@ -247,7 +247,7 @@ private static bool TryGetValue(IDictionary dictionary, string { // Call accessors directly if C# overriding VB if (document.Project.Language == LanguageNames.CSharp - && SymbolFinder.FindSourceDefinitionAsync(overriddenProperty, document.Project.Solution) + && SymbolFinder.FindSourceDefinitionAsync(overriddenProperty, document.Project.Solution, cancellationToken) .WaitAndGetResult(CancellationToken.None).Language == LanguageNames.VisualBasic) { var getName = overriddenProperty.GetMethod != null ? overriddenProperty.GetMethod.Name : null; diff --git a/src/Workspaces/Core/Portable/SymbolId/SymbolKey.BodyLevelSymbolKey.cs b/src/Workspaces/Core/Portable/SymbolId/SymbolKey.BodyLevelSymbolKey.cs index ec7a62e74f1cbbd7993357d55f55260deea4e31c..151a9d321cf2522c21e3b905f514b256e944c5b3 100644 --- a/src/Workspaces/Core/Portable/SymbolId/SymbolKey.BodyLevelSymbolKey.cs +++ b/src/Workspaces/Core/Portable/SymbolId/SymbolKey.BodyLevelSymbolKey.cs @@ -76,7 +76,7 @@ public override SymbolKeyResolution Resolve(Compilation compilation, bool ignore foreach (var token in node.DescendantNodes()) { - var symbol = semanticModel.GetDeclaredSymbol(token) as TSymbol; + var symbol = semanticModel.GetDeclaredSymbol(token, cancellationToken) as TSymbol; if (symbol != null && Equals(compilation.IsCaseSensitive, symbol.Name, name)) { diff --git a/src/Workspaces/Core/Portable/SymbolId/SymbolKey.MethodSymbolKey.cs b/src/Workspaces/Core/Portable/SymbolId/SymbolKey.MethodSymbolKey.cs index 6dc43a3fc640f365da3ad2529190fbe5d5f79bac..7290a6283ac0bf1228da7e1944d8ac2f48e172e1 100644 --- a/src/Workspaces/Core/Portable/SymbolId/SymbolKey.MethodSymbolKey.cs +++ b/src/Workspaces/Core/Portable/SymbolId/SymbolKey.MethodSymbolKey.cs @@ -68,7 +68,7 @@ private IEnumerable Resolve(Compilation compilation, INamedTypeSy if (typeArgumentKeysOpt != null) { - typeArguments = typeArgumentKeysOpt.Select(a => a.Resolve(compilation).Symbol as ITypeSymbol).ToArray(); + typeArguments = typeArgumentKeysOpt.Select(a => a.Resolve(compilation, cancellationToken: cancellationToken).Symbol as ITypeSymbol).ToArray(); if (typeArguments.Any(a => a == null)) { diff --git a/src/Workspaces/Core/Portable/Workspace/Solution/Solution.cs b/src/Workspaces/Core/Portable/Workspace/Solution/Solution.cs index 2e6671f355d90612f2fd0c4acdca6c07b1d9c0c0..74a5d31c280c58769ba998aee2f97111c57e4e97 100644 --- a/src/Workspaces/Core/Portable/Workspace/Solution/Solution.cs +++ b/src/Workspaces/Core/Portable/Workspace/Solution/Solution.cs @@ -1876,7 +1876,7 @@ internal async Task WithFrozenPartialCompilationIncludingSpecificDocum var doc = this.GetDocument(documentId); var tree = await doc.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); - using (this.StateLock.DisposableWait()) + using (this.StateLock.DisposableWait(cancellationToken)) { // in progress solutions are disabled for some testing Workspace ws = this.Workspace as Workspace;