\n \n Dynamic View\n Динамическое представление\n IDynamicMetaObjectProvider and System.__ComObject expansion\n \n \n Only COM or Dynamic objects can have Dynamic View\n Только динамические объекты и объекты COM могут иметь динамическое представление\n Cannot use \"dynamic\" format specifier on a non-dynamic type\n \n \n Expanding the Dynamic View will get the dynamic members for the object\n При раскрытии динамического представления будут отображены динамические члены объекта\n Warning reported in Dynamic View value\n \n \n Error\n Ошибка\n Error result name\n \n \n '{0}' threw an exception of type '{1}'\n \"{0}\" выдал исключение типа \"{1}\"\n Threw an exception while evaluating a value.\n \n \n Cannot provide the value: host value not found\n Предоставить значение невозможно: значение узла не найдено.\n \n \n \n Cannot dereference '{0}'. The pointer is not valid.\n Не удается разыменовать \"{0}\". Недопустимый указатель.\n Invalid pointer dereference\n \n \n Native View\n Представление машинного кода\n Native COM object expansion\n \n \n To inspect the native object, enable native code debugging.\n Чтобы изучить объект машинного кода, включите отладку машинного кода.\n Display value of Native View node when native debugging is not enabled\n \n \n Non-Public members\n Члены, не являющиеся открытыми\n Non-public type members\n \n \n Raw View\n Базовое представление\n DebuggerTypeProxy \"Raw View\"\n \n \n Results View\n Представление результатов\n IEnumerable results expansion\n \n \n Results View requires System.Core.dll to be referenced\n Представление результатов требует наличия ссылки на System.Core.dll\n \"results\" format specifier requires System.Core.dll\n \n \n Only Enumerable types can have Results View\n Только перечислимые типы могут иметь представление результатов\n Cannot use \"results\" format specifier on non-enumerable type\n \n \n Expanding the Results View will enumerate the IEnumerable\n Раскрытие представления результатов вызовет перечисление IEnumerable\n Warning reported in Results View value\n \n \n Shared members\n Общие члены\n Shared type members (VB only)\n \n \n Static members\n Статические члены\n Static type members (C# only)\n \n \n Type variables\n Переменные типа\n Type variables result name\n \n
\n \n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":513,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56460,"string":"56,460"},"pr_title":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets"},"pr_description":{"kind":"string","value":"This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"author":{"kind":"string","value":"eerhardt"},"date_created":{"kind":"timestamp","value":"2021-09-16T21:47:36Z","string":"2021-09-16T21:47:36Z"},"date_merged":{"kind":"timestamp","value":"2021-09-22T00:53:07Z","string":"2021-09-22T00:53:07Z"},"previous_commit":{"kind":"string","value":"a10a3720229de8f4227e98736e884d6f926a9950"},"pr_commit":{"kind":"string","value":"aabc2fcbf630ba303e6f17808465349ea9b01a32"},"query":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets. This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"filepath":{"kind":"string","value":"./src/Features/VisualBasic/Portable/Completion/KeywordRecommenders/Declarations/StructureKeywordRecommender.vb"},"before_content":{"kind":"string","value":"' Licensed to the .NET Foundation under one or more agreements.\n' The .NET Foundation licenses this file to you under the MIT license.\n' See the LICENSE file in the project root for more information.\n\nImports System.Collections.Immutable\nImports System.Threading\nImports Microsoft.CodeAnalysis.Completion.Providers\nImports Microsoft.CodeAnalysis.VisualBasic.Extensions.ContextQuery\nImports Microsoft.CodeAnalysis.VisualBasic.Utilities\n\nNamespace Microsoft.CodeAnalysis.VisualBasic.Completion.KeywordRecommenders.Declarations\n ''' \n ''' Recommends the \"Structure\" keyword in type declaration contexts\n ''' \n Friend Class StructureKeywordRecommender\n Inherits AbstractKeywordRecommender\n\n Private Shared ReadOnly s_keywords As ImmutableArray(Of RecommendedKeyword) =\n ImmutableArray.Create(New RecommendedKeyword(\"Structure\", VBFeaturesResources.Declares_the_name_of_a_structure_and_introduces_the_definition_of_the_variables_properties_events_and_procedures_that_make_up_the_structure))\n\n Protected Overrides Function RecommendKeywords(context As VisualBasicSyntaxContext, cancellationToken As CancellationToken) As ImmutableArray(Of RecommendedKeyword)\n If context.IsTypeDeclarationKeywordContext Then\n Dim modifiers = context.ModifierCollectionFacts\n If modifiers.CouldApplyToOneOf(PossibleDeclarationTypes.Structure) Then\n Return s_keywords\n End If\n End If\n\n Return ImmutableArray(Of RecommendedKeyword).Empty\n End Function\n End Class\nEnd Namespace\n"},"after_content":{"kind":"string","value":"' Licensed to the .NET Foundation under one or more agreements.\n' The .NET Foundation licenses this file to you under the MIT license.\n' See the LICENSE file in the project root for more information.\n\nImports System.Collections.Immutable\nImports System.Threading\nImports Microsoft.CodeAnalysis.Completion.Providers\nImports Microsoft.CodeAnalysis.VisualBasic.Extensions.ContextQuery\nImports Microsoft.CodeAnalysis.VisualBasic.Utilities\n\nNamespace Microsoft.CodeAnalysis.VisualBasic.Completion.KeywordRecommenders.Declarations\n ''' \n ''' Recommends the \"Structure\" keyword in type declaration contexts\n ''' \n Friend Class StructureKeywordRecommender\n Inherits AbstractKeywordRecommender\n\n Private Shared ReadOnly s_keywords As ImmutableArray(Of RecommendedKeyword) =\n ImmutableArray.Create(New RecommendedKeyword(\"Structure\", VBFeaturesResources.Declares_the_name_of_a_structure_and_introduces_the_definition_of_the_variables_properties_events_and_procedures_that_make_up_the_structure))\n\n Protected Overrides Function RecommendKeywords(context As VisualBasicSyntaxContext, cancellationToken As CancellationToken) As ImmutableArray(Of RecommendedKeyword)\n If context.IsTypeDeclarationKeywordContext Then\n Dim modifiers = context.ModifierCollectionFacts\n If modifiers.CouldApplyToOneOf(PossibleDeclarationTypes.Structure) Then\n Return s_keywords\n End If\n End If\n\n Return ImmutableArray(Of RecommendedKeyword).Empty\n End Function\n End Class\nEnd Namespace\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":514,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56460,"string":"56,460"},"pr_title":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets"},"pr_description":{"kind":"string","value":"This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"author":{"kind":"string","value":"eerhardt"},"date_created":{"kind":"timestamp","value":"2021-09-16T21:47:36Z","string":"2021-09-16T21:47:36Z"},"date_merged":{"kind":"timestamp","value":"2021-09-22T00:53:07Z","string":"2021-09-22T00:53:07Z"},"previous_commit":{"kind":"string","value":"a10a3720229de8f4227e98736e884d6f926a9950"},"pr_commit":{"kind":"string","value":"aabc2fcbf630ba303e6f17808465349ea9b01a32"},"query":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets. This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"filepath":{"kind":"string","value":"./src/EditorFeatures/DiagnosticsTestUtilities/CodeActions/AbstractCodeActionTest.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Composition;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.CodeActions;\nusing Microsoft.CodeAnalysis.CodeRefactorings;\nusing Microsoft.CodeAnalysis.Editor.Implementation.Preview;\nusing Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;\nusing Microsoft.CodeAnalysis.Host.Mef;\nusing Microsoft.CodeAnalysis.PickMembers;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing Microsoft.CodeAnalysis.Shared.Utilities;\nusing Microsoft.CodeAnalysis.Text;\nusing Roslyn.Utilities;\nusing Xunit;\n\nnamespace Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions\n{\n public abstract partial class AbstractCodeActionTest : AbstractCodeActionOrUserDiagnosticTest\n {\n protected abstract CodeRefactoringProvider CreateCodeRefactoringProvider(\n Workspace workspace, TestParameters parameters);\n\n protected override async Task<(ImmutableArray, CodeAction actionToInvoke)> GetCodeActionsAsync(\n TestWorkspace workspace, TestParameters parameters)\n {\n var refactoring = await GetCodeRefactoringAsync(workspace, parameters);\n var actions = refactoring == null\n ? ImmutableArray.Empty\n : refactoring.CodeActions.Select(n => n.action).AsImmutable();\n actions = MassageActions(actions);\n return (actions, actions.IsDefaultOrEmpty ? null : actions[parameters.index]);\n }\n\n protected override Task> GetDiagnosticsWorkerAsync(TestWorkspace workspace, TestParameters parameters)\n => SpecializedTasks.EmptyImmutableArray();\n\n internal async Task GetCodeRefactoringAsync(\n TestWorkspace workspace, TestParameters parameters)\n {\n return (await GetCodeRefactoringsAsync(workspace, parameters)).FirstOrDefault();\n }\n\n private async Task> GetCodeRefactoringsAsync(\n TestWorkspace workspace, TestParameters parameters)\n {\n var provider = CreateCodeRefactoringProvider(workspace, parameters);\n return SpecializedCollections.SingletonEnumerable(\n await GetCodeRefactoringAsync(provider, workspace));\n }\n\n private static async Task GetCodeRefactoringAsync(\n CodeRefactoringProvider provider,\n TestWorkspace workspace)\n {\n var documentsWithSelections = workspace.Documents.Where(d => !d.IsLinkFile && d.SelectedSpans.Count == 1);\n Debug.Assert(documentsWithSelections.Count() == 1, \"One document must have a single span annotation\");\n var span = documentsWithSelections.Single().SelectedSpans.Single();\n var actions = ArrayBuilder<(CodeAction, TextSpan?)>.GetInstance();\n var document = workspace.CurrentSolution.GetDocument(documentsWithSelections.Single().Id);\n var context = new CodeRefactoringContext(document, span, (a, t) => actions.Add((a, t)), isBlocking: false, CancellationToken.None);\n await provider.ComputeRefactoringsAsync(context);\n\n var result = actions.Count > 0 ? new CodeRefactoring(provider, actions.ToImmutable()) : null;\n actions.Free();\n return result;\n }\n\n protected async Task TestActionOnLinkedFiles(\n TestWorkspace workspace,\n string expectedText,\n CodeAction action,\n string expectedPreviewContents = null)\n {\n var operations = await VerifyActionAndGetOperationsAsync(workspace, action, default);\n\n await VerifyPreviewContents(workspace, expectedPreviewContents, operations);\n\n var applyChangesOperation = operations.OfType().First();\n applyChangesOperation.TryApply(workspace, new ProgressTracker(), CancellationToken.None);\n\n foreach (var document in workspace.Documents)\n {\n var fixedRoot = await workspace.CurrentSolution.GetDocument(document.Id).GetSyntaxRootAsync();\n var actualText = fixedRoot.ToFullString();\n Assert.Equal(expectedText, actualText);\n }\n }\n\n private static async Task VerifyPreviewContents(\n TestWorkspace workspace, string expectedPreviewContents,\n ImmutableArray operations)\n {\n if (expectedPreviewContents != null)\n {\n var editHandler = workspace.ExportProvider.GetExportedValue();\n var previews = await editHandler.GetPreviewsAsync(workspace, operations, CancellationToken.None);\n var content = (await previews.GetPreviewsAsync())[0];\n var diffView = content as DifferenceViewerPreview;\n Assert.NotNull(diffView.Viewer);\n var previewContents = diffView.Viewer.RightView.TextBuffer.AsTextContainer().CurrentText.ToString();\n diffView.Dispose();\n\n Assert.Equal(expectedPreviewContents, previewContents);\n }\n }\n\n protected static Document GetDocument(TestWorkspace workspace)\n => workspace.CurrentSolution.GetDocument(workspace.Documents.First().Id);\n\n internal static void EnableOptions(\n ImmutableArray options,\n params string[] ids)\n {\n foreach (var id in ids)\n {\n EnableOption(options, id);\n }\n }\n\n internal static void EnableOption(ImmutableArray options, string id)\n {\n var option = options.FirstOrDefault(o => o.Id == id);\n if (option != null)\n {\n option.Value = true;\n }\n }\n\n internal Task TestWithPickMembersDialogAsync(\n string initialMarkup,\n string expectedMarkup,\n string[] chosenSymbols,\n Action> optionsCallback = null,\n int index = 0,\n TestParameters parameters = default)\n {\n var pickMembersService = new TestPickMembersService(chosenSymbols.AsImmutableOrNull(), optionsCallback);\n return TestInRegularAndScript1Async(\n initialMarkup, expectedMarkup,\n index,\n parameters.WithFixProviderData(pickMembersService));\n }\n }\n\n [ExportWorkspaceService(typeof(IPickMembersService), ServiceLayer.Host), Shared, PartNotDiscoverable]\n internal class TestPickMembersService : IPickMembersService\n {\n public ImmutableArray MemberNames;\n public Action> OptionsCallback;\n\n [ImportingConstructor]\n [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]\n public TestPickMembersService()\n {\n }\n\n#pragma warning disable RS0034 // Exported parts should be marked with 'ImportingConstructorAttribute'\n public TestPickMembersService(\n ImmutableArray memberNames,\n Action> optionsCallback)\n {\n MemberNames = memberNames;\n OptionsCallback = optionsCallback;\n }\n#pragma warning restore RS0034 // Exported parts should be marked with 'ImportingConstructorAttribute'\n\n public PickMembersResult PickMembers(\n string title,\n ImmutableArray members,\n ImmutableArray options,\n bool selectAll)\n {\n OptionsCallback?.Invoke(options);\n return new PickMembersResult(\n MemberNames.IsDefault\n ? members\n : MemberNames.SelectAsArray(n => members.Single(m => m.Name == n)),\n options,\n selectAll);\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Composition;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.CodeActions;\nusing Microsoft.CodeAnalysis.CodeRefactorings;\nusing Microsoft.CodeAnalysis.Editor.Implementation.Preview;\nusing Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;\nusing Microsoft.CodeAnalysis.Host.Mef;\nusing Microsoft.CodeAnalysis.PickMembers;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing Microsoft.CodeAnalysis.Shared.Utilities;\nusing Microsoft.CodeAnalysis.Text;\nusing Roslyn.Utilities;\nusing Xunit;\n\nnamespace Microsoft.CodeAnalysis.Editor.UnitTests.CodeActions\n{\n public abstract partial class AbstractCodeActionTest : AbstractCodeActionOrUserDiagnosticTest\n {\n protected abstract CodeRefactoringProvider CreateCodeRefactoringProvider(\n Workspace workspace, TestParameters parameters);\n\n protected override async Task<(ImmutableArray, CodeAction actionToInvoke)> GetCodeActionsAsync(\n TestWorkspace workspace, TestParameters parameters)\n {\n var refactoring = await GetCodeRefactoringAsync(workspace, parameters);\n var actions = refactoring == null\n ? ImmutableArray.Empty\n : refactoring.CodeActions.Select(n => n.action).AsImmutable();\n actions = MassageActions(actions);\n return (actions, actions.IsDefaultOrEmpty ? null : actions[parameters.index]);\n }\n\n protected override Task> GetDiagnosticsWorkerAsync(TestWorkspace workspace, TestParameters parameters)\n => SpecializedTasks.EmptyImmutableArray();\n\n internal async Task GetCodeRefactoringAsync(\n TestWorkspace workspace, TestParameters parameters)\n {\n return (await GetCodeRefactoringsAsync(workspace, parameters)).FirstOrDefault();\n }\n\n private async Task> GetCodeRefactoringsAsync(\n TestWorkspace workspace, TestParameters parameters)\n {\n var provider = CreateCodeRefactoringProvider(workspace, parameters);\n return SpecializedCollections.SingletonEnumerable(\n await GetCodeRefactoringAsync(provider, workspace));\n }\n\n private static async Task GetCodeRefactoringAsync(\n CodeRefactoringProvider provider,\n TestWorkspace workspace)\n {\n var documentsWithSelections = workspace.Documents.Where(d => !d.IsLinkFile && d.SelectedSpans.Count == 1);\n Debug.Assert(documentsWithSelections.Count() == 1, \"One document must have a single span annotation\");\n var span = documentsWithSelections.Single().SelectedSpans.Single();\n var actions = ArrayBuilder<(CodeAction, TextSpan?)>.GetInstance();\n var document = workspace.CurrentSolution.GetDocument(documentsWithSelections.Single().Id);\n var context = new CodeRefactoringContext(document, span, (a, t) => actions.Add((a, t)), isBlocking: false, CancellationToken.None);\n await provider.ComputeRefactoringsAsync(context);\n\n var result = actions.Count > 0 ? new CodeRefactoring(provider, actions.ToImmutable()) : null;\n actions.Free();\n return result;\n }\n\n protected async Task TestActionOnLinkedFiles(\n TestWorkspace workspace,\n string expectedText,\n CodeAction action,\n string expectedPreviewContents = null)\n {\n var operations = await VerifyActionAndGetOperationsAsync(workspace, action, default);\n\n await VerifyPreviewContents(workspace, expectedPreviewContents, operations);\n\n var applyChangesOperation = operations.OfType().First();\n applyChangesOperation.TryApply(workspace, new ProgressTracker(), CancellationToken.None);\n\n foreach (var document in workspace.Documents)\n {\n var fixedRoot = await workspace.CurrentSolution.GetDocument(document.Id).GetSyntaxRootAsync();\n var actualText = fixedRoot.ToFullString();\n Assert.Equal(expectedText, actualText);\n }\n }\n\n private static async Task VerifyPreviewContents(\n TestWorkspace workspace, string expectedPreviewContents,\n ImmutableArray operations)\n {\n if (expectedPreviewContents != null)\n {\n var editHandler = workspace.ExportProvider.GetExportedValue();\n var previews = await editHandler.GetPreviewsAsync(workspace, operations, CancellationToken.None);\n var content = (await previews.GetPreviewsAsync())[0];\n var diffView = content as DifferenceViewerPreview;\n Assert.NotNull(diffView.Viewer);\n var previewContents = diffView.Viewer.RightView.TextBuffer.AsTextContainer().CurrentText.ToString();\n diffView.Dispose();\n\n Assert.Equal(expectedPreviewContents, previewContents);\n }\n }\n\n protected static Document GetDocument(TestWorkspace workspace)\n => workspace.CurrentSolution.GetDocument(workspace.Documents.First().Id);\n\n internal static void EnableOptions(\n ImmutableArray options,\n params string[] ids)\n {\n foreach (var id in ids)\n {\n EnableOption(options, id);\n }\n }\n\n internal static void EnableOption(ImmutableArray options, string id)\n {\n var option = options.FirstOrDefault(o => o.Id == id);\n if (option != null)\n {\n option.Value = true;\n }\n }\n\n internal Task TestWithPickMembersDialogAsync(\n string initialMarkup,\n string expectedMarkup,\n string[] chosenSymbols,\n Action> optionsCallback = null,\n int index = 0,\n TestParameters parameters = default)\n {\n var pickMembersService = new TestPickMembersService(chosenSymbols.AsImmutableOrNull(), optionsCallback);\n return TestInRegularAndScript1Async(\n initialMarkup, expectedMarkup,\n index,\n parameters.WithFixProviderData(pickMembersService));\n }\n }\n\n [ExportWorkspaceService(typeof(IPickMembersService), ServiceLayer.Host), Shared, PartNotDiscoverable]\n internal class TestPickMembersService : IPickMembersService\n {\n public ImmutableArray MemberNames;\n public Action> OptionsCallback;\n\n [ImportingConstructor]\n [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]\n public TestPickMembersService()\n {\n }\n\n#pragma warning disable RS0034 // Exported parts should be marked with 'ImportingConstructorAttribute'\n public TestPickMembersService(\n ImmutableArray memberNames,\n Action> optionsCallback)\n {\n MemberNames = memberNames;\n OptionsCallback = optionsCallback;\n }\n#pragma warning restore RS0034 // Exported parts should be marked with 'ImportingConstructorAttribute'\n\n public PickMembersResult PickMembers(\n string title,\n ImmutableArray members,\n ImmutableArray options,\n bool selectAll)\n {\n OptionsCallback?.Invoke(options);\n return new PickMembersResult(\n MemberNames.IsDefault\n ? members\n : MemberNames.SelectAsArray(n => members.Single(m => m.Name == n)),\n options,\n selectAll);\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":515,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56460,"string":"56,460"},"pr_title":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets"},"pr_description":{"kind":"string","value":"This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"author":{"kind":"string","value":"eerhardt"},"date_created":{"kind":"timestamp","value":"2021-09-16T21:47:36Z","string":"2021-09-16T21:47:36Z"},"date_merged":{"kind":"timestamp","value":"2021-09-22T00:53:07Z","string":"2021-09-22T00:53:07Z"},"previous_commit":{"kind":"string","value":"a10a3720229de8f4227e98736e884d6f926a9950"},"pr_commit":{"kind":"string","value":"aabc2fcbf630ba303e6f17808465349ea9b01a32"},"query":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets. This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"filepath":{"kind":"string","value":"./src/EditorFeatures/CSharpTest/ExtractMethod/ExtractMethodBase.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis.CSharp;\nusing Microsoft.CodeAnalysis.CSharp.ExtractMethod;\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\nusing Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;\nusing Microsoft.CodeAnalysis.ExtractMethod;\nusing Microsoft.CodeAnalysis.Text;\nusing Microsoft.CodeAnalysis.Test.Utilities;\nusing Roslyn.Test.Utilities;\nusing Xunit;\n\nnamespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ExtractMethod\n{\n [UseExportProvider]\n public class ExtractMethodBase\n {\n protected static async Task ExpectExtractMethodToFailAsync(string codeWithMarker, bool dontPutOutOrRefOnStruct = true, string[] features = null)\n {\n ParseOptions parseOptions = null;\n if (features != null)\n {\n var featuresMapped = features.Select(x => new KeyValuePair(x, string.Empty));\n parseOptions = new CSharpParseOptions().WithFeatures(featuresMapped);\n }\n\n using var workspace = TestWorkspace.CreateCSharp(codeWithMarker, parseOptions: parseOptions);\n var testDocument = workspace.Documents.First();\n var textSpan = testDocument.SelectedSpans.Single();\n var treeAfterExtractMethod = await ExtractMethodAsync(workspace, testDocument, succeed: false, dontPutOutOrRefOnStruct: dontPutOutOrRefOnStruct);\n }\n\n protected static async Task ExpectExtractMethodToFailAsync(\n string codeWithMarker,\n string expected,\n bool dontPutOutOrRefOnStruct = true,\n CSharpParseOptions parseOptions = null)\n {\n using var workspace = TestWorkspace.CreateCSharp(codeWithMarker, parseOptions: parseOptions);\n var testDocument = workspace.Documents.Single();\n var subjectBuffer = testDocument.GetTextBuffer();\n\n var tree = await ExtractMethodAsync(workspace, testDocument, succeed: false, dontPutOutOrRefOnStruct: dontPutOutOrRefOnStruct);\n\n using (var edit = subjectBuffer.CreateEdit())\n {\n edit.Replace(0, edit.Snapshot.Length, tree.ToFullString());\n edit.Apply();\n }\n\n if (expected == \"\")\n Assert.True(false, subjectBuffer.CurrentSnapshot.GetText());\n\n Assert.Equal(expected, subjectBuffer.CurrentSnapshot.GetText());\n }\n\n protected static async Task NotSupported_ExtractMethodAsync(string codeWithMarker)\n {\n using (var workspace = TestWorkspace.CreateCSharp(codeWithMarker))\n {\n Assert.NotNull(await Record.ExceptionAsync(async () =>\n {\n var testDocument = workspace.Documents.Single();\n var tree = await ExtractMethodAsync(workspace, testDocument);\n }));\n }\n }\n\n protected static async Task TestExtractMethodAsync(\n string codeWithMarker,\n string expected,\n bool temporaryFailing = false,\n bool dontPutOutOrRefOnStruct = true,\n bool allowBestEffort = false,\n CSharpParseOptions parseOptions = null)\n {\n using var workspace = TestWorkspace.CreateCSharp(codeWithMarker, parseOptions: parseOptions);\n var testDocument = workspace.Documents.Single();\n var subjectBuffer = testDocument.GetTextBuffer();\n\n var tree = await ExtractMethodAsync(\n workspace, testDocument,\n dontPutOutOrRefOnStruct: dontPutOutOrRefOnStruct,\n allowBestEffort: allowBestEffort);\n\n using (var edit = subjectBuffer.CreateEdit())\n {\n edit.Replace(0, edit.Snapshot.Length, tree.ToFullString());\n edit.Apply();\n }\n\n var actual = subjectBuffer.CurrentSnapshot.GetText();\n if (temporaryFailing)\n {\n Assert.NotEqual(expected, actual);\n }\n else\n {\n if (expected != \"\")\n {\n AssertEx.EqualOrDiff(expected, actual);\n }\n else\n {\n // print out the entire diff to make adding tests simpler.\n Assert.Equal((object)expected, actual);\n }\n }\n }\n\n protected static async Task ExtractMethodAsync(\n TestWorkspace workspace,\n TestHostDocument testDocument,\n bool succeed = true,\n bool dontPutOutOrRefOnStruct = true,\n bool allowBestEffort = false)\n {\n var document = workspace.CurrentSolution.GetDocument(testDocument.Id);\n Assert.NotNull(document);\n\n var originalOptions = await document.GetOptionsAsync();\n var options = originalOptions.WithChangedOption(ExtractMethodOptions.DontPutOutOrRefOnStruct, document.Project.Language, dontPutOutOrRefOnStruct);\n\n var semanticDocument = await SemanticDocument.CreateAsync(document, CancellationToken.None);\n var validator = new CSharpSelectionValidator(semanticDocument, testDocument.SelectedSpans.Single(), options);\n\n var selectedCode = await validator.GetValidSelectionAsync(CancellationToken.None);\n if (!succeed && selectedCode.Status.FailedWithNoBestEffortSuggestion())\n {\n return null;\n }\n\n Assert.True(selectedCode.ContainsValidContext);\n\n // extract method\n var extractor = new CSharpMethodExtractor((CSharpSelectionResult)selectedCode, localFunction: false);\n var result = await extractor.ExtractMethodAsync(CancellationToken.None);\n Assert.NotNull(result);\n Assert.Equal(succeed,\n result.Succeeded ||\n result.SucceededWithSuggestion ||\n (allowBestEffort && result.Status.HasBestEffort()));\n\n var doc = result.Document;\n return doc == null\n ? null\n : await doc.GetSyntaxRootAsync();\n }\n\n protected static async Task TestSelectionAsync(string codeWithMarker, bool expectedFail = false, CSharpParseOptions parseOptions = null, TextSpan? textSpanOverride = null)\n {\n using var workspace = TestWorkspace.CreateCSharp(codeWithMarker, parseOptions: parseOptions);\n var testDocument = workspace.Documents.Single();\n var namedSpans = testDocument.AnnotatedSpans;\n\n var document = workspace.CurrentSolution.GetDocument(testDocument.Id);\n Assert.NotNull(document);\n\n var options = await document.GetOptionsAsync(CancellationToken.None);\n\n var semanticDocument = await SemanticDocument.CreateAsync(document, CancellationToken.None);\n var validator = new CSharpSelectionValidator(semanticDocument, textSpanOverride ?? namedSpans[\"b\"].Single(), options);\n var result = await validator.GetValidSelectionAsync(CancellationToken.None);\n\n Assert.True(expectedFail ? result.Status.Failed() : result.Status.Succeeded());\n\n if ((result.Status.Succeeded() || result.Status.Flag.HasBestEffort()) && result.Status.Flag.HasSuggestion())\n {\n Assert.Equal(namedSpans[\"r\"].Single(), result.FinalSpan);\n }\n }\n\n protected static async Task IterateAllAsync(string code)\n {\n using var workspace = TestWorkspace.CreateCSharp(code, CodeAnalysis.CSharp.Test.Utilities.TestOptions.Regular);\n var document = workspace.CurrentSolution.GetDocument(workspace.Documents.First().Id);\n Assert.NotNull(document);\n\n var semanticDocument = await SemanticDocument.CreateAsync(document, CancellationToken.None);\n var root = await document.GetSyntaxRootAsync();\n var iterator = root.DescendantNodesAndSelf().Cast();\n\n var originalOptions = await document.GetOptionsAsync();\n\n foreach (var node in iterator)\n {\n var validator = new CSharpSelectionValidator(semanticDocument, node.Span, originalOptions);\n var result = await validator.GetValidSelectionAsync(CancellationToken.None);\n\n // check the obvious case\n if (!(node is ExpressionSyntax) && !node.UnderValidContext())\n {\n Assert.True(result.Status.FailedWithNoBestEffortSuggestion());\n }\n }\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#nullable disable\n\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis.CSharp;\nusing Microsoft.CodeAnalysis.CSharp.ExtractMethod;\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\nusing Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces;\nusing Microsoft.CodeAnalysis.ExtractMethod;\nusing Microsoft.CodeAnalysis.Text;\nusing Microsoft.CodeAnalysis.Test.Utilities;\nusing Roslyn.Test.Utilities;\nusing Xunit;\n\nnamespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.ExtractMethod\n{\n [UseExportProvider]\n public class ExtractMethodBase\n {\n protected static async Task ExpectExtractMethodToFailAsync(string codeWithMarker, bool dontPutOutOrRefOnStruct = true, string[] features = null)\n {\n ParseOptions parseOptions = null;\n if (features != null)\n {\n var featuresMapped = features.Select(x => new KeyValuePair(x, string.Empty));\n parseOptions = new CSharpParseOptions().WithFeatures(featuresMapped);\n }\n\n using var workspace = TestWorkspace.CreateCSharp(codeWithMarker, parseOptions: parseOptions);\n var testDocument = workspace.Documents.First();\n var textSpan = testDocument.SelectedSpans.Single();\n var treeAfterExtractMethod = await ExtractMethodAsync(workspace, testDocument, succeed: false, dontPutOutOrRefOnStruct: dontPutOutOrRefOnStruct);\n }\n\n protected static async Task ExpectExtractMethodToFailAsync(\n string codeWithMarker,\n string expected,\n bool dontPutOutOrRefOnStruct = true,\n CSharpParseOptions parseOptions = null)\n {\n using var workspace = TestWorkspace.CreateCSharp(codeWithMarker, parseOptions: parseOptions);\n var testDocument = workspace.Documents.Single();\n var subjectBuffer = testDocument.GetTextBuffer();\n\n var tree = await ExtractMethodAsync(workspace, testDocument, succeed: false, dontPutOutOrRefOnStruct: dontPutOutOrRefOnStruct);\n\n using (var edit = subjectBuffer.CreateEdit())\n {\n edit.Replace(0, edit.Snapshot.Length, tree.ToFullString());\n edit.Apply();\n }\n\n if (expected == \"\")\n Assert.True(false, subjectBuffer.CurrentSnapshot.GetText());\n\n Assert.Equal(expected, subjectBuffer.CurrentSnapshot.GetText());\n }\n\n protected static async Task NotSupported_ExtractMethodAsync(string codeWithMarker)\n {\n using (var workspace = TestWorkspace.CreateCSharp(codeWithMarker))\n {\n Assert.NotNull(await Record.ExceptionAsync(async () =>\n {\n var testDocument = workspace.Documents.Single();\n var tree = await ExtractMethodAsync(workspace, testDocument);\n }));\n }\n }\n\n protected static async Task TestExtractMethodAsync(\n string codeWithMarker,\n string expected,\n bool temporaryFailing = false,\n bool dontPutOutOrRefOnStruct = true,\n bool allowBestEffort = false,\n CSharpParseOptions parseOptions = null)\n {\n using var workspace = TestWorkspace.CreateCSharp(codeWithMarker, parseOptions: parseOptions);\n var testDocument = workspace.Documents.Single();\n var subjectBuffer = testDocument.GetTextBuffer();\n\n var tree = await ExtractMethodAsync(\n workspace, testDocument,\n dontPutOutOrRefOnStruct: dontPutOutOrRefOnStruct,\n allowBestEffort: allowBestEffort);\n\n using (var edit = subjectBuffer.CreateEdit())\n {\n edit.Replace(0, edit.Snapshot.Length, tree.ToFullString());\n edit.Apply();\n }\n\n var actual = subjectBuffer.CurrentSnapshot.GetText();\n if (temporaryFailing)\n {\n Assert.NotEqual(expected, actual);\n }\n else\n {\n if (expected != \"\")\n {\n AssertEx.EqualOrDiff(expected, actual);\n }\n else\n {\n // print out the entire diff to make adding tests simpler.\n Assert.Equal((object)expected, actual);\n }\n }\n }\n\n protected static async Task ExtractMethodAsync(\n TestWorkspace workspace,\n TestHostDocument testDocument,\n bool succeed = true,\n bool dontPutOutOrRefOnStruct = true,\n bool allowBestEffort = false)\n {\n var document = workspace.CurrentSolution.GetDocument(testDocument.Id);\n Assert.NotNull(document);\n\n var originalOptions = await document.GetOptionsAsync();\n var options = originalOptions.WithChangedOption(ExtractMethodOptions.DontPutOutOrRefOnStruct, document.Project.Language, dontPutOutOrRefOnStruct);\n\n var semanticDocument = await SemanticDocument.CreateAsync(document, CancellationToken.None);\n var validator = new CSharpSelectionValidator(semanticDocument, testDocument.SelectedSpans.Single(), options);\n\n var selectedCode = await validator.GetValidSelectionAsync(CancellationToken.None);\n if (!succeed && selectedCode.Status.FailedWithNoBestEffortSuggestion())\n {\n return null;\n }\n\n Assert.True(selectedCode.ContainsValidContext);\n\n // extract method\n var extractor = new CSharpMethodExtractor((CSharpSelectionResult)selectedCode, localFunction: false);\n var result = await extractor.ExtractMethodAsync(CancellationToken.None);\n Assert.NotNull(result);\n Assert.Equal(succeed,\n result.Succeeded ||\n result.SucceededWithSuggestion ||\n (allowBestEffort && result.Status.HasBestEffort()));\n\n var doc = result.Document;\n return doc == null\n ? null\n : await doc.GetSyntaxRootAsync();\n }\n\n protected static async Task TestSelectionAsync(string codeWithMarker, bool expectedFail = false, CSharpParseOptions parseOptions = null, TextSpan? textSpanOverride = null)\n {\n using var workspace = TestWorkspace.CreateCSharp(codeWithMarker, parseOptions: parseOptions);\n var testDocument = workspace.Documents.Single();\n var namedSpans = testDocument.AnnotatedSpans;\n\n var document = workspace.CurrentSolution.GetDocument(testDocument.Id);\n Assert.NotNull(document);\n\n var options = await document.GetOptionsAsync(CancellationToken.None);\n\n var semanticDocument = await SemanticDocument.CreateAsync(document, CancellationToken.None);\n var validator = new CSharpSelectionValidator(semanticDocument, textSpanOverride ?? namedSpans[\"b\"].Single(), options);\n var result = await validator.GetValidSelectionAsync(CancellationToken.None);\n\n Assert.True(expectedFail ? result.Status.Failed() : result.Status.Succeeded());\n\n if ((result.Status.Succeeded() || result.Status.Flag.HasBestEffort()) && result.Status.Flag.HasSuggestion())\n {\n Assert.Equal(namedSpans[\"r\"].Single(), result.FinalSpan);\n }\n }\n\n protected static async Task IterateAllAsync(string code)\n {\n using var workspace = TestWorkspace.CreateCSharp(code, CodeAnalysis.CSharp.Test.Utilities.TestOptions.Regular);\n var document = workspace.CurrentSolution.GetDocument(workspace.Documents.First().Id);\n Assert.NotNull(document);\n\n var semanticDocument = await SemanticDocument.CreateAsync(document, CancellationToken.None);\n var root = await document.GetSyntaxRootAsync();\n var iterator = root.DescendantNodesAndSelf().Cast();\n\n var originalOptions = await document.GetOptionsAsync();\n\n foreach (var node in iterator)\n {\n var validator = new CSharpSelectionValidator(semanticDocument, node.Span, originalOptions);\n var result = await validator.GetValidSelectionAsync(CancellationToken.None);\n\n // check the obvious case\n if (!(node is ExpressionSyntax) && !node.UnderValidContext())\n {\n Assert.True(result.Status.FailedWithNoBestEffortSuggestion());\n }\n }\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":516,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56460,"string":"56,460"},"pr_title":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets"},"pr_description":{"kind":"string","value":"This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"author":{"kind":"string","value":"eerhardt"},"date_created":{"kind":"timestamp","value":"2021-09-16T21:47:36Z","string":"2021-09-16T21:47:36Z"},"date_merged":{"kind":"timestamp","value":"2021-09-22T00:53:07Z","string":"2021-09-22T00:53:07Z"},"previous_commit":{"kind":"string","value":"a10a3720229de8f4227e98736e884d6f926a9950"},"pr_commit":{"kind":"string","value":"aabc2fcbf630ba303e6f17808465349ea9b01a32"},"query":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets. This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"filepath":{"kind":"string","value":"./src/Analyzers/CSharp/Analyzers/UsePatternMatching/CSharpAsAndNullCheckDiagnosticAnalyzer.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System.Collections.Immutable;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing Microsoft.CodeAnalysis.CodeStyle;\nusing Microsoft.CodeAnalysis.CSharp.CodeStyle;\nusing Microsoft.CodeAnalysis.CSharp.Extensions;\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\nusing Microsoft.CodeAnalysis.Diagnostics;\nusing Microsoft.CodeAnalysis.Shared.Extensions;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.CSharp.UsePatternMatching\n{\n /// \n /// Looks for code of the forms:\n /// \n /// var x = o as Type;\n /// if (x != null) ...\n /// \n /// and converts it to:\n /// \n /// if (o is Type x) ...\n /// \n /// \n [DiagnosticAnalyzer(LanguageNames.CSharp)]\n internal partial class CSharpAsAndNullCheckDiagnosticAnalyzer : AbstractBuiltInCodeStyleDiagnosticAnalyzer\n {\n public CSharpAsAndNullCheckDiagnosticAnalyzer()\n : base(IDEDiagnosticIds.InlineAsTypeCheckId,\n EnforceOnBuildValues.InlineAsType,\n CSharpCodeStyleOptions.PreferPatternMatchingOverAsWithNullCheck,\n LanguageNames.CSharp,\n new LocalizableResourceString(\n nameof(CSharpAnalyzersResources.Use_pattern_matching), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources)))\n {\n }\n\n protected override void InitializeWorker(AnalysisContext context)\n => context.RegisterSyntaxNodeAction(SyntaxNodeAction,\n SyntaxKind.EqualsExpression,\n SyntaxKind.NotEqualsExpression,\n SyntaxKind.IsExpression,\n SyntaxKind.IsPatternExpression);\n\n private void SyntaxNodeAction(SyntaxNodeAnalysisContext syntaxContext)\n {\n var node = syntaxContext.Node;\n var syntaxTree = node.SyntaxTree;\n\n // \"x is Type y\" is only available in C# 7.0 and above. Don't offer this refactoring\n // in projects targeting a lesser version.\n if (((CSharpParseOptions)syntaxTree.Options).LanguageVersion < LanguageVersion.CSharp7)\n {\n return;\n }\n\n var options = syntaxContext.Options;\n var cancellationToken = syntaxContext.CancellationToken;\n\n var styleOption = options.GetOption(CSharpCodeStyleOptions.PreferPatternMatchingOverAsWithNullCheck, syntaxTree, cancellationToken);\n if (!styleOption.Value)\n {\n // Bail immediately if the user has disabled this feature.\n return;\n }\n\n var comparison = (ExpressionSyntax)node;\n var (comparisonLeft, comparisonRight) = comparison switch\n {\n BinaryExpressionSyntax binaryExpression => (binaryExpression.Left, (SyntaxNode)binaryExpression.Right),\n IsPatternExpressionSyntax isPattern => (isPattern.Expression, isPattern.Pattern),\n _ => throw ExceptionUtilities.Unreachable,\n };\n var operand = GetNullCheckOperand(comparisonLeft, comparison.Kind(), comparisonRight)?.WalkDownParentheses();\n if (operand == null)\n {\n return;\n }\n\n var semanticModel = syntaxContext.SemanticModel;\n if (operand.IsKind(SyntaxKind.CastExpression, out CastExpressionSyntax? castExpression))\n {\n // Unwrap object cast\n var castType = semanticModel.GetTypeInfo(castExpression.Type).Type;\n if (castType?.SpecialType == SpecialType.System_Object)\n {\n operand = castExpression.Expression;\n }\n }\n\n if (semanticModel.GetSymbolInfo(comparison, cancellationToken).GetAnySymbol().IsUserDefinedOperator())\n {\n return;\n }\n\n if (!TryGetTypeCheckParts(semanticModel, operand,\n out var declarator,\n out var asExpression,\n out var localSymbol))\n {\n return;\n }\n\n var localStatement = declarator.Parent?.Parent;\n var enclosingBlock = localStatement?.Parent;\n if (localStatement == null ||\n enclosingBlock == null)\n {\n return;\n }\n\n // Don't convert if the as is part of a using statement\n // eg using (var x = y as MyObject) { }\n if (localStatement is UsingStatementSyntax)\n {\n return;\n }\n\n // Don't convert if the as is part of a local declaration with a using keyword\n // eg using var x = y as MyObject;\n if (localStatement is LocalDeclarationStatementSyntax localDecl && localDecl.UsingKeyword != default)\n {\n return;\n }\n\n var typeNode = asExpression.Right;\n var asType = semanticModel.GetTypeInfo(typeNode, cancellationToken).Type;\n if (asType.IsNullable())\n {\n // Not legal to write \"x is int? y\"\n return;\n }\n\n if (asType?.TypeKind == TypeKind.Dynamic)\n {\n // Not legal to use dynamic in a pattern.\n return;\n }\n\n if (!localSymbol.Type.Equals(asType))\n {\n // We have something like:\n //\n // BaseType b = x as DerivedType;\n // if (b != null) { ... }\n //\n // It's not necessarily safe to convert this to:\n //\n // if (x is DerivedType b) { ... }\n //\n // That's because there may be later code that wants to do something like assign a\n // 'BaseType' into 'b'. As we've now claimed that it must be DerivedType, that\n // won't work. This might also cause unintended changes like changing overload\n // resolution. So, we conservatively do not offer the change in a situation like this.\n return;\n }\n\n // Check if the as operand is ever written up to the point of null check.\n //\n // var s = field as string;\n // field = null;\n // if (s != null) { ... }\n //\n // It's no longer safe to use pattern-matching because 'field is string s' would never be true.\n // \n // Additionally, also bail out if the assigned local is referenced (i.e. read/write/nameof) up to the point of null check.\n // var s = field as string;\n // MethodCall(flag: s == null);\n // if (s != null) { ... }\n //\n var asOperand = semanticModel.GetSymbolInfo(asExpression.Left, cancellationToken).Symbol;\n var localStatementStart = localStatement.SpanStart;\n var comparisonSpanStart = comparison.SpanStart;\n\n foreach (var descendentNode in enclosingBlock.DescendantNodes())\n {\n var descendentNodeSpanStart = descendentNode.SpanStart;\n if (descendentNodeSpanStart <= localStatementStart)\n {\n continue;\n }\n\n if (descendentNodeSpanStart >= comparisonSpanStart)\n {\n break;\n }\n\n if (descendentNode.IsKind(SyntaxKind.IdentifierName, out IdentifierNameSyntax? identifierName))\n {\n // Check if this is a 'write' to the asOperand.\n if (identifierName.Identifier.ValueText == asOperand?.Name &&\n asOperand.Equals(semanticModel.GetSymbolInfo(identifierName, cancellationToken).Symbol) &&\n identifierName.IsWrittenTo(semanticModel, cancellationToken))\n {\n return;\n }\n\n // Check is a reference of any sort (i.e. read/write/nameof) to the local.\n if (identifierName.Identifier.ValueText == localSymbol.Name)\n {\n return;\n }\n }\n }\n\n if (!Analyzer.CanSafelyConvertToPatternMatching(\n semanticModel, localSymbol, comparison, operand,\n localStatement, enclosingBlock, cancellationToken))\n {\n return;\n }\n\n // Looks good!\n var additionalLocations = ImmutableArray.Create(\n declarator.GetLocation(),\n comparison.GetLocation(),\n asExpression.GetLocation());\n\n // Put a diagnostic with the appropriate severity on the declaration-statement itself.\n syntaxContext.ReportDiagnostic(DiagnosticHelper.Create(\n Descriptor,\n localStatement.GetLocation(),\n styleOption.Notification.Severity,\n additionalLocations,\n properties: null));\n }\n\n private static bool TryGetTypeCheckParts(\n SemanticModel semanticModel,\n SyntaxNode operand,\n [NotNullWhen(true)] out VariableDeclaratorSyntax? declarator,\n [NotNullWhen(true)] out BinaryExpressionSyntax? asExpression,\n [NotNullWhen(true)] out ILocalSymbol? localSymbol)\n {\n switch (operand.Kind())\n {\n case SyntaxKind.IdentifierName:\n {\n // var x = e as T;\n // if (x != null) F(x);\n var identifier = (IdentifierNameSyntax)operand;\n if (!TryFindVariableDeclarator(semanticModel, identifier, out localSymbol, out declarator))\n {\n break;\n }\n\n var initializerValue = declarator.Initializer?.Value;\n if (!initializerValue.IsKind(SyntaxKind.AsExpression, out asExpression))\n {\n break;\n }\n\n return true;\n }\n\n case SyntaxKind.SimpleAssignmentExpression:\n {\n // T x;\n // if ((x = e as T) != null) F(x);\n var assignment = (AssignmentExpressionSyntax)operand;\n if (!assignment.Right.IsKind(SyntaxKind.AsExpression, out asExpression) ||\n !assignment.Left.IsKind(SyntaxKind.IdentifierName, out IdentifierNameSyntax? identifier))\n {\n break;\n }\n\n if (!TryFindVariableDeclarator(semanticModel, identifier, out localSymbol, out declarator))\n {\n break;\n }\n\n return true;\n }\n }\n\n declarator = null;\n asExpression = null;\n localSymbol = null;\n return false;\n }\n\n private static bool TryFindVariableDeclarator(\n SemanticModel semanticModel,\n IdentifierNameSyntax identifier,\n [NotNullWhen(true)] out ILocalSymbol? localSymbol,\n [NotNullWhen(true)] out VariableDeclaratorSyntax? declarator)\n {\n localSymbol = semanticModel.GetSymbolInfo(identifier).Symbol as ILocalSymbol;\n declarator = localSymbol?.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() as VariableDeclaratorSyntax;\n return localSymbol != null && declarator != null;\n }\n\n private static ExpressionSyntax? GetNullCheckOperand(ExpressionSyntax left, SyntaxKind comparisonKind, SyntaxNode right)\n {\n if (left.IsKind(SyntaxKind.NullLiteralExpression))\n {\n // null == x\n // null != x\n return (ExpressionSyntax)right;\n }\n\n if (right.IsKind(SyntaxKind.NullLiteralExpression))\n {\n // x == null\n // x != null\n return left;\n }\n\n if (right.IsKind(SyntaxKind.PredefinedType, out PredefinedTypeSyntax? predefinedType)\n && predefinedType.Keyword.IsKind(SyntaxKind.ObjectKeyword)\n && comparisonKind == SyntaxKind.IsExpression)\n {\n // x is object\n return left;\n }\n\n if (right.IsKind(SyntaxKind.ConstantPattern, out ConstantPatternSyntax? constantPattern)\n && constantPattern.Expression.IsKind(SyntaxKind.NullLiteralExpression)\n && comparisonKind == SyntaxKind.IsPatternExpression)\n {\n // x is null\n return left;\n }\n\n return null;\n }\n\n public override DiagnosticAnalyzerCategory GetAnalyzerCategory()\n => DiagnosticAnalyzerCategory.SemanticSpanAnalysis;\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System.Collections.Immutable;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Linq;\nusing Microsoft.CodeAnalysis.CodeStyle;\nusing Microsoft.CodeAnalysis.CSharp.CodeStyle;\nusing Microsoft.CodeAnalysis.CSharp.Extensions;\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\nusing Microsoft.CodeAnalysis.Diagnostics;\nusing Microsoft.CodeAnalysis.Shared.Extensions;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.CSharp.UsePatternMatching\n{\n /// \n /// Looks for code of the forms:\n /// \n /// var x = o as Type;\n /// if (x != null) ...\n /// \n /// and converts it to:\n /// \n /// if (o is Type x) ...\n /// \n /// \n [DiagnosticAnalyzer(LanguageNames.CSharp)]\n internal partial class CSharpAsAndNullCheckDiagnosticAnalyzer : AbstractBuiltInCodeStyleDiagnosticAnalyzer\n {\n public CSharpAsAndNullCheckDiagnosticAnalyzer()\n : base(IDEDiagnosticIds.InlineAsTypeCheckId,\n EnforceOnBuildValues.InlineAsType,\n CSharpCodeStyleOptions.PreferPatternMatchingOverAsWithNullCheck,\n LanguageNames.CSharp,\n new LocalizableResourceString(\n nameof(CSharpAnalyzersResources.Use_pattern_matching), CSharpAnalyzersResources.ResourceManager, typeof(CSharpAnalyzersResources)))\n {\n }\n\n protected override void InitializeWorker(AnalysisContext context)\n => context.RegisterSyntaxNodeAction(SyntaxNodeAction,\n SyntaxKind.EqualsExpression,\n SyntaxKind.NotEqualsExpression,\n SyntaxKind.IsExpression,\n SyntaxKind.IsPatternExpression);\n\n private void SyntaxNodeAction(SyntaxNodeAnalysisContext syntaxContext)\n {\n var node = syntaxContext.Node;\n var syntaxTree = node.SyntaxTree;\n\n // \"x is Type y\" is only available in C# 7.0 and above. Don't offer this refactoring\n // in projects targeting a lesser version.\n if (((CSharpParseOptions)syntaxTree.Options).LanguageVersion < LanguageVersion.CSharp7)\n {\n return;\n }\n\n var options = syntaxContext.Options;\n var cancellationToken = syntaxContext.CancellationToken;\n\n var styleOption = options.GetOption(CSharpCodeStyleOptions.PreferPatternMatchingOverAsWithNullCheck, syntaxTree, cancellationToken);\n if (!styleOption.Value)\n {\n // Bail immediately if the user has disabled this feature.\n return;\n }\n\n var comparison = (ExpressionSyntax)node;\n var (comparisonLeft, comparisonRight) = comparison switch\n {\n BinaryExpressionSyntax binaryExpression => (binaryExpression.Left, (SyntaxNode)binaryExpression.Right),\n IsPatternExpressionSyntax isPattern => (isPattern.Expression, isPattern.Pattern),\n _ => throw ExceptionUtilities.Unreachable,\n };\n var operand = GetNullCheckOperand(comparisonLeft, comparison.Kind(), comparisonRight)?.WalkDownParentheses();\n if (operand == null)\n {\n return;\n }\n\n var semanticModel = syntaxContext.SemanticModel;\n if (operand.IsKind(SyntaxKind.CastExpression, out CastExpressionSyntax? castExpression))\n {\n // Unwrap object cast\n var castType = semanticModel.GetTypeInfo(castExpression.Type).Type;\n if (castType?.SpecialType == SpecialType.System_Object)\n {\n operand = castExpression.Expression;\n }\n }\n\n if (semanticModel.GetSymbolInfo(comparison, cancellationToken).GetAnySymbol().IsUserDefinedOperator())\n {\n return;\n }\n\n if (!TryGetTypeCheckParts(semanticModel, operand,\n out var declarator,\n out var asExpression,\n out var localSymbol))\n {\n return;\n }\n\n var localStatement = declarator.Parent?.Parent;\n var enclosingBlock = localStatement?.Parent;\n if (localStatement == null ||\n enclosingBlock == null)\n {\n return;\n }\n\n // Don't convert if the as is part of a using statement\n // eg using (var x = y as MyObject) { }\n if (localStatement is UsingStatementSyntax)\n {\n return;\n }\n\n // Don't convert if the as is part of a local declaration with a using keyword\n // eg using var x = y as MyObject;\n if (localStatement is LocalDeclarationStatementSyntax localDecl && localDecl.UsingKeyword != default)\n {\n return;\n }\n\n var typeNode = asExpression.Right;\n var asType = semanticModel.GetTypeInfo(typeNode, cancellationToken).Type;\n if (asType.IsNullable())\n {\n // Not legal to write \"x is int? y\"\n return;\n }\n\n if (asType?.TypeKind == TypeKind.Dynamic)\n {\n // Not legal to use dynamic in a pattern.\n return;\n }\n\n if (!localSymbol.Type.Equals(asType))\n {\n // We have something like:\n //\n // BaseType b = x as DerivedType;\n // if (b != null) { ... }\n //\n // It's not necessarily safe to convert this to:\n //\n // if (x is DerivedType b) { ... }\n //\n // That's because there may be later code that wants to do something like assign a\n // 'BaseType' into 'b'. As we've now claimed that it must be DerivedType, that\n // won't work. This might also cause unintended changes like changing overload\n // resolution. So, we conservatively do not offer the change in a situation like this.\n return;\n }\n\n // Check if the as operand is ever written up to the point of null check.\n //\n // var s = field as string;\n // field = null;\n // if (s != null) { ... }\n //\n // It's no longer safe to use pattern-matching because 'field is string s' would never be true.\n // \n // Additionally, also bail out if the assigned local is referenced (i.e. read/write/nameof) up to the point of null check.\n // var s = field as string;\n // MethodCall(flag: s == null);\n // if (s != null) { ... }\n //\n var asOperand = semanticModel.GetSymbolInfo(asExpression.Left, cancellationToken).Symbol;\n var localStatementStart = localStatement.SpanStart;\n var comparisonSpanStart = comparison.SpanStart;\n\n foreach (var descendentNode in enclosingBlock.DescendantNodes())\n {\n var descendentNodeSpanStart = descendentNode.SpanStart;\n if (descendentNodeSpanStart <= localStatementStart)\n {\n continue;\n }\n\n if (descendentNodeSpanStart >= comparisonSpanStart)\n {\n break;\n }\n\n if (descendentNode.IsKind(SyntaxKind.IdentifierName, out IdentifierNameSyntax? identifierName))\n {\n // Check if this is a 'write' to the asOperand.\n if (identifierName.Identifier.ValueText == asOperand?.Name &&\n asOperand.Equals(semanticModel.GetSymbolInfo(identifierName, cancellationToken).Symbol) &&\n identifierName.IsWrittenTo(semanticModel, cancellationToken))\n {\n return;\n }\n\n // Check is a reference of any sort (i.e. read/write/nameof) to the local.\n if (identifierName.Identifier.ValueText == localSymbol.Name)\n {\n return;\n }\n }\n }\n\n if (!Analyzer.CanSafelyConvertToPatternMatching(\n semanticModel, localSymbol, comparison, operand,\n localStatement, enclosingBlock, cancellationToken))\n {\n return;\n }\n\n // Looks good!\n var additionalLocations = ImmutableArray.Create(\n declarator.GetLocation(),\n comparison.GetLocation(),\n asExpression.GetLocation());\n\n // Put a diagnostic with the appropriate severity on the declaration-statement itself.\n syntaxContext.ReportDiagnostic(DiagnosticHelper.Create(\n Descriptor,\n localStatement.GetLocation(),\n styleOption.Notification.Severity,\n additionalLocations,\n properties: null));\n }\n\n private static bool TryGetTypeCheckParts(\n SemanticModel semanticModel,\n SyntaxNode operand,\n [NotNullWhen(true)] out VariableDeclaratorSyntax? declarator,\n [NotNullWhen(true)] out BinaryExpressionSyntax? asExpression,\n [NotNullWhen(true)] out ILocalSymbol? localSymbol)\n {\n switch (operand.Kind())\n {\n case SyntaxKind.IdentifierName:\n {\n // var x = e as T;\n // if (x != null) F(x);\n var identifier = (IdentifierNameSyntax)operand;\n if (!TryFindVariableDeclarator(semanticModel, identifier, out localSymbol, out declarator))\n {\n break;\n }\n\n var initializerValue = declarator.Initializer?.Value;\n if (!initializerValue.IsKind(SyntaxKind.AsExpression, out asExpression))\n {\n break;\n }\n\n return true;\n }\n\n case SyntaxKind.SimpleAssignmentExpression:\n {\n // T x;\n // if ((x = e as T) != null) F(x);\n var assignment = (AssignmentExpressionSyntax)operand;\n if (!assignment.Right.IsKind(SyntaxKind.AsExpression, out asExpression) ||\n !assignment.Left.IsKind(SyntaxKind.IdentifierName, out IdentifierNameSyntax? identifier))\n {\n break;\n }\n\n if (!TryFindVariableDeclarator(semanticModel, identifier, out localSymbol, out declarator))\n {\n break;\n }\n\n return true;\n }\n }\n\n declarator = null;\n asExpression = null;\n localSymbol = null;\n return false;\n }\n\n private static bool TryFindVariableDeclarator(\n SemanticModel semanticModel,\n IdentifierNameSyntax identifier,\n [NotNullWhen(true)] out ILocalSymbol? localSymbol,\n [NotNullWhen(true)] out VariableDeclaratorSyntax? declarator)\n {\n localSymbol = semanticModel.GetSymbolInfo(identifier).Symbol as ILocalSymbol;\n declarator = localSymbol?.DeclaringSyntaxReferences.FirstOrDefault()?.GetSyntax() as VariableDeclaratorSyntax;\n return localSymbol != null && declarator != null;\n }\n\n private static ExpressionSyntax? GetNullCheckOperand(ExpressionSyntax left, SyntaxKind comparisonKind, SyntaxNode right)\n {\n if (left.IsKind(SyntaxKind.NullLiteralExpression))\n {\n // null == x\n // null != x\n return (ExpressionSyntax)right;\n }\n\n if (right.IsKind(SyntaxKind.NullLiteralExpression))\n {\n // x == null\n // x != null\n return left;\n }\n\n if (right.IsKind(SyntaxKind.PredefinedType, out PredefinedTypeSyntax? predefinedType)\n && predefinedType.Keyword.IsKind(SyntaxKind.ObjectKeyword)\n && comparisonKind == SyntaxKind.IsExpression)\n {\n // x is object\n return left;\n }\n\n if (right.IsKind(SyntaxKind.ConstantPattern, out ConstantPatternSyntax? constantPattern)\n && constantPattern.Expression.IsKind(SyntaxKind.NullLiteralExpression)\n && comparisonKind == SyntaxKind.IsPatternExpression)\n {\n // x is null\n return left;\n }\n\n return null;\n }\n\n public override DiagnosticAnalyzerCategory GetAnalyzerCategory()\n => DiagnosticAnalyzerCategory.SemanticSpanAnalysis;\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":517,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56460,"string":"56,460"},"pr_title":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets"},"pr_description":{"kind":"string","value":"This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"author":{"kind":"string","value":"eerhardt"},"date_created":{"kind":"timestamp","value":"2021-09-16T21:47:36Z","string":"2021-09-16T21:47:36Z"},"date_merged":{"kind":"timestamp","value":"2021-09-22T00:53:07Z","string":"2021-09-22T00:53:07Z"},"previous_commit":{"kind":"string","value":"a10a3720229de8f4227e98736e884d6f926a9950"},"pr_commit":{"kind":"string","value":"aabc2fcbf630ba303e6f17808465349ea9b01a32"},"query":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets. This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"filepath":{"kind":"string","value":"./src/Workspaces/CSharp/Portable/xlf/CSharpWorkspaceResources.zh-Hans.xlf"},"before_content":{"kind":"string","value":"\n\n \n
\n \n Indentation preferences\n 缩进首选项\n \n \n \n No available location found to add statements to.\n 没有找到添加语句的可用位置。\n \n \n \n Namespace can not be added in this destination.\n 不能在此目标中添加命名空间。\n \n \n \n Node does not descend from root.\n 节点并非源自根。\n \n \n \n Node not in parent's child list\n 节点不在父级的子列表中\n \n \n \n R&emove and Sort Usings\n 删除 Using 和对其排序(&E)\n \n \n \n &Sort Usings\n 对 using 排序(&S)\n \n \n \n Space preferences\n 空格键首选项\n \n \n \n Trivia is not associated with token\n 琐事与标记不相关联\n \n \n \n Cannot retrieve the Span of a null syntax reference.\n 无法检索一个空语法引用的范围。\n \n \n \n Only attributes, constructor initializers, expressions or statements can be made explicit\n 仅属性、构造函数初始值设定项、表达式或语句可为显式\n \n \n \n Implement Interface\n 实现接口\n \n \n \n Wrapping preferences\n 包装首选项\n \n \n
\n \n Indentation preferences\n 缩进首选项\n \n \n \n No available location found to add statements to.\n 没有找到添加语句的可用位置。\n \n \n \n Namespace can not be added in this destination.\n 不能在此目标中添加命名空间。\n \n \n \n Node does not descend from root.\n 节点并非源自根。\n \n \n \n Node not in parent's child list\n 节点不在父级的子列表中\n \n \n \n R&emove and Sort Usings\n 删除 Using 和对其排序(&E)\n \n \n \n &Sort Usings\n 对 using 排序(&S)\n \n \n \n Space preferences\n 空格键首选项\n \n \n \n Trivia is not associated with token\n 琐事与标记不相关联\n \n \n \n Cannot retrieve the Span of a null syntax reference.\n 无法检索一个空语法引用的范围。\n \n \n \n Only attributes, constructor initializers, expressions or statements can be made explicit\n 仅属性、构造函数初始值设定项、表达式或语句可为显式\n \n \n \n Implement Interface\n 实现接口\n \n \n \n Wrapping preferences\n 包装首选项\n \n \n
\n \n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":518,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56460,"string":"56,460"},"pr_title":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets"},"pr_description":{"kind":"string","value":"This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"author":{"kind":"string","value":"eerhardt"},"date_created":{"kind":"timestamp","value":"2021-09-16T21:47:36Z","string":"2021-09-16T21:47:36Z"},"date_merged":{"kind":"timestamp","value":"2021-09-22T00:53:07Z","string":"2021-09-22T00:53:07Z"},"previous_commit":{"kind":"string","value":"a10a3720229de8f4227e98736e884d6f926a9950"},"pr_commit":{"kind":"string","value":"aabc2fcbf630ba303e6f17808465349ea9b01a32"},"query":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets. This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"filepath":{"kind":"string","value":"./src/Features/Core/Portable/EditAndContinue/EditAndContinueDocumentAnalysesCache.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis.ErrorReporting;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing Microsoft.CodeAnalysis.Shared.Extensions;\nusing Microsoft.CodeAnalysis.Text;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.EditAndContinue\n{\n /// \n /// Calculates and caches results of changed documents analysis. \n /// The work is triggered by an incremental analyzer on idle or explicitly when \"continue\" operation is executed.\n /// Contains analyses of the latest observed document versions.\n /// \n internal sealed class EditAndContinueDocumentAnalysesCache\n {\n private readonly object _guard = new();\n private readonly Dictionary results, Project baseProject, Document document, ImmutableArray activeStatementSpans)> _analyses = new();\n private readonly AsyncLazy _baseActiveStatements;\n private readonly AsyncLazy _capabilities;\n\n public EditAndContinueDocumentAnalysesCache(AsyncLazy baseActiveStatements, AsyncLazy capabilities)\n {\n _baseActiveStatements = baseActiveStatements;\n _capabilities = capabilities;\n }\n\n public async ValueTask> GetDocumentAnalysesAsync(\n CommittedSolution oldSolution,\n IReadOnlyList<(Document? oldDocument, Document newDocument)> documents,\n ActiveStatementSpanProvider activeStatementSpanProvider,\n CancellationToken cancellationToken)\n {\n try\n {\n if (documents.IsEmpty())\n {\n return ImmutableArray.Empty;\n }\n\n var tasks = documents.Select(document => Task.Run(() => GetDocumentAnalysisAsync(oldSolution, document.oldDocument, document.newDocument, activeStatementSpanProvider, cancellationToken).AsTask(), cancellationToken));\n var allResults = await Task.WhenAll(tasks).ConfigureAwait(false);\n\n return allResults.ToImmutableArray();\n }\n catch (Exception e) when (FatalError.ReportAndPropagateUnlessCanceled(e, cancellationToken))\n {\n throw ExceptionUtilities.Unreachable;\n }\n }\n\n /// \n /// Returns a document analysis or kicks off a new one if one is not available for the specified document snapshot.\n /// \n /// Committed solution.\n /// Document snapshot to analyze.\n /// Provider of active statement spans tracked by the editor for the solution snapshot of the .\n public async ValueTask GetDocumentAnalysisAsync(\n CommittedSolution oldSolution,\n Document? oldDocument,\n Document newDocument,\n ActiveStatementSpanProvider activeStatementSpanProvider,\n CancellationToken cancellationToken)\n {\n try\n {\n var unmappedActiveStatementSpans = await GetLatestUnmappedActiveStatementSpansAsync(oldDocument, newDocument, activeStatementSpanProvider, cancellationToken).ConfigureAwait(false);\n\n // The base project may have been updated as documents were brought up-to-date in the committed solution.\n // Get the latest available snapshot of the base project from the committed solution and use it for analyses of all documents,\n // so that we use a single compilation for the base project (for efficiency).\n // Note that some other request might be updating documents in the committed solution that were not changed (not in changedOrAddedDocuments)\n // but are not up-to-date. These documents do not have impact on the analysis unless we read semantic information\n // from the project compilation. When reading such information we need to be aware of its potential incompleteness\n // and consult the compiler output binary (see https://github.com/dotnet/roslyn/issues/51261).\n var oldProject = oldDocument?.Project ?? oldSolution.GetRequiredProject(newDocument.Project.Id);\n\n AsyncLazy lazyResults;\n\n lock (_guard)\n {\n lazyResults = GetDocumentAnalysisNoLock(oldProject, newDocument, unmappedActiveStatementSpans);\n }\n\n return await lazyResults.GetValueAsync(cancellationToken).ConfigureAwait(false);\n }\n catch (Exception e) when (FatalError.ReportAndPropagateUnlessCanceled(e, cancellationToken))\n {\n throw ExceptionUtilities.Unreachable;\n }\n }\n\n /// \n /// Calculates unmapped active statement spans in the from spans provided by .\n /// \n private async Task> GetLatestUnmappedActiveStatementSpansAsync(Document? oldDocument, Document newDocument, ActiveStatementSpanProvider newActiveStatementSpanProvider, CancellationToken cancellationToken)\n {\n if (oldDocument == null)\n {\n // document has been deleted or is out-of-sync\n return ImmutableArray.Empty;\n }\n\n if (newDocument.FilePath == null)\n {\n // document has been added, or doesn't have a file path - we do not have tracking spans for it\n return ImmutableArray.Empty;\n }\n\n var newTree = await newDocument.GetRequiredSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);\n var newLineMappings = newTree.GetLineMappings(cancellationToken);\n\n // No #line directives -- retrieve the current location of tracking spans directly for this document:\n if (!newLineMappings.Any())\n {\n var newMappedDocumentSpans = await newActiveStatementSpanProvider(newDocument.Id, newDocument.FilePath, cancellationToken).ConfigureAwait(false);\n return newMappedDocumentSpans.SelectAsArray(s => s.LineSpan);\n }\n\n // The document has #line directives. In order to determine all active statement spans in the document\n // we need to find all documents that #line directives in this document map to.\n // We retrieve the tracking spans for all such documents and then map them back to this document.\n\n using var _1 = PooledDictionary>.GetInstance(out var mappedSpansByDocumentPath);\n using var _2 = ArrayBuilder.GetInstance(out var activeStatementSpansBuilder);\n\n var baseActiveStatements = await _baseActiveStatements.GetValueAsync(cancellationToken).ConfigureAwait(false);\n var analyzer = newDocument.Project.LanguageServices.GetRequiredService();\n var oldActiveStatements = await baseActiveStatements.GetOldActiveStatementsAsync(analyzer, oldDocument, cancellationToken).ConfigureAwait(false);\n\n foreach (var oldActiveStatement in oldActiveStatements)\n {\n var mappedFilePath = oldActiveStatement.Statement.FileSpan.Path;\n if (!mappedSpansByDocumentPath.TryGetValue(mappedFilePath, out var newMappedDocumentSpans))\n {\n newMappedDocumentSpans = await newActiveStatementSpanProvider((newDocument.FilePath == mappedFilePath) ? newDocument.Id : null, mappedFilePath, cancellationToken).ConfigureAwait(false);\n mappedSpansByDocumentPath.Add(mappedFilePath, newMappedDocumentSpans);\n }\n\n // Spans not tracked in the document (e.g. the document has been closed):\n if (newMappedDocumentSpans.IsEmpty)\n {\n continue;\n }\n\n // all baseline spans are being tracked in their corresponding mapped documents (if a span is deleted it's still tracked as empty):\n var newMappedDocumentActiveSpan = newMappedDocumentSpans.GetStatement(oldActiveStatement.Statement.Ordinal);\n Debug.Assert(newMappedDocumentActiveSpan.UnmappedDocumentId == null || newMappedDocumentActiveSpan.UnmappedDocumentId == newDocument.Id);\n\n // TODO: optimize\n var newLineMappingContainingActiveSpan = newLineMappings.FirstOrDefault(mapping => mapping.MappedSpan.Span.Contains(newMappedDocumentActiveSpan.LineSpan));\n\n var unmappedSpan = newLineMappingContainingActiveSpan.MappedSpan.IsValid ? newLineMappingContainingActiveSpan.Span : default;\n activeStatementSpansBuilder.Add(unmappedSpan);\n }\n\n return activeStatementSpansBuilder.ToImmutable();\n }\n\n private AsyncLazy GetDocumentAnalysisNoLock(Project baseProject, Document document, ImmutableArray activeStatementSpans)\n {\n // Do not reuse an analysis of the document unless its snasphot is exactly the same as was used to calculate the results.\n // Note that comparing document snapshots in effect compares the entire solution snapshots (when another document is changed a new solution snapshot is created\n // that creates new document snapshots for all queried documents).\n // Also check the base project snapshot since the analysis uses semantic information from the base project as well.\n // \n // It would be possible to reuse analysis results of documents whose content does not change in between two solution snapshots.\n // However, we'd need rather sophisticated caching logic. The smantic analysis gathers information from other documents when\n // calculating results for a specific document. In some cases it's easy to record the set of documents the analysis depends on.\n // For example, when analyzing a partial class we can record all documents its declaration spans. However, in other cases the analysis\n // checks for absence of a top-level type symbol. Adding a symbol to any document thus invalidates such analysis. It'd be possible\n // to keep track of which type symbols an analysis is conditional upon, if it was worth the extra complexity.\n if (_analyses.TryGetValue(document.Id, out var analysis) &&\n analysis.baseProject == baseProject &&\n analysis.document == document &&\n analysis.activeStatementSpans.SequenceEqual(activeStatementSpans))\n {\n return analysis.results;\n }\n\n var lazyResults = new AsyncLazy(\n asynchronousComputeFunction: async cancellationToken =>\n {\n try\n {\n var analyzer = document.Project.LanguageServices.GetRequiredService();\n return await analyzer.AnalyzeDocumentAsync(baseProject, _baseActiveStatements, document, activeStatementSpans, _capabilities, cancellationToken).ConfigureAwait(false);\n }\n catch (Exception e) when (FatalError.ReportAndPropagateUnlessCanceled(e, cancellationToken))\n {\n throw ExceptionUtilities.Unreachable;\n }\n },\n cacheResult: true);\n\n // Previous results for this document id are discarded as they are no longer relevant.\n // The only relevant analysis is for the latest base and document snapshots.\n // Note that the base snapshot may evolve if documents are dicovered that were previously\n // out-of-sync with the compiled outputs and are now up-to-date.\n _analyses[document.Id] = (lazyResults, baseProject, document, activeStatementSpans);\n\n return lazyResults;\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis.ErrorReporting;\nusing Microsoft.CodeAnalysis.PooledObjects;\nusing Microsoft.CodeAnalysis.Shared.Extensions;\nusing Microsoft.CodeAnalysis.Text;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.EditAndContinue\n{\n /// \n /// Calculates and caches results of changed documents analysis. \n /// The work is triggered by an incremental analyzer on idle or explicitly when \"continue\" operation is executed.\n /// Contains analyses of the latest observed document versions.\n /// \n internal sealed class EditAndContinueDocumentAnalysesCache\n {\n private readonly object _guard = new();\n private readonly Dictionary results, Project baseProject, Document document, ImmutableArray activeStatementSpans)> _analyses = new();\n private readonly AsyncLazy _baseActiveStatements;\n private readonly AsyncLazy _capabilities;\n\n public EditAndContinueDocumentAnalysesCache(AsyncLazy baseActiveStatements, AsyncLazy capabilities)\n {\n _baseActiveStatements = baseActiveStatements;\n _capabilities = capabilities;\n }\n\n public async ValueTask> GetDocumentAnalysesAsync(\n CommittedSolution oldSolution,\n IReadOnlyList<(Document? oldDocument, Document newDocument)> documents,\n ActiveStatementSpanProvider activeStatementSpanProvider,\n CancellationToken cancellationToken)\n {\n try\n {\n if (documents.IsEmpty())\n {\n return ImmutableArray.Empty;\n }\n\n var tasks = documents.Select(document => Task.Run(() => GetDocumentAnalysisAsync(oldSolution, document.oldDocument, document.newDocument, activeStatementSpanProvider, cancellationToken).AsTask(), cancellationToken));\n var allResults = await Task.WhenAll(tasks).ConfigureAwait(false);\n\n return allResults.ToImmutableArray();\n }\n catch (Exception e) when (FatalError.ReportAndPropagateUnlessCanceled(e, cancellationToken))\n {\n throw ExceptionUtilities.Unreachable;\n }\n }\n\n /// \n /// Returns a document analysis or kicks off a new one if one is not available for the specified document snapshot.\n /// \n /// Committed solution.\n /// Document snapshot to analyze.\n /// Provider of active statement spans tracked by the editor for the solution snapshot of the .\n public async ValueTask GetDocumentAnalysisAsync(\n CommittedSolution oldSolution,\n Document? oldDocument,\n Document newDocument,\n ActiveStatementSpanProvider activeStatementSpanProvider,\n CancellationToken cancellationToken)\n {\n try\n {\n var unmappedActiveStatementSpans = await GetLatestUnmappedActiveStatementSpansAsync(oldDocument, newDocument, activeStatementSpanProvider, cancellationToken).ConfigureAwait(false);\n\n // The base project may have been updated as documents were brought up-to-date in the committed solution.\n // Get the latest available snapshot of the base project from the committed solution and use it for analyses of all documents,\n // so that we use a single compilation for the base project (for efficiency).\n // Note that some other request might be updating documents in the committed solution that were not changed (not in changedOrAddedDocuments)\n // but are not up-to-date. These documents do not have impact on the analysis unless we read semantic information\n // from the project compilation. When reading such information we need to be aware of its potential incompleteness\n // and consult the compiler output binary (see https://github.com/dotnet/roslyn/issues/51261).\n var oldProject = oldDocument?.Project ?? oldSolution.GetRequiredProject(newDocument.Project.Id);\n\n AsyncLazy lazyResults;\n\n lock (_guard)\n {\n lazyResults = GetDocumentAnalysisNoLock(oldProject, newDocument, unmappedActiveStatementSpans);\n }\n\n return await lazyResults.GetValueAsync(cancellationToken).ConfigureAwait(false);\n }\n catch (Exception e) when (FatalError.ReportAndPropagateUnlessCanceled(e, cancellationToken))\n {\n throw ExceptionUtilities.Unreachable;\n }\n }\n\n /// \n /// Calculates unmapped active statement spans in the from spans provided by .\n /// \n private async Task> GetLatestUnmappedActiveStatementSpansAsync(Document? oldDocument, Document newDocument, ActiveStatementSpanProvider newActiveStatementSpanProvider, CancellationToken cancellationToken)\n {\n if (oldDocument == null)\n {\n // document has been deleted or is out-of-sync\n return ImmutableArray.Empty;\n }\n\n if (newDocument.FilePath == null)\n {\n // document has been added, or doesn't have a file path - we do not have tracking spans for it\n return ImmutableArray.Empty;\n }\n\n var newTree = await newDocument.GetRequiredSyntaxTreeAsync(cancellationToken).ConfigureAwait(false);\n var newLineMappings = newTree.GetLineMappings(cancellationToken);\n\n // No #line directives -- retrieve the current location of tracking spans directly for this document:\n if (!newLineMappings.Any())\n {\n var newMappedDocumentSpans = await newActiveStatementSpanProvider(newDocument.Id, newDocument.FilePath, cancellationToken).ConfigureAwait(false);\n return newMappedDocumentSpans.SelectAsArray(s => s.LineSpan);\n }\n\n // The document has #line directives. In order to determine all active statement spans in the document\n // we need to find all documents that #line directives in this document map to.\n // We retrieve the tracking spans for all such documents and then map them back to this document.\n\n using var _1 = PooledDictionary>.GetInstance(out var mappedSpansByDocumentPath);\n using var _2 = ArrayBuilder.GetInstance(out var activeStatementSpansBuilder);\n\n var baseActiveStatements = await _baseActiveStatements.GetValueAsync(cancellationToken).ConfigureAwait(false);\n var analyzer = newDocument.Project.LanguageServices.GetRequiredService();\n var oldActiveStatements = await baseActiveStatements.GetOldActiveStatementsAsync(analyzer, oldDocument, cancellationToken).ConfigureAwait(false);\n\n foreach (var oldActiveStatement in oldActiveStatements)\n {\n var mappedFilePath = oldActiveStatement.Statement.FileSpan.Path;\n if (!mappedSpansByDocumentPath.TryGetValue(mappedFilePath, out var newMappedDocumentSpans))\n {\n newMappedDocumentSpans = await newActiveStatementSpanProvider((newDocument.FilePath == mappedFilePath) ? newDocument.Id : null, mappedFilePath, cancellationToken).ConfigureAwait(false);\n mappedSpansByDocumentPath.Add(mappedFilePath, newMappedDocumentSpans);\n }\n\n // Spans not tracked in the document (e.g. the document has been closed):\n if (newMappedDocumentSpans.IsEmpty)\n {\n continue;\n }\n\n // all baseline spans are being tracked in their corresponding mapped documents (if a span is deleted it's still tracked as empty):\n var newMappedDocumentActiveSpan = newMappedDocumentSpans.GetStatement(oldActiveStatement.Statement.Ordinal);\n Debug.Assert(newMappedDocumentActiveSpan.UnmappedDocumentId == null || newMappedDocumentActiveSpan.UnmappedDocumentId == newDocument.Id);\n\n // TODO: optimize\n var newLineMappingContainingActiveSpan = newLineMappings.FirstOrDefault(mapping => mapping.MappedSpan.Span.Contains(newMappedDocumentActiveSpan.LineSpan));\n\n var unmappedSpan = newLineMappingContainingActiveSpan.MappedSpan.IsValid ? newLineMappingContainingActiveSpan.Span : default;\n activeStatementSpansBuilder.Add(unmappedSpan);\n }\n\n return activeStatementSpansBuilder.ToImmutable();\n }\n\n private AsyncLazy GetDocumentAnalysisNoLock(Project baseProject, Document document, ImmutableArray activeStatementSpans)\n {\n // Do not reuse an analysis of the document unless its snasphot is exactly the same as was used to calculate the results.\n // Note that comparing document snapshots in effect compares the entire solution snapshots (when another document is changed a new solution snapshot is created\n // that creates new document snapshots for all queried documents).\n // Also check the base project snapshot since the analysis uses semantic information from the base project as well.\n // \n // It would be possible to reuse analysis results of documents whose content does not change in between two solution snapshots.\n // However, we'd need rather sophisticated caching logic. The smantic analysis gathers information from other documents when\n // calculating results for a specific document. In some cases it's easy to record the set of documents the analysis depends on.\n // For example, when analyzing a partial class we can record all documents its declaration spans. However, in other cases the analysis\n // checks for absence of a top-level type symbol. Adding a symbol to any document thus invalidates such analysis. It'd be possible\n // to keep track of which type symbols an analysis is conditional upon, if it was worth the extra complexity.\n if (_analyses.TryGetValue(document.Id, out var analysis) &&\n analysis.baseProject == baseProject &&\n analysis.document == document &&\n analysis.activeStatementSpans.SequenceEqual(activeStatementSpans))\n {\n return analysis.results;\n }\n\n var lazyResults = new AsyncLazy(\n asynchronousComputeFunction: async cancellationToken =>\n {\n try\n {\n var analyzer = document.Project.LanguageServices.GetRequiredService();\n return await analyzer.AnalyzeDocumentAsync(baseProject, _baseActiveStatements, document, activeStatementSpans, _capabilities, cancellationToken).ConfigureAwait(false);\n }\n catch (Exception e) when (FatalError.ReportAndPropagateUnlessCanceled(e, cancellationToken))\n {\n throw ExceptionUtilities.Unreachable;\n }\n },\n cacheResult: true);\n\n // Previous results for this document id are discarded as they are no longer relevant.\n // The only relevant analysis is for the latest base and document snapshots.\n // Note that the base snapshot may evolve if documents are dicovered that were previously\n // out-of-sync with the compiled outputs and are now up-to-date.\n _analyses[document.Id] = (lazyResults, baseProject, document, activeStatementSpans);\n\n return lazyResults;\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":519,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56460,"string":"56,460"},"pr_title":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets"},"pr_description":{"kind":"string","value":"This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"author":{"kind":"string","value":"eerhardt"},"date_created":{"kind":"timestamp","value":"2021-09-16T21:47:36Z","string":"2021-09-16T21:47:36Z"},"date_merged":{"kind":"timestamp","value":"2021-09-22T00:53:07Z","string":"2021-09-22T00:53:07Z"},"previous_commit":{"kind":"string","value":"a10a3720229de8f4227e98736e884d6f926a9950"},"pr_commit":{"kind":"string","value":"aabc2fcbf630ba303e6f17808465349ea9b01a32"},"query":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets. This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"filepath":{"kind":"string","value":"./src/Analyzers/CSharp/Analyzers/PopulateSwitch/CSharpPopulateSwitchExpressionDiagnosticAnalyzer.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\nusing Microsoft.CodeAnalysis.Diagnostics;\nusing Microsoft.CodeAnalysis.PopulateSwitch;\n\nnamespace Microsoft.CodeAnalysis.CSharp.PopulateSwitch\n{\n [DiagnosticAnalyzer(LanguageNames.CSharp)]\n internal sealed class CSharpPopulateSwitchExpressionDiagnosticAnalyzer :\n AbstractPopulateSwitchExpressionDiagnosticAnalyzer\n {\n protected override Location GetDiagnosticLocation(SwitchExpressionSyntax switchBlock)\n => switchBlock.SwitchKeyword.GetLocation();\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\nusing Microsoft.CodeAnalysis.Diagnostics;\nusing Microsoft.CodeAnalysis.PopulateSwitch;\n\nnamespace Microsoft.CodeAnalysis.CSharp.PopulateSwitch\n{\n [DiagnosticAnalyzer(LanguageNames.CSharp)]\n internal sealed class CSharpPopulateSwitchExpressionDiagnosticAnalyzer :\n AbstractPopulateSwitchExpressionDiagnosticAnalyzer\n {\n protected override Location GetDiagnosticLocation(SwitchExpressionSyntax switchBlock)\n => switchBlock.SwitchKeyword.GetLocation();\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":520,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56460,"string":"56,460"},"pr_title":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets"},"pr_description":{"kind":"string","value":"This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"author":{"kind":"string","value":"eerhardt"},"date_created":{"kind":"timestamp","value":"2021-09-16T21:47:36Z","string":"2021-09-16T21:47:36Z"},"date_merged":{"kind":"timestamp","value":"2021-09-22T00:53:07Z","string":"2021-09-22T00:53:07Z"},"previous_commit":{"kind":"string","value":"a10a3720229de8f4227e98736e884d6f926a9950"},"pr_commit":{"kind":"string","value":"aabc2fcbf630ba303e6f17808465349ea9b01a32"},"query":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets. This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"filepath":{"kind":"string","value":"./src/Features/VisualBasic/Portable/IntroduceVariable/VisualBasicIntroduceVariableService.vb"},"before_content":{"kind":"string","value":"' Licensed to the .NET Foundation under one or more agreements.\n' The .NET Foundation licenses this file to you under the MIT license.\n' See the LICENSE file in the project root for more information.\n\nImports System.Threading\nImports Microsoft.CodeAnalysis\nImports Microsoft.CodeAnalysis.IntroduceVariable\nImports Microsoft.CodeAnalysis.Host.Mef\nImports Microsoft.CodeAnalysis.Text\nImports Microsoft.CodeAnalysis.VisualBasic.Syntax\nImports System.Composition\n\nNamespace Microsoft.CodeAnalysis.VisualBasic.IntroduceVariable\n \n Partial Friend Class VisualBasicIntroduceVariableService\n Inherits AbstractIntroduceVariableService(Of VisualBasicIntroduceVariableService, ExpressionSyntax, TypeSyntax, TypeBlockSyntax, QueryExpressionSyntax, NameSyntax)\n\n \n \n Public Sub New()\n End Sub\n\n Protected Overrides Function GetContainingExecutableBlocks(expression As ExpressionSyntax) As IEnumerable(Of SyntaxNode)\n Return expression.GetContainingExecutableBlocks()\n End Function\n\n Protected Overrides Function GetInsertionIndices(destination As TypeBlockSyntax, cancellationToken As CancellationToken) As IList(Of Boolean)\n Return destination.GetInsertionIndices(cancellationToken)\n End Function\n\n Protected Overrides Function IsInAttributeArgumentInitializer(expression As ExpressionSyntax) As Boolean\n If expression.GetAncestorOrThis(Of ArgumentSyntax)() Is Nothing Then\n Return False\n End If\n\n If expression.GetAncestorOrThis(Of AttributeSyntax)() Is Nothing Then\n Return False\n End If\n\n If expression.DepthFirstTraversal.Any(Function(n) n.Kind() = SyntaxKind.ArrayCreationExpression) OrElse\n expression.DepthFirstTraversal.Any(Function(n) n.Kind() = SyntaxKind.GetTypeExpression) Then\n Return False\n End If\n\n Dim attributeBlock = expression.GetAncestorOrThis(Of AttributeListSyntax)()\n If attributeBlock.IsParentKind(SyntaxKind.CompilationUnit) Then\n Return False\n End If\n\n Return True\n End Function\n\n Protected Overrides Function IsInConstructorInitializer(expression As ExpressionSyntax) As Boolean\n Dim constructorInitializer = expression.GetAncestorsOrThis(Of StatementSyntax)().\n Where(Function(n) n.IsConstructorInitializer()).\n FirstOrDefault()\n\n If constructorInitializer Is Nothing Then\n Return False\n End If\n\n ' have to make sure we're not inside a lambda inside the constructor initializer.\n If expression.GetAncestorOrThis(Of LambdaExpressionSyntax)() IsNot Nothing Then\n Return False\n End If\n\n Return True\n End Function\n\n Protected Overrides Function CanIntroduceVariableFor(expression As ExpressionSyntax) As Boolean\n expression = expression.WalkUpParentheses()\n\n If TypeOf expression.Parent Is CallStatementSyntax Then\n Return False\n End If\n\n If Not expression.GetImplicitMemberAccessExpressions.All(Function(e) e.IsParentKind(SyntaxKind.WithStatement)) Then\n Return False\n End If\n\n If expression.IsParentKind(SyntaxKind.EqualsValue) AndAlso\n expression.Parent.IsParentKind(SyntaxKind.VariableDeclarator) Then\n Return False\n End If\n\n ' For Nothing Literals, AllOccurrences could introduce semantic errors.\n If expression.IsKind(SyntaxKind.NothingLiteralExpression) Then\n Return False\n End If\n\n Return True\n End Function\n\n Protected Overrides Function IsInFieldInitializer(expression As ExpressionSyntax) As Boolean\n If expression.GetAncestorOrThis(Of VariableDeclaratorSyntax)().GetAncestorOrThis(Of FieldDeclarationSyntax)() IsNot Nothing Then\n Return True\n End If\n\n Return False\n End Function\n\n Protected Overrides Function IsInNonFirstQueryClause(expression As ExpressionSyntax) As Boolean\n Dim query = expression.GetAncestor(Of QueryExpressionSyntax)()\n If query Is Nothing Then\n Return False\n End If\n\n ' Can't introduce for the first clause in a query.\n Dim fromClause = expression.GetAncestor(Of FromClauseSyntax)()\n If fromClause IsNot Nothing AndAlso query.Clauses.First() Is fromClause Then\n Return False\n End If\n\n Return True\n End Function\n\n Protected Overrides Function IsInParameterInitializer(expression As ExpressionSyntax) As Boolean\n Return expression.GetAncestorOrThis(Of EqualsValueSyntax)().IsParentKind(SyntaxKind.Parameter)\n End Function\n\n Protected Overrides Function IsInAutoPropertyInitializer(expression As ExpressionSyntax) As Boolean\n Dim propertyStatement = expression.GetAncestorOrThis(Of PropertyStatementSyntax)()\n Dim equalsValueStatement = expression.GetAncestorOrThis(Of EqualsValueSyntax)\n\n If propertyStatement IsNot Nothing Then\n Return expression.GetAncestorsOrThis(Of AsClauseSyntax).Contains(propertyStatement.AsClause) OrElse\n (equalsValueStatement IsNot Nothing AndAlso equalsValueStatement.Contains(propertyStatement.Initializer))\n End If\n\n Return False\n End Function\n\n Protected Overrides Function IsInExpressionBodiedMember(expression As ExpressionSyntax) As Boolean\n Return False\n End Function\n\n Protected Overrides Function CanReplace(expression As ExpressionSyntax) As Boolean\n If expression.CheckParent(Of RangeArgumentSyntax)(Function(n) n.LowerBound Is expression) Then\n Return False\n End If\n\n Return True\n End Function\n\n Protected Overrides Function IsExpressionInStaticLocalFunction(expression As ExpressionSyntax) As Boolean\n ' Local functions don't apply to VB.\n Return False\n End Function\n\n Protected Overrides Function RewriteCore(Of TNode As SyntaxNode)(node As TNode, replacementNode As SyntaxNode, matches As ISet(Of ExpressionSyntax)) As TNode\n Return DirectCast(Rewriter.Visit(node, replacementNode, matches), TNode)\n End Function\n\n Protected Overrides Function BlockOverlapsHiddenPosition(block As SyntaxNode, cancellationToken As CancellationToken) As Boolean\n Dim statements = block.GetStatements()\n\n If statements.Count = 0 Then\n Return block.OverlapsHiddenPosition(cancellationToken)\n End If\n\n Dim first = statements.First()\n Dim last = statements.Last()\n\n Return block.OverlapsHiddenPosition(TextSpan.FromBounds(first.SpanStart, last.SpanStart), cancellationToken)\n End Function\n\n End Class\nEnd Namespace\n"},"after_content":{"kind":"string","value":"' Licensed to the .NET Foundation under one or more agreements.\n' The .NET Foundation licenses this file to you under the MIT license.\n' See the LICENSE file in the project root for more information.\n\nImports System.Threading\nImports Microsoft.CodeAnalysis\nImports Microsoft.CodeAnalysis.IntroduceVariable\nImports Microsoft.CodeAnalysis.Host.Mef\nImports Microsoft.CodeAnalysis.Text\nImports Microsoft.CodeAnalysis.VisualBasic.Syntax\nImports System.Composition\n\nNamespace Microsoft.CodeAnalysis.VisualBasic.IntroduceVariable\n \n Partial Friend Class VisualBasicIntroduceVariableService\n Inherits AbstractIntroduceVariableService(Of VisualBasicIntroduceVariableService, ExpressionSyntax, TypeSyntax, TypeBlockSyntax, QueryExpressionSyntax, NameSyntax)\n\n \n \n Public Sub New()\n End Sub\n\n Protected Overrides Function GetContainingExecutableBlocks(expression As ExpressionSyntax) As IEnumerable(Of SyntaxNode)\n Return expression.GetContainingExecutableBlocks()\n End Function\n\n Protected Overrides Function GetInsertionIndices(destination As TypeBlockSyntax, cancellationToken As CancellationToken) As IList(Of Boolean)\n Return destination.GetInsertionIndices(cancellationToken)\n End Function\n\n Protected Overrides Function IsInAttributeArgumentInitializer(expression As ExpressionSyntax) As Boolean\n If expression.GetAncestorOrThis(Of ArgumentSyntax)() Is Nothing Then\n Return False\n End If\n\n If expression.GetAncestorOrThis(Of AttributeSyntax)() Is Nothing Then\n Return False\n End If\n\n If expression.DepthFirstTraversal.Any(Function(n) n.Kind() = SyntaxKind.ArrayCreationExpression) OrElse\n expression.DepthFirstTraversal.Any(Function(n) n.Kind() = SyntaxKind.GetTypeExpression) Then\n Return False\n End If\n\n Dim attributeBlock = expression.GetAncestorOrThis(Of AttributeListSyntax)()\n If attributeBlock.IsParentKind(SyntaxKind.CompilationUnit) Then\n Return False\n End If\n\n Return True\n End Function\n\n Protected Overrides Function IsInConstructorInitializer(expression As ExpressionSyntax) As Boolean\n Dim constructorInitializer = expression.GetAncestorsOrThis(Of StatementSyntax)().\n Where(Function(n) n.IsConstructorInitializer()).\n FirstOrDefault()\n\n If constructorInitializer Is Nothing Then\n Return False\n End If\n\n ' have to make sure we're not inside a lambda inside the constructor initializer.\n If expression.GetAncestorOrThis(Of LambdaExpressionSyntax)() IsNot Nothing Then\n Return False\n End If\n\n Return True\n End Function\n\n Protected Overrides Function CanIntroduceVariableFor(expression As ExpressionSyntax) As Boolean\n expression = expression.WalkUpParentheses()\n\n If TypeOf expression.Parent Is CallStatementSyntax Then\n Return False\n End If\n\n If Not expression.GetImplicitMemberAccessExpressions.All(Function(e) e.IsParentKind(SyntaxKind.WithStatement)) Then\n Return False\n End If\n\n If expression.IsParentKind(SyntaxKind.EqualsValue) AndAlso\n expression.Parent.IsParentKind(SyntaxKind.VariableDeclarator) Then\n Return False\n End If\n\n ' For Nothing Literals, AllOccurrences could introduce semantic errors.\n If expression.IsKind(SyntaxKind.NothingLiteralExpression) Then\n Return False\n End If\n\n Return True\n End Function\n\n Protected Overrides Function IsInFieldInitializer(expression As ExpressionSyntax) As Boolean\n If expression.GetAncestorOrThis(Of VariableDeclaratorSyntax)().GetAncestorOrThis(Of FieldDeclarationSyntax)() IsNot Nothing Then\n Return True\n End If\n\n Return False\n End Function\n\n Protected Overrides Function IsInNonFirstQueryClause(expression As ExpressionSyntax) As Boolean\n Dim query = expression.GetAncestor(Of QueryExpressionSyntax)()\n If query Is Nothing Then\n Return False\n End If\n\n ' Can't introduce for the first clause in a query.\n Dim fromClause = expression.GetAncestor(Of FromClauseSyntax)()\n If fromClause IsNot Nothing AndAlso query.Clauses.First() Is fromClause Then\n Return False\n End If\n\n Return True\n End Function\n\n Protected Overrides Function IsInParameterInitializer(expression As ExpressionSyntax) As Boolean\n Return expression.GetAncestorOrThis(Of EqualsValueSyntax)().IsParentKind(SyntaxKind.Parameter)\n End Function\n\n Protected Overrides Function IsInAutoPropertyInitializer(expression As ExpressionSyntax) As Boolean\n Dim propertyStatement = expression.GetAncestorOrThis(Of PropertyStatementSyntax)()\n Dim equalsValueStatement = expression.GetAncestorOrThis(Of EqualsValueSyntax)\n\n If propertyStatement IsNot Nothing Then\n Return expression.GetAncestorsOrThis(Of AsClauseSyntax).Contains(propertyStatement.AsClause) OrElse\n (equalsValueStatement IsNot Nothing AndAlso equalsValueStatement.Contains(propertyStatement.Initializer))\n End If\n\n Return False\n End Function\n\n Protected Overrides Function IsInExpressionBodiedMember(expression As ExpressionSyntax) As Boolean\n Return False\n End Function\n\n Protected Overrides Function CanReplace(expression As ExpressionSyntax) As Boolean\n If expression.CheckParent(Of RangeArgumentSyntax)(Function(n) n.LowerBound Is expression) Then\n Return False\n End If\n\n Return True\n End Function\n\n Protected Overrides Function IsExpressionInStaticLocalFunction(expression As ExpressionSyntax) As Boolean\n ' Local functions don't apply to VB.\n Return False\n End Function\n\n Protected Overrides Function RewriteCore(Of TNode As SyntaxNode)(node As TNode, replacementNode As SyntaxNode, matches As ISet(Of ExpressionSyntax)) As TNode\n Return DirectCast(Rewriter.Visit(node, replacementNode, matches), TNode)\n End Function\n\n Protected Overrides Function BlockOverlapsHiddenPosition(block As SyntaxNode, cancellationToken As CancellationToken) As Boolean\n Dim statements = block.GetStatements()\n\n If statements.Count = 0 Then\n Return block.OverlapsHiddenPosition(cancellationToken)\n End If\n\n Dim first = statements.First()\n Dim last = statements.Last()\n\n Return block.OverlapsHiddenPosition(TextSpan.FromBounds(first.SpanStart, last.SpanStart), cancellationToken)\n End Function\n\n End Class\nEnd Namespace\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":521,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56460,"string":"56,460"},"pr_title":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets"},"pr_description":{"kind":"string","value":"This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"author":{"kind":"string","value":"eerhardt"},"date_created":{"kind":"timestamp","value":"2021-09-16T21:47:36Z","string":"2021-09-16T21:47:36Z"},"date_merged":{"kind":"timestamp","value":"2021-09-22T00:53:07Z","string":"2021-09-22T00:53:07Z"},"previous_commit":{"kind":"string","value":"a10a3720229de8f4227e98736e884d6f926a9950"},"pr_commit":{"kind":"string","value":"aabc2fcbf630ba303e6f17808465349ea9b01a32"},"query":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets. This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"filepath":{"kind":"string","value":"./src/Workspaces/VisualBasic/Portable/CaseCorrection/VisualBasicCaseCorrectionServiceFactory.vb"},"before_content":{"kind":"string","value":"' Licensed to the .NET Foundation under one or more agreements.\n' The .NET Foundation licenses this file to you under the MIT license.\n' See the LICENSE file in the project root for more information.\n\nImports System.Composition\nImports Microsoft.CodeAnalysis.CaseCorrection\nImports Microsoft.CodeAnalysis.Host\nImports Microsoft.CodeAnalysis.Host.Mef\n\nNamespace Microsoft.CodeAnalysis.VisualBasic.CaseCorrection\n \n Partial Friend Class VisualBasicCaseCorrectionServiceFactory\n Implements ILanguageServiceFactory\n\n \n \n Public Sub New()\n End Sub\n\n Public Function CreateLanguageService(provider As HostLanguageServices) As ILanguageService Implements ILanguageServiceFactory.CreateLanguageService\n Return New VisualBasicCaseCorrectionService(provider)\n End Function\n End Class\nEnd Namespace\n"},"after_content":{"kind":"string","value":"' Licensed to the .NET Foundation under one or more agreements.\n' The .NET Foundation licenses this file to you under the MIT license.\n' See the LICENSE file in the project root for more information.\n\nImports System.Composition\nImports Microsoft.CodeAnalysis.CaseCorrection\nImports Microsoft.CodeAnalysis.Host\nImports Microsoft.CodeAnalysis.Host.Mef\n\nNamespace Microsoft.CodeAnalysis.VisualBasic.CaseCorrection\n \n Partial Friend Class VisualBasicCaseCorrectionServiceFactory\n Implements ILanguageServiceFactory\n\n \n \n Public Sub New()\n End Sub\n\n Public Function CreateLanguageService(provider As HostLanguageServices) As ILanguageService Implements ILanguageServiceFactory.CreateLanguageService\n Return New VisualBasicCaseCorrectionService(provider)\n End Function\n End Class\nEnd Namespace\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":522,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56460,"string":"56,460"},"pr_title":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets"},"pr_description":{"kind":"string","value":"This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"author":{"kind":"string","value":"eerhardt"},"date_created":{"kind":"timestamp","value":"2021-09-16T21:47:36Z","string":"2021-09-16T21:47:36Z"},"date_merged":{"kind":"timestamp","value":"2021-09-22T00:53:07Z","string":"2021-09-22T00:53:07Z"},"previous_commit":{"kind":"string","value":"a10a3720229de8f4227e98736e884d6f926a9950"},"pr_commit":{"kind":"string","value":"aabc2fcbf630ba303e6f17808465349ea9b01a32"},"query":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets. This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"filepath":{"kind":"string","value":"./src/Workspaces/CSharp/Portable/SemanticModelReuse/CSharpSemanticModelReuseLanguageService.cs"},"before_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Composition;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis.CSharp.CodeGeneration;\nusing Microsoft.CodeAnalysis.CSharp.LanguageServices;\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\nusing Microsoft.CodeAnalysis.Host.Mef;\nusing Microsoft.CodeAnalysis.LanguageServices;\nusing Microsoft.CodeAnalysis.SemanticModelReuse;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.CSharp.SemanticModelReuse\n{\n [ExportLanguageService(typeof(ISemanticModelReuseLanguageService), LanguageNames.CSharp), Shared]\n internal class CSharpSemanticModelReuseLanguageService : AbstractSemanticModelReuseLanguageService<\n MemberDeclarationSyntax,\n BaseMethodDeclarationSyntax,\n BasePropertyDeclarationSyntax,\n AccessorDeclarationSyntax>\n {\n [ImportingConstructor]\n [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]\n public CSharpSemanticModelReuseLanguageService()\n {\n }\n\n protected override ISyntaxFacts SyntaxFacts => CSharpSyntaxFacts.Instance;\n\n protected override BasePropertyDeclarationSyntax GetBasePropertyDeclaration(AccessorDeclarationSyntax accessor)\n {\n Contract.ThrowIfFalse(accessor.Parent is AccessorListSyntax);\n Contract.ThrowIfFalse(accessor.Parent.Parent is BasePropertyDeclarationSyntax);\n return (BasePropertyDeclarationSyntax)accessor.Parent.Parent;\n }\n\n protected override SyntaxList GetAccessors(BasePropertyDeclarationSyntax baseProperty)\n => baseProperty.AccessorList!.Accessors;\n\n public override SyntaxNode? TryGetContainingMethodBodyForSpeculation(SyntaxNode node)\n {\n for (SyntaxNode? previous = null, current = node; current != null; previous = current, current = current.Parent)\n {\n // These are the exact types that SemanticModel.TryGetSpeculativeSemanticModelForMethodBody accepts.\n if (current is BaseMethodDeclarationSyntax baseMethod)\n return previous != null && baseMethod.Body == previous ? baseMethod : null;\n\n if (current is AccessorDeclarationSyntax accessor)\n return previous != null && accessor.Body == previous ? accessor : null;\n }\n\n return null;\n }\n\n protected override async Task TryGetSpeculativeSemanticModelWorkerAsync(\n SemanticModel previousSemanticModel, SyntaxNode currentBodyNode, CancellationToken cancellationToken)\n {\n var previousRoot = await previousSemanticModel.SyntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false);\n var currentRoot = await currentBodyNode.SyntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false);\n\n var previousBodyNode = GetPreviousBodyNode(previousRoot, currentRoot, currentBodyNode);\n\n if (previousBodyNode is BaseMethodDeclarationSyntax previousBaseMethod &&\n currentBodyNode is BaseMethodDeclarationSyntax currentBaseMethod &&\n previousBaseMethod.Body != null &&\n previousSemanticModel.TryGetSpeculativeSemanticModelForMethodBody(previousBaseMethod.Body.SpanStart, currentBaseMethod, out var speculativeModel))\n {\n return speculativeModel;\n }\n\n if (previousBodyNode is AccessorDeclarationSyntax previousAccessorDeclaration &&\n currentBodyNode is AccessorDeclarationSyntax currentAccessorDeclaration &&\n previousAccessorDeclaration.Body != null &&\n previousSemanticModel.TryGetSpeculativeSemanticModelForMethodBody(previousAccessorDeclaration.Body.SpanStart, currentAccessorDeclaration, out speculativeModel))\n {\n return speculativeModel;\n }\n\n return null;\n }\n }\n}\n"},"after_content":{"kind":"string","value":"// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Composition;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.CodeAnalysis.CSharp.CodeGeneration;\nusing Microsoft.CodeAnalysis.CSharp.LanguageServices;\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\nusing Microsoft.CodeAnalysis.Host.Mef;\nusing Microsoft.CodeAnalysis.LanguageServices;\nusing Microsoft.CodeAnalysis.SemanticModelReuse;\nusing Roslyn.Utilities;\n\nnamespace Microsoft.CodeAnalysis.CSharp.SemanticModelReuse\n{\n [ExportLanguageService(typeof(ISemanticModelReuseLanguageService), LanguageNames.CSharp), Shared]\n internal class CSharpSemanticModelReuseLanguageService : AbstractSemanticModelReuseLanguageService<\n MemberDeclarationSyntax,\n BaseMethodDeclarationSyntax,\n BasePropertyDeclarationSyntax,\n AccessorDeclarationSyntax>\n {\n [ImportingConstructor]\n [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]\n public CSharpSemanticModelReuseLanguageService()\n {\n }\n\n protected override ISyntaxFacts SyntaxFacts => CSharpSyntaxFacts.Instance;\n\n protected override BasePropertyDeclarationSyntax GetBasePropertyDeclaration(AccessorDeclarationSyntax accessor)\n {\n Contract.ThrowIfFalse(accessor.Parent is AccessorListSyntax);\n Contract.ThrowIfFalse(accessor.Parent.Parent is BasePropertyDeclarationSyntax);\n return (BasePropertyDeclarationSyntax)accessor.Parent.Parent;\n }\n\n protected override SyntaxList GetAccessors(BasePropertyDeclarationSyntax baseProperty)\n => baseProperty.AccessorList!.Accessors;\n\n public override SyntaxNode? TryGetContainingMethodBodyForSpeculation(SyntaxNode node)\n {\n for (SyntaxNode? previous = null, current = node; current != null; previous = current, current = current.Parent)\n {\n // These are the exact types that SemanticModel.TryGetSpeculativeSemanticModelForMethodBody accepts.\n if (current is BaseMethodDeclarationSyntax baseMethod)\n return previous != null && baseMethod.Body == previous ? baseMethod : null;\n\n if (current is AccessorDeclarationSyntax accessor)\n return previous != null && accessor.Body == previous ? accessor : null;\n }\n\n return null;\n }\n\n protected override async Task TryGetSpeculativeSemanticModelWorkerAsync(\n SemanticModel previousSemanticModel, SyntaxNode currentBodyNode, CancellationToken cancellationToken)\n {\n var previousRoot = await previousSemanticModel.SyntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false);\n var currentRoot = await currentBodyNode.SyntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false);\n\n var previousBodyNode = GetPreviousBodyNode(previousRoot, currentRoot, currentBodyNode);\n\n if (previousBodyNode is BaseMethodDeclarationSyntax previousBaseMethod &&\n currentBodyNode is BaseMethodDeclarationSyntax currentBaseMethod &&\n previousBaseMethod.Body != null &&\n previousSemanticModel.TryGetSpeculativeSemanticModelForMethodBody(previousBaseMethod.Body.SpanStart, currentBaseMethod, out var speculativeModel))\n {\n return speculativeModel;\n }\n\n if (previousBodyNode is AccessorDeclarationSyntax previousAccessorDeclaration &&\n currentBodyNode is AccessorDeclarationSyntax currentAccessorDeclaration &&\n previousAccessorDeclaration.Body != null &&\n previousSemanticModel.TryGetSpeculativeSemanticModelForMethodBody(previousAccessorDeclaration.Body.SpanStart, currentAccessorDeclaration, out speculativeModel))\n {\n return speculativeModel;\n }\n\n return null;\n }\n }\n}\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":523,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56460,"string":"56,460"},"pr_title":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets"},"pr_description":{"kind":"string","value":"This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"author":{"kind":"string","value":"eerhardt"},"date_created":{"kind":"timestamp","value":"2021-09-16T21:47:36Z","string":"2021-09-16T21:47:36Z"},"date_merged":{"kind":"timestamp","value":"2021-09-22T00:53:07Z","string":"2021-09-22T00:53:07Z"},"previous_commit":{"kind":"string","value":"a10a3720229de8f4227e98736e884d6f926a9950"},"pr_commit":{"kind":"string","value":"aabc2fcbf630ba303e6f17808465349ea9b01a32"},"query":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets. This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"filepath":{"kind":"string","value":"./src/Workspaces/MSBuildTest/Resources/SourceFiles/VisualBasic/Application.myapp"},"before_content":{"kind":"string","value":"\n\n\n\n false\n false\n 0\n true\n 0\n 1\n true\n\n"},"after_content":{"kind":"string","value":"\n\n\n\n false\n false\n 0\n true\n 0\n 1\n true\n\n"},"label":{"kind":"number","value":-1,"string":"-1"}}},{"rowIdx":524,"cells":{"repo_name":{"kind":"string","value":"dotnet/roslyn"},"pr_number":{"kind":"number","value":56460,"string":"56,460"},"pr_title":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets"},"pr_description":{"kind":"string","value":"This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"author":{"kind":"string","value":"eerhardt"},"date_created":{"kind":"timestamp","value":"2021-09-16T21:47:36Z","string":"2021-09-16T21:47:36Z"},"date_merged":{"kind":"timestamp","value":"2021-09-22T00:53:07Z","string":"2021-09-22T00:53:07Z"},"previous_commit":{"kind":"string","value":"a10a3720229de8f4227e98736e884d6f926a9950"},"pr_commit":{"kind":"string","value":"aabc2fcbf630ba303e6f17808465349ea9b01a32"},"query":{"kind":"string","value":"Set CompilerApiVersion in Microsoft.Managed.Core.targets. This allows other targets to understand which compiler will be used.\r\nThis is useful in the SDK targets that need figure out the version in order to pick the right analyzer assets.\r\n\r\nContributes to #52265\r\n\r\nFYI - @dsplaisted. This resolves the feedback from https://github.com/dotnet/sdk/pull/20793#discussion_r707788803"},"filepath":{"kind":"string","value":"./src/EditorFeatures/Test2/ReferenceHighlighting/CSharpReferenceHighlightingTests.vb"},"before_content":{"kind":"string","value":"' Licensed to the .NET Foundation under one or more agreements.\n' The .NET Foundation licenses this file to you under the MIT license.\n' See the LICENSE file in the project root for more information.\n\nImports Microsoft.CodeAnalysis.Remote.Testing\n\nNamespace Microsoft.CodeAnalysis.Editor.UnitTests.ReferenceHighlighting\n Public Class CSharpReferenceHighlightingTests\n Inherits AbstractReferenceHighlightingTests\n\n \n \n Public Async Function TestVerifyNoHighlightsWhenOptionDisabled(testHost As TestHost) As Task\n Await VerifyHighlightsAsync(\n \n \n \n class $$Goo\n {\n Goo f;\n }\n \n \n ,\n testHost,\n optionIsEnabled:=False)\n End Function\n\n \n \n Public Async Function TestVerifyHighlightsForClass(testHost As TestHost) As Task\n Await VerifyHighlightsAsync(\n \n \n \n class {|Definition:$$Goo|}\n {\n }\n \n \n , testHost)\n End Function\n\n \n \n Public Async Function TestVerifyHighlightsForScriptReference(testHost As TestHost) As Task\n Await VerifyHighlightsAsync(\n \n \n \n \n\n void M()\n {\n }\n\n {|Reference:$$Script|}.M();\n \n \n , testHost)\n End Function\n\n \n \n Public Async Function TestVerifyHighlightsForCSharpClassWithConstructor(testHost As TestHost) As Task\n Await VerifyHighlightsAsync(\n \n \n \n class {|Definition:$$Goo|}\n {\n {|Definition:Goo|}()\n {\n {|Reference:var|} x = new {|Reference:Goo|}();\n }\n }\n \n \n , testHost)\n End Function\n\n \n \n \n Public Async Function TestVerifyHighlightsForCSharpClassWithSynthesizedConstructor(testHost As TestHost) As Task\n Await VerifyHighlightsAsync(\n \n \n \n class {|Definition:Goo|}\n {\n void Blah()\n {\n var x = new {|Reference:$$Goo|}();\n }\n }\n \n \n , testHost)\n End Function\n\n \n \n \n Public Async Function TestVerifyHighlightsOnCloseAngleOfGeneric(testHost As TestHost) As Task\n Await VerifyHighlightsAsync(\n \n \n ();\n }\n}]]>\n \n \n , testHost)\n End Function\n\n \n \n \n Public Async Function TestVerifyNoHighlightsOnAsyncLambda(testHost As TestHost) As Task\n Await VerifyHighlightsAsync(\n \n \n \n {\n return await Task.Yield();\n };\n\n}]]>\n \n \n , testHost)\n End Function\n\n \n \n \n Public Async Function TestAlias1(testHost As TestHost) As Task\n Dim input =\n \n \n \nnamespace X\n{\n using {|Definition:Q|} = System.IO;\n Class B\n {\n public void M()\n {\n $${|Reference:Q|}.Directory.Exists(\"\");\n }\n }\n}\n\n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestAlias2(testHost As TestHost) As Task\n Dim input =\n \n \n \nnamespace X\n{\n using $${|Definition:Q|} = System.IO;\n Class B\n {\n public void M()\n {\n {|Reference:Q|}.Directory.Exists(\"\");\n }\n }\n}\n\n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestAlias3(testHost As TestHost) As Task\n Dim input =\n \n \n \nnamespace X\n{\n using Q = System.$${|Reference:IO|};\n Class B\n {\n public void M()\n {\n {|Reference:Q|}.Directory.Exists(\"\");\n }\n }\n}\n\n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestAlias4(testHost As TestHost) As Task\n Dim input =\n \n \n ; // select C \n class A { }\n class B : {|Reference:C|} { }\n}]]>\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestHighlightThroughVar1(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass C\n{\n void F()\n {\n $${|Reference:var|} i = 1;\n {|Reference:int|} j = 0;\n double d;\n {|Reference:int|} k = 1;\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestHighlightThroughVar2(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass C\n{\n void F()\n {\n {|Reference:var|} i = 1;\n $${|Reference:int|} j = 0;\n double d;\n {|Reference:int|} k = 1;\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestHighlightThroughVar3(testHost As TestHost) As Task\n Dim input =\n \n \n ();\n int j = 0;\n double d;\n {|Reference:var|} k = new {|Reference:List|}();\n }\n}\n ]]>\n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestUsingAliasAndTypeWithSameName1(testHost As TestHost) As Task\n Dim input =\n\n \n \nusing {|Definition:$$X|} = System;\n\nclass X { }\n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestUsingAliasAndTypeWithSameName2(testHost As TestHost) As Task\n Dim input =\n\n \n \nusing X = System;\n\nclass {|Definition:$$X|} { }\n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestAccessor1(testHost As TestHost) As Task\n Dim input =\n\n \n \nclass C\n{\n string P\n {\n $$get\n {\n return P;\n }\n set\n {\n P = \"\";\n }\n }\n}\n \n \n\n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestAccessor2(testHost As TestHost) As Task\n Dim input =\n\n \n \nclass C\n{\n string P\n {\n get\n {\n return P;\n }\n $$set\n {\n P = \"\";\n }\n }\n}\n \n \n\n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n Public Async Function TestThisShouldNotHighlightTypeName(testHost As TestHost) As Task\n Dim input =\n\n \n \nclass C\n{\n void M()\n {\n t$$his.M();\n }\n}\n \n \n\n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestHighlightDynamicallyBoundMethod(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass A\n{\n class B\n {\n public void {|Definition:Boo|}(int d) { } //Line 1\n public void Boo(dynamic d) { } //Line 2\n public void Boo(string d) { } //Line 3\n }\n void Aoo()\n {\n B b = new B();\n dynamic d = 1.5f; \n b.{|Reference:Boo|}(1); //Line 4\n b.$${|Reference:Boo|}(d); //Line 5\n b.Boo(\"d\"); //Line 6\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestHighlightParameterizedPropertyParameter(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass C\n{\n int this[int $${|Definition:i|}]\n {\n get\n {\n return this[{|Reference:i|}];\n }\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n Public Async Function TestInterpolatedString1(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass C\n{\n void M()\n {\n var $${|Definition:a|} = \"Hello\";\n var b = \"World\";\n var c = $\"{ {|Reference:a|} }, {b}!\";\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n Public Async Function TestInterpolatedString2(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass C\n{\n void M()\n {\n var a = \"Hello\";\n var $${|Definition:b|} = \"World\";\n var c = $\"{a}, { {|Reference:b|} }!\";\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n Public Async Function TestWrittenReference(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass C\n{\n void M()\n {\n var $${|Definition:b|} = \"Hello\";\n {|WrittenReference:b|} = \"World\";\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n Public Async Function TestWrittenReference2(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass C\n{\n void M()\n {\n int {|Definition:$$y|};\n int x = {|WrittenReference:y|} = 7;\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n Public Async Function TestPatternMatchingType1(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass C\n{\n void M()\n {\n object o = null;\n if (o is C $${|Definition:c|})\n {\n var d = {|Reference:c|};\n }\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n Public Async Function TestPatternMatchingType2(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass C\n{\n void M()\n {\n object o = null;\n if (o is C {|Definition:c|})\n {\n var d = $${|Reference:c|};\n }\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n Public Async Function TestPatternMatchingTypeScoping1(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass Class1 { } \nclass Class2 { } \nclass C\n{\n void M()\n {\n object o = null;\n if (o is Class1 {|Definition:c|})\n {\n var d = $${|Reference:c|};\n }\n else if (o is Class2 c)\n {\n var d = c;\n }\n el\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n Public Async Function TestPatternMatchingTypeScoping2(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass Class1 { } \nclass Class2 { } \nclass C\n{\n void M()\n {\n object o = null;\n if (o is Class1 c)\n {\n var d = c;\n }\n else if (o is Class2 {|Definition:c|})\n {\n var d = $${|Reference:c|};\n }\n el\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n Public Async Function TestRegexReference1(testHost As TestHost) As Task\n\n Dim input =\n \n \n \nusing System.Text.RegularExpressions;\n\nclass C\n{\n void Goo()\n {\n var r = new Regex(@\"{|Reference:(a)|}\\0{|Reference:\\$$1|}\");\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n Public Async Function TestHighlightParamAndCommentsCursorOnDefinition(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass C\n{\n /// < summary >\n /// < paramref name=\"{|Reference:x|}\"/ >\n /// < /summary >\n /// < param name=\"{|Reference:x|}\" > < /param >\n public int this[int $${|Definition:x|}]\n {\n get\n {\n return 0;\n }\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n Public Async Function TestHighlightParamAndCommentsCursorOnReference(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass C\n{\n /// < summary >\n /// < paramref name=\"$${|Reference:x|}\"/ >\n /// < /summary >\n /// < param name=\"{|Reference:x|}\" > < /param >\n public int this[int {|Definition:x|}]\n {\n get\n {\n return 0;\n }\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n Public Async Function TestHighlightParamAndCommentsDefinitionNestedBetweenReferences(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass C\n{\n /// < summary >\n /// < paramref name=\"$${|Reference:x|}\"/ >\n /// < /summary >\n /// < param name=\"{|Reference:x|}\" > < /param >\n public int this[int {|Definition:x|}]\n {\n get\n {\n return {|Reference:x|};\n }\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n Public Async Function TestNotOnNewInObjectCreation(testHost As TestHost) As Task\n Dim input =\n \n \n \nnamespace X\n{\n class B\n {\n public void M()\n {\n $$new B();\n new B();\n }\n }\n}\n\n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n Public Async Function TestOnTypeInObjectCreation(testHost As TestHost) As Task\n Dim input =\n \n \n \nnamespace X\n{\n class {|Definition:B|}\n {\n public void M()\n {\n new $${|Reference:B|}();\n new {|Reference:B|}();\n }\n }\n}\n\n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n End Class\nEnd Namespace\n"},"after_content":{"kind":"string","value":"' Licensed to the .NET Foundation under one or more agreements.\n' The .NET Foundation licenses this file to you under the MIT license.\n' See the LICENSE file in the project root for more information.\n\nImports Microsoft.CodeAnalysis.Remote.Testing\n\nNamespace Microsoft.CodeAnalysis.Editor.UnitTests.ReferenceHighlighting\n Public Class CSharpReferenceHighlightingTests\n Inherits AbstractReferenceHighlightingTests\n\n \n \n Public Async Function TestVerifyNoHighlightsWhenOptionDisabled(testHost As TestHost) As Task\n Await VerifyHighlightsAsync(\n \n \n \n class $$Goo\n {\n Goo f;\n }\n \n \n ,\n testHost,\n optionIsEnabled:=False)\n End Function\n\n \n \n Public Async Function TestVerifyHighlightsForClass(testHost As TestHost) As Task\n Await VerifyHighlightsAsync(\n \n \n \n class {|Definition:$$Goo|}\n {\n }\n \n \n , testHost)\n End Function\n\n \n \n Public Async Function TestVerifyHighlightsForScriptReference(testHost As TestHost) As Task\n Await VerifyHighlightsAsync(\n \n \n \n \n\n void M()\n {\n }\n\n {|Reference:$$Script|}.M();\n \n \n , testHost)\n End Function\n\n \n \n Public Async Function TestVerifyHighlightsForCSharpClassWithConstructor(testHost As TestHost) As Task\n Await VerifyHighlightsAsync(\n \n \n \n class {|Definition:$$Goo|}\n {\n {|Definition:Goo|}()\n {\n {|Reference:var|} x = new {|Reference:Goo|}();\n }\n }\n \n \n , testHost)\n End Function\n\n \n \n \n Public Async Function TestVerifyHighlightsForCSharpClassWithSynthesizedConstructor(testHost As TestHost) As Task\n Await VerifyHighlightsAsync(\n \n \n \n class {|Definition:Goo|}\n {\n void Blah()\n {\n var x = new {|Reference:$$Goo|}();\n }\n }\n \n \n , testHost)\n End Function\n\n \n \n \n Public Async Function TestVerifyHighlightsOnCloseAngleOfGeneric(testHost As TestHost) As Task\n Await VerifyHighlightsAsync(\n \n \n ();\n }\n}]]>\n \n \n , testHost)\n End Function\n\n \n \n \n Public Async Function TestVerifyNoHighlightsOnAsyncLambda(testHost As TestHost) As Task\n Await VerifyHighlightsAsync(\n \n \n \n {\n return await Task.Yield();\n };\n\n}]]>\n \n \n , testHost)\n End Function\n\n \n \n \n Public Async Function TestAlias1(testHost As TestHost) As Task\n Dim input =\n \n \n \nnamespace X\n{\n using {|Definition:Q|} = System.IO;\n Class B\n {\n public void M()\n {\n $${|Reference:Q|}.Directory.Exists(\"\");\n }\n }\n}\n\n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestAlias2(testHost As TestHost) As Task\n Dim input =\n \n \n \nnamespace X\n{\n using $${|Definition:Q|} = System.IO;\n Class B\n {\n public void M()\n {\n {|Reference:Q|}.Directory.Exists(\"\");\n }\n }\n}\n\n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestAlias3(testHost As TestHost) As Task\n Dim input =\n \n \n \nnamespace X\n{\n using Q = System.$${|Reference:IO|};\n Class B\n {\n public void M()\n {\n {|Reference:Q|}.Directory.Exists(\"\");\n }\n }\n}\n\n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestAlias4(testHost As TestHost) As Task\n Dim input =\n \n \n ; // select C \n class A { }\n class B : {|Reference:C|} { }\n}]]>\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestHighlightThroughVar1(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass C\n{\n void F()\n {\n $${|Reference:var|} i = 1;\n {|Reference:int|} j = 0;\n double d;\n {|Reference:int|} k = 1;\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestHighlightThroughVar2(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass C\n{\n void F()\n {\n {|Reference:var|} i = 1;\n $${|Reference:int|} j = 0;\n double d;\n {|Reference:int|} k = 1;\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestHighlightThroughVar3(testHost As TestHost) As Task\n Dim input =\n \n \n ();\n int j = 0;\n double d;\n {|Reference:var|} k = new {|Reference:List|}();\n }\n}\n ]]>\n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestUsingAliasAndTypeWithSameName1(testHost As TestHost) As Task\n Dim input =\n\n \n \nusing {|Definition:$$X|} = System;\n\nclass X { }\n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestUsingAliasAndTypeWithSameName2(testHost As TestHost) As Task\n Dim input =\n\n \n \nusing X = System;\n\nclass {|Definition:$$X|} { }\n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestAccessor1(testHost As TestHost) As Task\n Dim input =\n\n \n \nclass C\n{\n string P\n {\n $$get\n {\n return P;\n }\n set\n {\n P = \"\";\n }\n }\n}\n \n \n\n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestAccessor2(testHost As TestHost) As Task\n Dim input =\n\n \n \nclass C\n{\n string P\n {\n get\n {\n return P;\n }\n $$set\n {\n P = \"\";\n }\n }\n}\n \n \n\n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n Public Async Function TestThisShouldNotHighlightTypeName(testHost As TestHost) As Task\n Dim input =\n\n \n \nclass C\n{\n void M()\n {\n t$$his.M();\n }\n}\n \n \n\n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestHighlightDynamicallyBoundMethod(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass A\n{\n class B\n {\n public void {|Definition:Boo|}(int d) { } //Line 1\n public void Boo(dynamic d) { } //Line 2\n public void Boo(string d) { } //Line 3\n }\n void Aoo()\n {\n B b = new B();\n dynamic d = 1.5f; \n b.{|Reference:Boo|}(1); //Line 4\n b.$${|Reference:Boo|}(d); //Line 5\n b.Boo(\"d\"); //Line 6\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n \n Public Async Function TestHighlightParameterizedPropertyParameter(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass C\n{\n int this[int $${|Definition:i|}]\n {\n get\n {\n return this[{|Reference:i|}];\n }\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n Public Async Function TestInterpolatedString1(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass C\n{\n void M()\n {\n var $${|Definition:a|} = \"Hello\";\n var b = \"World\";\n var c = $\"{ {|Reference:a|} }, {b}!\";\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n Public Async Function TestInterpolatedString2(testHost As TestHost) As Task\n Dim input =\n \n \n \nclass C\n{\n void M()\n {\n var a = \"Hello\";\n var $${|Definition:b|} = \"World\";\n var c = $\"{a}, { {|Reference:b|} }!\";\n }\n}\n \n \n \n\n Await VerifyHighlightsAsync(input, testHost)\n End Function\n\n \n \n Public Async Function TestWrittenReference(testHost As TestHost) As Task\n Dim input =\n \n