From a1d33d1d46cbc8bf72ecd1d7cb1f37ce62af571d Mon Sep 17 00:00:00 2001 From: Ankita Khera <40616383+akhera99@users.noreply.github.com> Date: Wed, 11 Jun 2025 11:01:23 -0700 Subject: [PATCH 1/6] Inline Hints - do not allow double click for collection expression type hint (#78900) * do not allow double click for collection expression hint * Update src/EditorFeatures/Test2/InlineHints/CSharpInlineTypeHintsTests.vb Co-authored-by: Cyrus Najmabadi * comment --------- Co-authored-by: Cyrus Najmabadi --- .../InlineHints/CSharpInlineTypeHintsTests.vb | 29 +++++++++++++++++++ .../CSharpInlineTypeHintsService.cs | 5 +++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/EditorFeatures/Test2/InlineHints/CSharpInlineTypeHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/CSharpInlineTypeHintsTests.vb index 8a2c2582e62e1..8e1b13c98d038 100644 --- a/src/EditorFeatures/Test2/InlineHints/CSharpInlineTypeHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/CSharpInlineTypeHintsTests.vb @@ -934,5 +934,34 @@ class C Await VerifyTypeHints(input, output) End Function + + + Public Async Function TestNoDoubleClickWithCollectionExpression() As Task + Dim input = + + + +class A +{ + private static readonly ImmutableHashSet<string?> Hashes = {| ImmutableHashSet<string?>:|}[]; +} + + + + + Dim output = + + + +class A +{ + private static readonly ImmutableHashSet<string?> Hashes = []; +} + + + + + Await VerifyTypeHints(input, output) + End Function End Class End Namespace diff --git a/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs b/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs index 637a5ecff3a2b..55f612a4b698d 100644 --- a/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs +++ b/src/Features/CSharp/Portable/InlineHints/CSharpInlineTypeHintsService.cs @@ -105,7 +105,10 @@ internal sealed class CSharpInlineTypeHintsService() : AbstractInlineTypeHintsSe if (IsValidType(type)) { var span = new TextSpan(collectionExpression.OpenBracketToken.SpanStart, 0); - return new(type, span, new TextChange(span, GetTypeDisplayString(type)), leadingSpace: true); + + // We pass null for the TextChange in collection expressions because + // inserting with the type is incorrect and will make the code uncompilable. + return new(type, span, textChange: null, leadingSpace: true); } } } From f77d2b73acc16d190fb90d484ddf20b24f9239f9 Mon Sep 17 00:00:00 2001 From: Rikki Gibson Date: Wed, 11 Jun 2025 17:05:10 -0700 Subject: [PATCH 2/6] Revert "Update code to use null propagation (#78733)" This reverts commit d78554926c82ef0ce263fea99422dd6b4ce37743, reversing changes made to a8808be5f59ea35691b3b7c1f945c895f685b320. --- .../GenerateEqualsAndGetHashCodeFromMembersTests.cs | 5 ++++- .../Core/InlineRename/InlineRenameSession.cs | 9 ++++++--- .../InlineRename/UI/Adornment/RenameFlyoutViewModel.cs | 5 ++++- .../Shared/Utilities/CaretPreservingEditTransaction.cs | 5 ++++- ...atureHelpPresenter.SignatureHelpPresenterSession.cs | 5 ++++- .../CodeActions/AbstractCodeActionTest.cs | 5 ++++- .../GenerateOverridesWithDialogCodeAction.cs | 5 ++++- .../Core/Portable/QuickInfo/QuickInfoUtilities.cs | 5 ++++- .../AbstractCodeActionTest_NoEditor.cs | 5 ++++- src/Scripting/Core/ScriptBuilder.cs | 5 ++++- .../Def/InheritanceMargin/InheritanceMarginLogger.cs | 5 ++++- src/VisualStudio/Core/Def/Utilities/TaskItemsEnum.cs | 5 ++++- .../Impl/SolutionExplorer/AnalyzersCommandHandler.cs | 10 ++++++++-- 13 files changed, 58 insertions(+), 16 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/CodeActions/GenerateEqualsAndGetHashCodeFromMembers/GenerateEqualsAndGetHashCodeFromMembersTests.cs b/src/EditorFeatures/CSharpTest/CodeActions/GenerateEqualsAndGetHashCodeFromMembers/GenerateEqualsAndGetHashCodeFromMembersTests.cs index 65c2b53b336f4..fbda58a3296d7 100644 --- a/src/EditorFeatures/CSharpTest/CodeActions/GenerateEqualsAndGetHashCodeFromMembers/GenerateEqualsAndGetHashCodeFromMembersTests.cs +++ b/src/EditorFeatures/CSharpTest/CodeActions/GenerateEqualsAndGetHashCodeFromMembers/GenerateEqualsAndGetHashCodeFromMembersTests.cs @@ -69,7 +69,10 @@ private static OptionsCollection PreferExplicitTypeWithInfo() internal static void EnableOption(ImmutableArray options, string id) { var option = options.FirstOrDefault(o => o.Id == id); - option?.Value = true; + if (option != null) + { + option.Value = true; + } } [Fact] diff --git a/src/EditorFeatures/Core/InlineRename/InlineRenameSession.cs b/src/EditorFeatures/Core/InlineRename/InlineRenameSession.cs index 446999370aa78..49f3e37b6dc96 100644 --- a/src/EditorFeatures/Core/InlineRename/InlineRenameSession.cs +++ b/src/EditorFeatures/Core/InlineRename/InlineRenameSession.cs @@ -806,9 +806,12 @@ private async Task CommitWorkerAsync(bool previewChanges, bool canUseBackg previewChanges = previewChanges || PreviewChanges; - // Prevent Editor's typing responsiveness auto canceling the rename operation. - // InlineRenameSession will call IUIThreadOperationExecutor to sets up our own IUIThreadOperationContext - editorUIOperationContext?.TakeOwnership(); + if (editorUIOperationContext is not null) + { + // Prevent Editor's typing responsiveness auto canceling the rename operation. + // InlineRenameSession will call IUIThreadOperationExecutor to sets up our own IUIThreadOperationContext + editorUIOperationContext.TakeOwnership(); + } try { diff --git a/src/EditorFeatures/Core/InlineRename/UI/Adornment/RenameFlyoutViewModel.cs b/src/EditorFeatures/Core/InlineRename/UI/Adornment/RenameFlyoutViewModel.cs index 0682af9dd88d2..f0d2baf6d6704 100644 --- a/src/EditorFeatures/Core/InlineRename/UI/Adornment/RenameFlyoutViewModel.cs +++ b/src/EditorFeatures/Core/InlineRename/UI/Adornment/RenameFlyoutViewModel.cs @@ -325,7 +325,10 @@ protected virtual void Dispose(bool disposing) Session.ReplacementsComputed -= OnReplacementsComputed; Session.CommitStateChange -= CommitStateChange; - SmartRenameViewModel?.Dispose(); + if (SmartRenameViewModel is not null) + { + SmartRenameViewModel.Dispose(); + } UnregisterOleComponent(); } diff --git a/src/EditorFeatures/Core/Shared/Utilities/CaretPreservingEditTransaction.cs b/src/EditorFeatures/Core/Shared/Utilities/CaretPreservingEditTransaction.cs index 7dfdafeb9d975..5bcb2e0203bce 100644 --- a/src/EditorFeatures/Core/Shared/Utilities/CaretPreservingEditTransaction.cs +++ b/src/EditorFeatures/Core/Shared/Utilities/CaretPreservingEditTransaction.cs @@ -93,7 +93,10 @@ public IMergeTextUndoTransactionPolicy? MergePolicy set { - _transaction?.MergePolicy = value; + if (_transaction != null) + { + _transaction.MergePolicy = value; + } } } diff --git a/src/EditorFeatures/Core/SignatureHelp/Presentation/SignatureHelpPresenter.SignatureHelpPresenterSession.cs b/src/EditorFeatures/Core/SignatureHelp/Presentation/SignatureHelpPresenter.SignatureHelpPresenterSession.cs index 95d84bf617814..0c1dd62d2d604 100644 --- a/src/EditorFeatures/Core/SignatureHelp/Presentation/SignatureHelpPresenter.SignatureHelpPresenterSession.cs +++ b/src/EditorFeatures/Core/SignatureHelp/Presentation/SignatureHelpPresenter.SignatureHelpPresenterSession.cs @@ -97,7 +97,10 @@ public void PresentItems( Contract.ThrowIfNull(_signatureMap); var defaultValue = _signatureMap.GetValueOrDefault(_selectedItem); - _editorSessionOpt?.SelectedSignature = defaultValue; + if (_editorSessionOpt != null) + { + _editorSessionOpt.SelectedSignature = defaultValue; + } } finally { diff --git a/src/EditorFeatures/DiagnosticsTestUtilities/CodeActions/AbstractCodeActionTest.cs b/src/EditorFeatures/DiagnosticsTestUtilities/CodeActions/AbstractCodeActionTest.cs index 7090b5e0b51a7..aa5f7030fb9f9 100644 --- a/src/EditorFeatures/DiagnosticsTestUtilities/CodeActions/AbstractCodeActionTest.cs +++ b/src/EditorFeatures/DiagnosticsTestUtilities/CodeActions/AbstractCodeActionTest.cs @@ -166,7 +166,10 @@ internal static void EnableOptions( internal static void EnableOption(ImmutableArray options, string id) { var option = options.FirstOrDefault(o => o.Id == id); - option?.Value = true; + if (option != null) + { + option.Value = true; + } } internal Task TestWithPickMembersDialogAsync( diff --git a/src/Features/Core/Portable/GenerateOverrides/GenerateOverridesWithDialogCodeAction.cs b/src/Features/Core/Portable/GenerateOverrides/GenerateOverridesWithDialogCodeAction.cs index 049fbf52bbe4c..bd8c52909be04 100644 --- a/src/Features/Core/Portable/GenerateOverrides/GenerateOverridesWithDialogCodeAction.cs +++ b/src/Features/Core/Portable/GenerateOverrides/GenerateOverridesWithDialogCodeAction.cs @@ -102,7 +102,10 @@ private sealed class ChangeOptionValueOperation(bool selectedAll) : CodeActionOp public override void Apply(Workspace workspace, CancellationToken cancellationToken) { var service = workspace.Services.GetService(); - service?.GenerateOverrides = _selectedAll; + if (service != null) + { + service.GenerateOverrides = _selectedAll; + } } } } diff --git a/src/Features/Core/Portable/QuickInfo/QuickInfoUtilities.cs b/src/Features/Core/Portable/QuickInfo/QuickInfoUtilities.cs index a318927b44cfa..fdb53dfa525e5 100644 --- a/src/Features/Core/Portable/QuickInfo/QuickInfoUtilities.cs +++ b/src/Features/Core/Portable/QuickInfo/QuickInfoUtilities.cs @@ -77,7 +77,10 @@ public static async Task CreateQuickInfoItemAsync( if (groups.TryGetValue(SymbolDescriptionGroups.Documentation, out var docParts) && !docParts.IsDefaultOrEmpty) { AddSection(QuickInfoSectionKinds.DocumentationComments, docParts); - onTheFlyDocsInfo?.HasComments = true; + if (onTheFlyDocsInfo != null) + { + onTheFlyDocsInfo.HasComments = true; + } } if (options.QuickInfoOptions.ShowRemarksInQuickInfo && diff --git a/src/Features/DiagnosticsTestUtilities/CodeActionsLegacy/AbstractCodeActionTest_NoEditor.cs b/src/Features/DiagnosticsTestUtilities/CodeActionsLegacy/AbstractCodeActionTest_NoEditor.cs index 12d8bd9c7eb01..887450a6e6f1a 100644 --- a/src/Features/DiagnosticsTestUtilities/CodeActionsLegacy/AbstractCodeActionTest_NoEditor.cs +++ b/src/Features/DiagnosticsTestUtilities/CodeActionsLegacy/AbstractCodeActionTest_NoEditor.cs @@ -174,7 +174,10 @@ internal static void EnableOptions( internal static void EnableOption(ImmutableArray options, string id) { var option = options.FirstOrDefault(o => o.Id == id); - option?.Value = true; + if (option != null) + { + option.Value = true; + } } internal Task TestWithPickMembersDialogAsync( diff --git a/src/Scripting/Core/ScriptBuilder.cs b/src/Scripting/Core/ScriptBuilder.cs index 68e2708651be0..f345991323d38 100644 --- a/src/Scripting/Core/ScriptBuilder.cs +++ b/src/Scripting/Core/ScriptBuilder.cs @@ -152,7 +152,10 @@ private Func> Build( peStream.Position = 0; - pdbStreamOpt?.Position = 0; + if (pdbStreamOpt != null) + { + pdbStreamOpt.Position = 0; + } var assembly = _assemblyLoader.LoadAssemblyFromStream(peStream, pdbStreamOpt); var runtimeEntryPoint = GetEntryPointRuntimeMethod(entryPoint, assembly); diff --git a/src/VisualStudio/Core/Def/InheritanceMargin/InheritanceMarginLogger.cs b/src/VisualStudio/Core/Def/InheritanceMargin/InheritanceMarginLogger.cs index 3783866bf71d3..b88af7fc759c5 100644 --- a/src/VisualStudio/Core/Def/InheritanceMargin/InheritanceMarginLogger.cs +++ b/src/VisualStudio/Core/Def/InheritanceMargin/InheritanceMarginLogger.cs @@ -34,7 +34,10 @@ public static void ReportTelemetry() static m => { var histogramLogAggregator = s_histogramLogAggregator.GetValue(ActionInfo.GetInheritanceMarginMembers); - histogramLogAggregator?.WriteTelemetryPropertiesTo(m, nameof(ActionInfo.GetInheritanceMarginMembers) + "."); + if (histogramLogAggregator != null) + { + histogramLogAggregator.WriteTelemetryPropertiesTo(m, nameof(ActionInfo.GetInheritanceMarginMembers) + "."); + } })); } } diff --git a/src/VisualStudio/Core/Def/Utilities/TaskItemsEnum.cs b/src/VisualStudio/Core/Def/Utilities/TaskItemsEnum.cs index b160cefe8ece0..d64bf30a8c9ed 100644 --- a/src/VisualStudio/Core/Def/Utilities/TaskItemsEnum.cs +++ b/src/VisualStudio/Core/Def/Utilities/TaskItemsEnum.cs @@ -29,7 +29,10 @@ int IVsEnumTaskItems.Next(uint celt, IVsTaskItem[] rgelt, uint[] pceltFetched) _next += i; - pceltFetched?[0] = (uint)i; + if (pceltFetched != null) + { + pceltFetched[0] = (uint)i; + } return (i == celt) ? VSConstants.S_OK : VSConstants.S_FALSE; } diff --git a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzersCommandHandler.cs b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzersCommandHandler.cs index 278eb376d90ca..f1fed7301863e 100644 --- a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzersCommandHandler.cs +++ b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzersCommandHandler.cs @@ -185,7 +185,10 @@ private bool ShouldShowAnalyzerContextMenu(IEnumerable items) private void UpdateAnalyzerContextMenu() { - _removeMenuItem?.Enabled = _allowProjectSystemOperations; + if (_removeMenuItem != null) + { + _removeMenuItem.Enabled = _allowProjectSystemOperations; + } } public IContextMenuController DiagnosticContextMenuController @@ -554,7 +557,10 @@ private static void UpdateProjectConfigurationsToUseRuleSetFile(EnvDTE.Project e { var codeAnalysisRuleSetFileProperty = properties?.Item("CodeAnalysisRuleSet"); - codeAnalysisRuleSetFileProperty?.Value = fileName; + if (codeAnalysisRuleSetFileProperty != null) + { + codeAnalysisRuleSetFileProperty.Value = fileName; + } } catch (ArgumentException) { From 1ab27c2ff60bdfe525c03b20298e2d7d8fd6c721 Mon Sep 17 00:00:00 2001 From: Rikki Gibson Date: Wed, 11 Jun 2025 17:10:03 -0700 Subject: [PATCH 3/6] Revert "Move to .NET 10 Preview 5 (#78906)" This reverts commit a7fa6814e8625dcc37b02664a34e8917f05bb40c. --- eng/targets/Settings.props | 2 +- global.json | 6 ++-- .../HashCodeAnalyzer/HashCodeAnalyzer.cs | 6 ++-- src/Compilers/.editorconfig | 3 -- .../Parser/LanguageParser_Patterns.cs | 2 +- .../Portable/Parser/Lexer_RawStringLiteral.cs | 2 +- .../CodeGen/CodeGenOverridingAndHiding.cs | 2 +- .../Test/Emit/CodeGen/WinMdDelegateTests.cs | 2 +- .../Attributes/AttributeTests_IsByRefLike.cs | 2 +- .../AttributeTests_WellKnownAttributes.cs | 2 +- .../Emit3/OverloadResolutionPriorityTests.cs | 2 +- src/Compilers/Core/Portable/EmbeddedText.cs | 2 +- .../Core/Portable/MetadataReader/PEModule.cs | 13 ++++++++ ...utomaticLineEnderCommandHandler_Helpers.cs | 3 ++ .../ConvertNamespaceCommandHandler.cs | 4 ++- .../StringCopyPasteCommandHandler.cs | 6 +++- .../Core/Editor/IContainedDocument.cs | 2 +- .../AbstactVSTypeScriptLspServiceFactory.cs | 1 - .../Core/InlineRename/InlineRenameService.cs | 3 ++ .../Core/InlineRename/InlineRenameSession.cs | 3 ++ .../UI/IInlineRenameColorUpdater.cs | 2 +- .../UI/SmartRename/SmartRenameViewModel.cs | 5 +-- .../NavigableSymbolService.cs | 3 ++ .../Core/Preview/IDifferenceViewerPreview.cs | 2 +- .../SplitCommentCommandHandler.cs | 2 ++ ...actAsynchronousTaggerProvider.TagSource.cs | 5 +++ .../NavigableSymbols/NavigableSymbolsTest.vb | 2 +- .../TestUtilities/Threading/WpfTestRunner.cs | 2 -- .../Workspaces/EditorTestHostDocument.cs | 7 ++++ .../PartialTypeCompletionProvider.cs | 3 ++ .../CSharpProximityExpressionsService.cs | 4 +++ ...DeclarationNameRecommenderImplmentation.cs | 2 +- ...berFromParameterCodeRefactoringProvider.cs | 1 - .../IDesignerAttributeDiscoveryService.cs | 2 +- .../AbstractInheritanceMarginService.cs | 1 - ...tializeParameterCodeRefactoringProvider.cs | 1 - .../Intents/IIntentProviderMetadata.cs | 4 +-- .../MetadataAsSourceFileService.cs | 2 -- .../IRemoteNavigateToSearchService.cs | 2 +- .../Portable/Navigation/INavigableItem.cs | 4 +-- .../IEditorConfigOptionsEnumerator.cs | 2 +- .../Snippets/SnippetFunctionService.cs | 1 - .../Portable/Snippets/SnippetUtilities.cs | 1 - .../Windows/IFileDownloaderFactory.cs | 2 +- .../TestFrameworks/ITestFrameworkMetadata.cs | 2 +- src/Features/Lsif/Generator/Graph/Id.cs | 2 +- .../CrefCompletionProvider.vb | 1 + .../EnumCompletionProvider.vb | 8 +++++ .../NamedParameterCompletionProvider.vb | 33 +++++++++++++++++++ .../BrokeredServiceContainer.cs | 1 - .../HostWorkspace/ProjectDependencyHelper.cs | 1 - .../Logging/LspLogMessageLoggerProvider.cs | 1 - .../StarredCompletionsAssemblyHelper.cs | 1 - .../AbstractRequestScope.cs | 1 - .../IRequestHandler.cs | 1 - .../RequestShutdownEventArgs.cs | 1 - .../Diagnostics/DiagnosticDataExtensions.cs | 1 - .../Protocol/Converters/SumConverter.cs | 1 - .../Converters/TextDocumentSyncConverter.cs | 1 - .../ClassifiedTextElementConverter.cs | 1 - .../Converters/ClassifiedTextRunConverter.cs | 1 - .../Protocol/WorkspaceDiagnosticReport.cs | 1 - .../WorkspaceDiagnosticReportPartialResult.cs | 1 - .../Commands/ExecuteWorkspaceCommandTests.cs | 1 - .../AdditionalFileDiagnosticsTests.cs | 1 - .../Diagnostics/DiagnosticsPullCacheTests.cs | 1 - .../WorkspaceProjectDiagnosticsTests.cs | 1 - .../FindAllReferencesHandlerFeaturesTests.cs | 1 - .../LspWorkspaceRegistrationServiceTests.cs | 1 - src/Tools/PrepareTests/TestDiscovery.cs | 1 - .../Source/RunTests/TestHistoryManager.cs | 1 - .../DocumentOutlineViewModel_Utilities.cs | 1 - .../Workspace/SourceGeneratedFileManager.cs | 2 ++ .../TestModel/ResourceStringConverter.cs | 1 - .../CSharp/CSharpF1Help.cs | 2 +- .../CSharp/CSharpSourceGenerators.cs | 5 ++- .../VisualBasic/BasicF1Help.cs | 2 +- .../AutoInsert/IXamlAutoInsertService.cs | 2 +- .../TypeRename/IXamlTypeRenameService.cs | 2 +- .../ILegacyGlobalOptionsWorkspaceService.cs | 18 +++++----- .../Portable/Telemetry/ITelemetryBlockLog.cs | 2 +- .../Core/Portable/Telemetry/ITelemetryLog.cs | 2 +- .../Telemetry/ITelemetryLogProvider.cs | 8 ++--- .../Workspace/Host/IWorkspaceTestLogger.cs | 2 +- .../ITemporaryStorageStreamHandle.cs | 2 +- .../ITemporaryStorageTextHandle.cs | 2 +- .../CoreTest/ObjectSerializationTests.cs | 6 +++- .../GlobalizationUtilities.cs | 1 - .../MSBuild/MSBuildProjectLoader.Worker.cs | 7 ++++ .../Core/MSBuild/MSBuildProjectLoader.cs | 3 ++ .../Core/EditorConfig/LanguageExtensions.cs | 1 - .../Compiler/Core/Options/Option2.cs | 2 +- .../Workspace/Mef/ILayeredServiceMetadata.cs | 6 ++-- 93 files changed, 177 insertions(+), 100 deletions(-) diff --git a/eng/targets/Settings.props b/eng/targets/Settings.props index 5e24a757660db..04a339c26fc61 100644 --- a/eng/targets/Settings.props +++ b/eng/targets/Settings.props @@ -15,7 +15,7 @@ $(NoWarn);VSIXCompatibility1001 - $(NoWarn);NU1507;NU1510 + $(NoWarn);NU1507 CommonExtensions Microsoft\VBCSharp\LanguageServices diff --git a/global.json b/global.json index 91ea801469cdc..e72c8a57d82a0 100644 --- a/global.json +++ b/global.json @@ -1,13 +1,13 @@ { "sdk": { - "version": "10.0.100-preview.5.25277.114", + "version": "9.0.106", "allowPrerelease": false, "rollForward": "patch" }, "tools": { - "dotnet": "10.0.100-preview.5.25277.114", + "dotnet": "9.0.106", "vs": { - "version": "17.14.0" + "version": "17.8.0" }, "vswhere": "3.1.7" }, diff --git a/src/Analyzers/Core/Analyzers/Helpers/HashCodeAnalyzer/HashCodeAnalyzer.cs b/src/Analyzers/Core/Analyzers/Helpers/HashCodeAnalyzer/HashCodeAnalyzer.cs index 165df53c233a8..4931395a53f80 100644 --- a/src/Analyzers/Core/Analyzers/Helpers/HashCodeAnalyzer/HashCodeAnalyzer.cs +++ b/src/Analyzers/Core/Analyzers/Helpers/HashCodeAnalyzer/HashCodeAnalyzer.cs @@ -16,15 +16,17 @@ namespace Microsoft.CodeAnalysis.Shared.Utilities; /// internal readonly partial struct HashCodeAnalyzer { + private readonly Compilation _compilation; private readonly IMethodSymbol _objectGetHashCodeMethod; private readonly INamedTypeSymbol? _equalityComparerType; public readonly INamedTypeSymbol SystemHashCodeType; private HashCodeAnalyzer( - IMethodSymbol objectGetHashCodeMethod, + Compilation compilation, IMethodSymbol objectGetHashCodeMethod, INamedTypeSymbol? equalityComparerType, INamedTypeSymbol systemHashCodeType) { + _compilation = compilation; _objectGetHashCodeMethod = objectGetHashCodeMethod; _equalityComparerType = equalityComparerType; SystemHashCodeType = systemHashCodeType; @@ -45,7 +47,7 @@ public static bool TryGetAnalyzer(Compilation compilation, [NotNullWhen(true)] o if (systemHashCodeType == null) return false; - analyzer = new HashCodeAnalyzer(objectGetHashCodeMethod, equalityComparerType, systemHashCodeType); + analyzer = new HashCodeAnalyzer(compilation, objectGetHashCodeMethod, equalityComparerType, systemHashCodeType); return true; } diff --git a/src/Compilers/.editorconfig b/src/Compilers/.editorconfig index 05f8a377cac7d..8882ce84e8ca5 100644 --- a/src/Compilers/.editorconfig +++ b/src/Compilers/.editorconfig @@ -12,9 +12,6 @@ dotnet_diagnostic.RS0100.severity = none # RS0102: Braces must not have blank lines between them dotnet_diagnostic.RS0102.severity = none -# IDE0051: Unused member -dotnet_diagnostic.IDE0051.severity = none - # IDE0170: Prefer extended property pattern dotnet_diagnostic.IDE0170.severity = suggestion diff --git a/src/Compilers/CSharp/Portable/Parser/LanguageParser_Patterns.cs b/src/Compilers/CSharp/Portable/Parser/LanguageParser_Patterns.cs index d351e40e201da..712ddc1633420 100644 --- a/src/Compilers/CSharp/Portable/Parser/LanguageParser_Patterns.cs +++ b/src/Compilers/CSharp/Portable/Parser/LanguageParser_Patterns.cs @@ -47,7 +47,7 @@ when ConvertExpressionToType(expr, out var leftType): default: type = null; return false; - } + }; } private PatternSyntax ParsePattern(Precedence precedence, bool afterIs = false, bool inSwitchArmPattern = false) diff --git a/src/Compilers/CSharp/Portable/Parser/Lexer_RawStringLiteral.cs b/src/Compilers/CSharp/Portable/Parser/Lexer_RawStringLiteral.cs index 9620d270bcac3..067f78a2e77d1 100644 --- a/src/Compilers/CSharp/Portable/Parser/Lexer_RawStringLiteral.cs +++ b/src/Compilers/CSharp/Portable/Parser/Lexer_RawStringLiteral.cs @@ -117,7 +117,7 @@ private void ScanRawStringLiteral(ref TokenInfo info, bool inDirective) default: throw ExceptionUtilities.UnexpectedValue(info.Kind); - } + }; } info.Text = TextWindow.GetText(intern: true); diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenOverridingAndHiding.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenOverridingAndHiding.cs index 5eb58c48d9361..5b7dedd7554d8 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenOverridingAndHiding.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenOverridingAndHiding.cs @@ -4126,7 +4126,7 @@ static void Main() if (isFromMetadata) { VerifyParamArrayAttribute(parameterB); - } + }; }; var verifier = CompileAndVerify(source, symbolValidator: validator(true), sourceSymbolValidator: validator(false), expectedOutput: @"System.Int32[]"); diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/WinMdDelegateTests.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/WinMdDelegateTests.cs index 992b62c248d58..f5a6b14470f75 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/WinMdDelegateTests.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/WinMdDelegateTests.cs @@ -41,7 +41,7 @@ public void SimpleDelegateMembersTest(string ob, string cb) GetMember("voidDelegate").GetMembers().ToArray(); AssertEx.SetEqual(actualMembers.Select(s => s.Name), expectedMembers); - } + }; }; VerifyType verify = (winmd, expected) => diff --git a/src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_IsByRefLike.cs b/src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_IsByRefLike.cs index 7b4cc1d64e6cc..3ffeb25f39ec7 100644 --- a/src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_IsByRefLike.cs +++ b/src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_IsByRefLike.cs @@ -683,7 +683,7 @@ void validate(ModuleSymbol module) AssertDeclaresType(peModule, WellKnownType.System_Runtime_CompilerServices_IsByRefLikeAttribute, Accessibility.Public); AssertHasCompilerFeatureRequired(includeCompilerFeatureRequired, peType, peModule, new MetadataDecoder(peModule)); } - } + }; CompileAndVerify(new[] { text, GetCompilerFeatureRequiredAttributeText(includeCompilerFeatureRequired) }, verify: Verification.Passes, symbolValidator: validate, sourceSymbolValidator: validate); } diff --git a/src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_WellKnownAttributes.cs b/src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_WellKnownAttributes.cs index f45aeb97b4f37..cb4ef10c97def 100644 --- a/src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_WellKnownAttributes.cs +++ b/src/Compilers/CSharp/Test/Emit3/Attributes/AttributeTests_WellKnownAttributes.cs @@ -5752,7 +5752,7 @@ void metadataValidator(ModuleSymbol module) Assert.Equal(new[] { "CompilerGeneratedAttribute" }, GetAttributeNames(method.GetAttributes())); Assert.True(method.RequiresSecurityObject); - } + }; var verifier = CompileAndVerify( source, diff --git a/src/Compilers/CSharp/Test/Emit3/OverloadResolutionPriorityTests.cs b/src/Compilers/CSharp/Test/Emit3/OverloadResolutionPriorityTests.cs index a6b6516bf8d82..987440c7778f6 100644 --- a/src/Compilers/CSharp/Test/Emit3/OverloadResolutionPriorityTests.cs +++ b/src/Compilers/CSharp/Test/Emit3/OverloadResolutionPriorityTests.cs @@ -69,7 +69,7 @@ static void validate(ModuleSymbol module) Assert.Equal(0, m.OverloadResolutionPriority); } } - } + }; } [Theory, CombinatorialData] diff --git a/src/Compilers/Core/Portable/EmbeddedText.cs b/src/Compilers/Core/Portable/EmbeddedText.cs index b4fc78dff9f2a..5495de2bf9d6d 100644 --- a/src/Compilers/Core/Portable/EmbeddedText.cs +++ b/src/Compilers/Core/Portable/EmbeddedText.cs @@ -370,7 +370,7 @@ public override void WriteByte(byte value) base.WriteByte(value); // same rationale for checked arithmetic as above. - checked { BytesWritten++; } + checked { BytesWritten++; }; } public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) diff --git a/src/Compilers/Core/Portable/MetadataReader/PEModule.cs b/src/Compilers/Core/Portable/MetadataReader/PEModule.cs index 4907ad63b37d0..afac6f99cded9 100644 --- a/src/Compilers/Core/Portable/MetadataReader/PEModule.cs +++ b/src/Compilers/Core/Portable/MetadataReader/PEModule.cs @@ -2338,6 +2338,19 @@ private static bool CrackBoolAndStringInAttributeValue(out BoolAndStringData val return false; } + private static bool CrackBoolAndBoolInAttributeValue(out (bool, bool) value, ref BlobReader sig) + { + if (CrackBooleanInAttributeValue(out bool item1, ref sig) && + CrackBooleanInAttributeValue(out bool item2, ref sig)) + { + value = (item1, item2); + return true; + } + + value = default; + return false; + } + private static bool CrackBooleanInAttributeValue(out bool value, ref BlobReader sig) { if (sig.RemainingBytes >= 1) diff --git a/src/EditorFeatures/CSharp/AutomaticCompletion/AutomaticLineEnderCommandHandler_Helpers.cs b/src/EditorFeatures/CSharp/AutomaticCompletion/AutomaticLineEnderCommandHandler_Helpers.cs index d6c5147307336..ff5ead2f7d417 100644 --- a/src/EditorFeatures/CSharp/AutomaticCompletion/AutomaticLineEnderCommandHandler_Helpers.cs +++ b/src/EditorFeatures/CSharp/AutomaticCompletion/AutomaticLineEnderCommandHandler_Helpers.cs @@ -835,6 +835,9 @@ private static bool ShouldRemoveBraceForEventDeclaration(EventDeclarationSyntax #region AddBrace + private static AccessorListSyntax GetAccessorListNode(SyntaxFormattingOptions formattingOptions) + => AccessorList().WithOpenBraceToken(GetOpenBrace(formattingOptions)).WithCloseBraceToken(GetCloseBrace(formattingOptions)); + private static InitializerExpressionSyntax GetInitializerExpressionNode(SyntaxFormattingOptions formattingOptions) => InitializerExpression(SyntaxKind.ObjectInitializerExpression) .WithOpenBraceToken(GetOpenBrace(formattingOptions)); diff --git a/src/EditorFeatures/CSharp/ConvertNamespace/ConvertNamespaceCommandHandler.cs b/src/EditorFeatures/CSharp/ConvertNamespace/ConvertNamespaceCommandHandler.cs index 7329634373bfe..76e1a337054ad 100644 --- a/src/EditorFeatures/CSharp/ConvertNamespace/ConvertNamespaceCommandHandler.cs +++ b/src/EditorFeatures/CSharp/ConvertNamespace/ConvertNamespaceCommandHandler.cs @@ -40,7 +40,8 @@ internal sealed class ConvertNamespaceCommandHandler( ITextUndoHistoryRegistry textUndoHistoryRegistry, IEditorOperationsFactoryService editorOperationsFactoryService, EditorOptionsService editorOptionsService, - IGlobalOptionService globalOptions) : IChainedCommandHandler + IGlobalOptionService globalOptions, + IIndentationManagerService indentationManager) : IChainedCommandHandler { /// /// Option setting 'use file scoped'. That way we can call into the helpers @@ -53,6 +54,7 @@ internal sealed class ConvertNamespaceCommandHandler( private readonly ITextUndoHistoryRegistry _textUndoHistoryRegistry = textUndoHistoryRegistry; private readonly IEditorOperationsFactoryService _editorOperationsFactoryService = editorOperationsFactoryService; private readonly EditorOptionsService _editorOptionsService = editorOptionsService; + private readonly IIndentationManagerService _indentationManager = indentationManager; private readonly IGlobalOptionService _globalOptions = globalOptions; public CommandState GetCommandState(TypeCharCommandArgs args, Func nextCommandHandler) diff --git a/src/EditorFeatures/CSharp/StringCopyPaste/StringCopyPasteCommandHandler.cs b/src/EditorFeatures/CSharp/StringCopyPaste/StringCopyPasteCommandHandler.cs index 779a2a87004f4..7b3064865775e 100644 --- a/src/EditorFeatures/CSharp/StringCopyPaste/StringCopyPasteCommandHandler.cs +++ b/src/EditorFeatures/CSharp/StringCopyPaste/StringCopyPasteCommandHandler.cs @@ -55,15 +55,19 @@ internal sealed partial class StringCopyPasteCommandHandler( IEditorOperationsFactoryService editorOperationsFactoryService, IGlobalOptionService globalOptions, ITextBufferFactoryService2 textBufferFactoryService, - EditorOptionsService editorOptionsService) : + EditorOptionsService editorOptionsService, + IIndentationManagerService indentationManager) : IChainedCommandHandler, IChainedCommandHandler, IChainedCommandHandler { + private const string CopyId = "RoslynStringCopyPasteId"; + private readonly IThreadingContext _threadingContext = threadingContext; private readonly ITextUndoHistoryRegistry _undoHistoryRegistry = undoHistoryRegistry; private readonly IEditorOperationsFactoryService _editorOperationsFactoryService = editorOperationsFactoryService; private readonly EditorOptionsService _editorOptionsService = editorOptionsService; + private readonly IIndentationManagerService _indentationManager = indentationManager; private readonly IGlobalOptionService _globalOptions = globalOptions; private readonly ITextBufferFactoryService2 _textBufferFactoryService = textBufferFactoryService; diff --git a/src/EditorFeatures/Core/Editor/IContainedDocument.cs b/src/EditorFeatures/Core/Editor/IContainedDocument.cs index bf3a5f81c50bb..5d6fc6c493560 100644 --- a/src/EditorFeatures/Core/Editor/IContainedDocument.cs +++ b/src/EditorFeatures/Core/Editor/IContainedDocument.cs @@ -10,5 +10,5 @@ namespace Microsoft.CodeAnalysis.Editor; internal interface IContainedDocument { - ITextSnapshot ApplyChanges(IEnumerable changes); + public ITextSnapshot ApplyChanges(IEnumerable changes); } diff --git a/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/AbstactVSTypeScriptLspServiceFactory.cs b/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/AbstactVSTypeScriptLspServiceFactory.cs index c53a8465281a5..1db0de0e33e8e 100644 --- a/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/AbstactVSTypeScriptLspServiceFactory.cs +++ b/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/Api/AbstactVSTypeScriptLspServiceFactory.cs @@ -5,7 +5,6 @@ using Microsoft.CodeAnalysis.LanguageServer; namespace Microsoft.CodeAnalysis.ExternalAccess.VSTypeScript.Api; - internal abstract class AbstractVSTypeScriptRequestHandlerFactory : ILspServiceFactory { public ILspService CreateILspService(LspServices lspServices, WellKnownLspServerKinds serverKind) diff --git a/src/EditorFeatures/Core/InlineRename/InlineRenameService.cs b/src/EditorFeatures/Core/InlineRename/InlineRenameService.cs index b76275c0d540e..112142313e2ae 100644 --- a/src/EditorFeatures/Core/InlineRename/InlineRenameService.cs +++ b/src/EditorFeatures/Core/InlineRename/InlineRenameService.cs @@ -35,12 +35,14 @@ internal sealed class InlineRenameService( ITextBufferCloneService textBufferCloneService, IFeatureServiceFactory featureServiceFactory, IGlobalOptionService globalOptions, + [ImportMany] IEnumerable refactorNotifyServices, IAsynchronousOperationListenerProvider listenerProvider) : IInlineRenameService { private readonly IThreadingContext _threadingContext = threadingContext; private readonly IUIThreadOperationExecutor _uiThreadOperationExecutor = uiThreadOperationExecutor; private readonly ITextBufferAssociatedViewService _textBufferAssociatedViewService = textBufferAssociatedViewService; private readonly IAsynchronousOperationListener _asyncListener = listenerProvider.GetListener(FeatureAttribute.Rename); + private readonly IEnumerable _refactorNotifyServices = refactorNotifyServices; private readonly ITextBufferFactoryService _textBufferFactoryService = textBufferFactoryService; private readonly ITextBufferCloneService _textBufferCloneService = textBufferCloneService; private readonly IFeatureServiceFactory _featureServiceFactory = featureServiceFactory; @@ -112,6 +114,7 @@ public async Task StartInlineSessionAsync( _textBufferFactoryService, _textBufferCloneService, _featureServiceFactory, + _refactorNotifyServices, _asyncListener); return new InlineRenameSessionInfo(ActiveSession); diff --git a/src/EditorFeatures/Core/InlineRename/InlineRenameSession.cs b/src/EditorFeatures/Core/InlineRename/InlineRenameSession.cs index 49f3e37b6dc96..8c1cdffb5808a 100644 --- a/src/EditorFeatures/Core/InlineRename/InlineRenameSession.cs +++ b/src/EditorFeatures/Core/InlineRename/InlineRenameSession.cs @@ -45,6 +45,7 @@ internal sealed partial class InlineRenameSession : IInlineRenameSession, IFeatu private readonly IFeatureService _featureService; private readonly IFeatureDisableToken _completionDisabledToken; + private readonly IEnumerable _refactorNotifyServices; private readonly IAsynchronousOperationListener _asyncListener; private readonly Solution _baseSolution; private readonly ITextView _triggerView; @@ -145,6 +146,7 @@ public InlineRenameSession( ITextBufferFactoryService textBufferFactoryService, ITextBufferCloneService textBufferCloneService, IFeatureServiceFactory featureServiceFactory, + IEnumerable refactorNotifyServices, IAsynchronousOperationListener asyncListener) { // This should always be touching a symbol since we verified that upon invocation @@ -175,6 +177,7 @@ public InlineRenameSession( _completionDisabledToken = _featureService.Disable(PredefinedEditorFeatureNames.Completion, this); RenameService = renameService; _uiThreadOperationExecutor = uiThreadOperationExecutor; + _refactorNotifyServices = refactorNotifyServices; _asyncListener = asyncListener; _triggerView = textBufferAssociatedViewService.GetAssociatedTextViews(triggerSpan.Snapshot.TextBuffer).FirstOrDefault(v => v.HasAggregateFocus) ?? textBufferAssociatedViewService.GetAssociatedTextViews(triggerSpan.Snapshot.TextBuffer).First(); diff --git a/src/EditorFeatures/Core/InlineRename/UI/IInlineRenameColorUpdater.cs b/src/EditorFeatures/Core/InlineRename/UI/IInlineRenameColorUpdater.cs index a273f76d84123..430b82840d08c 100644 --- a/src/EditorFeatures/Core/InlineRename/UI/IInlineRenameColorUpdater.cs +++ b/src/EditorFeatures/Core/InlineRename/UI/IInlineRenameColorUpdater.cs @@ -9,5 +9,5 @@ internal interface IInlineRenameColorUpdater /// /// Implemented by a host to set the properties on . /// - void UpdateColors(); + public void UpdateColors(); } diff --git a/src/EditorFeatures/Core/InlineRename/UI/SmartRename/SmartRenameViewModel.cs b/src/EditorFeatures/Core/InlineRename/UI/SmartRename/SmartRenameViewModel.cs index 92b5764debd1c..337c4373f3a2b 100644 --- a/src/EditorFeatures/Core/InlineRename/UI/SmartRename/SmartRenameViewModel.cs +++ b/src/EditorFeatures/Core/InlineRename/UI/SmartRename/SmartRenameViewModel.cs @@ -45,6 +45,7 @@ internal sealed partial class SmartRenameViewModel : INotifyPropertyChanged, IDi /// private CancellationTokenSource _cancellationTokenSource = new(); private bool _isDisposed; + private TimeSpan AutomaticFetchDelay => _smartRenameSession.AutomaticFetchDelay; private TimeSpan _semanticContextDelay; private bool _semanticContextError; private bool _semanticContextUsed; @@ -66,7 +67,7 @@ internal sealed partial class SmartRenameViewModel : INotifyPropertyChanged, IDi /// /// Indicates whether a request to get suggestions is in progress. - /// The request to get suggestions is comprised of initial short delay, see AutomaticFetchDelay + /// The request to get suggestions is comprised of initial short delay, /// and call to . /// When true, the UI shows the progress bar, and prevents from making parallel request. /// @@ -195,7 +196,7 @@ private void FetchSuggestions(bool isAutomaticOnInitialization) /// /// The request for rename suggestions. It's made of three parts: - /// 1. Short delay of duration AutomaticFetchDelay. + /// 1. Short delay of duration . /// 2. Get definition and references if is set. /// 3. Call to . /// diff --git a/src/EditorFeatures/Core/NavigableSymbols/NavigableSymbolService.cs b/src/EditorFeatures/Core/NavigableSymbols/NavigableSymbolService.cs index c8f83d84223ce..faea40e182b44 100644 --- a/src/EditorFeatures/Core/NavigableSymbols/NavigableSymbolService.cs +++ b/src/EditorFeatures/Core/NavigableSymbols/NavigableSymbolService.cs @@ -21,15 +21,18 @@ internal sealed partial class NavigableSymbolService : INavigableSymbolSourcePro { private static readonly object s_key = new(); + private readonly IUIThreadOperationExecutor _uiThreadOperationExecutor; private readonly IThreadingContext _threadingContext; private readonly IAsynchronousOperationListener _listener; [ImportingConstructor] [SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Used in test code: https://github.com/dotnet/roslyn/issues/42814")] public NavigableSymbolService( + IUIThreadOperationExecutor uiThreadOperationExecutor, IThreadingContext threadingContext, IAsynchronousOperationListenerProvider listenerProvider) { + _uiThreadOperationExecutor = uiThreadOperationExecutor; _threadingContext = threadingContext; _listener = listenerProvider.GetListener(FeatureAttribute.NavigableSymbols); } diff --git a/src/EditorFeatures/Core/Preview/IDifferenceViewerPreview.cs b/src/EditorFeatures/Core/Preview/IDifferenceViewerPreview.cs index 271e9073dfce7..082f6e540b9b4 100644 --- a/src/EditorFeatures/Core/Preview/IDifferenceViewerPreview.cs +++ b/src/EditorFeatures/Core/Preview/IDifferenceViewerPreview.cs @@ -10,5 +10,5 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.Preview; internal interface IDifferenceViewerPreview : IDisposable where TDifferenceViewer : IDifferenceViewer { - TDifferenceViewer Viewer { get; } + public TDifferenceViewer Viewer { get; } } diff --git a/src/EditorFeatures/Core/SplitComment/SplitCommentCommandHandler.cs b/src/EditorFeatures/Core/SplitComment/SplitCommentCommandHandler.cs index 8de344caa12a2..a255eabcd154f 100644 --- a/src/EditorFeatures/Core/SplitComment/SplitCommentCommandHandler.cs +++ b/src/EditorFeatures/Core/SplitComment/SplitCommentCommandHandler.cs @@ -33,11 +33,13 @@ internal sealed class SplitCommentCommandHandler( ITextUndoHistoryRegistry undoHistoryRegistry, IEditorOperationsFactoryService editorOperationsFactoryService, EditorOptionsService editorOptionsService, + IIndentationManagerService indentationManager, IGlobalOptionService globalOptions) : ICommandHandler { private readonly ITextUndoHistoryRegistry _undoHistoryRegistry = undoHistoryRegistry; private readonly IEditorOperationsFactoryService _editorOperationsFactoryService = editorOperationsFactoryService; private readonly EditorOptionsService _editorOptionsService = editorOptionsService; + private readonly IIndentationManagerService _indentationManager = indentationManager; private readonly IGlobalOptionService _globalOptions = globalOptions; public string DisplayName => EditorFeaturesResources.Split_comment; diff --git a/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.TagSource.cs b/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.TagSource.cs index 6c929302293d1..1996dc21919fe 100644 --- a/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.TagSource.cs +++ b/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.TagSource.cs @@ -55,6 +55,11 @@ private sealed partial class TagSource private readonly AbstractAsynchronousTaggerProvider _dataSource; + /// + /// Information about what workspace the buffer we're tagging is associated with. + /// + private readonly WorkspaceRegistration _workspaceRegistration; + /// /// Work queue that collects high priority requests to call TagsChanged with. /// diff --git a/src/EditorFeatures/Test2/NavigableSymbols/NavigableSymbolsTest.vb b/src/EditorFeatures/Test2/NavigableSymbols/NavigableSymbolsTest.vb index 48a245cdab61a..8ab47c5c34f02 100644 --- a/src/EditorFeatures/Test2/NavigableSymbols/NavigableSymbolsTest.vb +++ b/src/EditorFeatures/Test2/NavigableSymbols/NavigableSymbolsTest.vb @@ -111,7 +111,7 @@ End Class" Private Shared Function ExtractSymbol(workspace As EditorTestWorkspace, position As Integer) As Task(Of INavigableSymbol) Dim threadingContext = workspace.ExportProvider.GetExportedValue(Of IThreadingContext)() Dim listenerProvider = workspace.ExportProvider.GetExportedValue(Of IAsynchronousOperationListenerProvider) - Dim service = New NavigableSymbolService(threadingContext, listenerProvider) + Dim service = New NavigableSymbolService(workspace.ExportProvider.GetExportedValue(Of IUIThreadOperationExecutor)(), threadingContext, listenerProvider) Dim view = workspace.Documents.First().GetTextView() Dim buffer = workspace.Documents.First().GetTextBuffer() Dim triggerSpan = New SnapshotSpan(buffer.CurrentSnapshot, New Span(position, 0)) diff --git a/src/EditorFeatures/TestUtilities/Threading/WpfTestRunner.cs b/src/EditorFeatures/TestUtilities/Threading/WpfTestRunner.cs index 4fa53567819e3..c35a58937b097 100644 --- a/src/EditorFeatures/TestUtilities/Threading/WpfTestRunner.cs +++ b/src/EditorFeatures/TestUtilities/Threading/WpfTestRunner.cs @@ -29,9 +29,7 @@ namespace Roslyn.Test.Utilities; /// public sealed class WpfTestRunner : XunitTestRunner { -#pragma warning disable IDE0052 // Remove unread private members. Can be used for debugging purposes. private static string s_wpfFactRequirementReason; -#pragma warning restore IDE0052 // Remove unread private members public WpfTestSharedData SharedData { get; } diff --git a/src/EditorFeatures/TestUtilities/Workspaces/EditorTestHostDocument.cs b/src/EditorFeatures/TestUtilities/Workspaces/EditorTestHostDocument.cs index 6a8176af05d9d..65e8775e6edf3 100644 --- a/src/EditorFeatures/TestUtilities/Workspaces/EditorTestHostDocument.cs +++ b/src/EditorFeatures/TestUtilities/Workspaces/EditorTestHostDocument.cs @@ -198,6 +198,13 @@ public override void Open() public SourceTextContainer GetOpenTextContainer() => this.GetTextBuffer().AsTextContainer(); + private void Update(string newText) + { + using var edit = this.GetTextBuffer().CreateEdit(EditOptions.DefaultMinimalChange, reiteratedVersionNumber: null, editTag: null); + edit.Replace(new Span(0, this.GetTextBuffer().CurrentSnapshot.Length), newText); + edit.Apply(); + } + internal void CloseTextView() { if (_textView != null && !_textView.IsClosed) diff --git a/src/Features/CSharp/Portable/Completion/CompletionProviders/PartialTypeCompletionProvider.cs b/src/Features/CSharp/Portable/Completion/CompletionProviders/PartialTypeCompletionProvider.cs index 94eaf8b64b4a4..f6caf18cf30ea 100644 --- a/src/Features/CSharp/Portable/Completion/CompletionProviders/PartialTypeCompletionProvider.cs +++ b/src/Features/CSharp/Portable/Completion/CompletionProviders/PartialTypeCompletionProvider.cs @@ -37,6 +37,9 @@ internal sealed partial class PartialTypeCompletionProvider : AbstractPartialTyp SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers | SymbolDisplayMiscellaneousOptions.UseSpecialTypes); + private static readonly SymbolDisplayFormat _symbolFormatWithoutGenerics = + _symbolFormatWithGenerics.WithGenericsOptions(SymbolDisplayGenericsOptions.None); + [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public PartialTypeCompletionProvider() diff --git a/src/Features/CSharp/Portable/Debugging/CSharpProximityExpressionsService.cs b/src/Features/CSharp/Portable/Debugging/CSharpProximityExpressionsService.cs index 505fec53af9e3..9f5f41d83e345 100644 --- a/src/Features/CSharp/Portable/Debugging/CSharpProximityExpressionsService.cs +++ b/src/Features/CSharp/Portable/Debugging/CSharpProximityExpressionsService.cs @@ -103,6 +103,10 @@ public async Task> GetProximityExpressionsAsync( public static IList GetProximityExpressions(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) => new Worker(syntaxTree, position).Do(cancellationToken); + [Obsolete($"Use {nameof(GetProximityExpressions)}.")] + private static IList Do(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) + => new Worker(syntaxTree, position).Do(cancellationToken); + private static void AddRelevantExpressions( StatementSyntax statement, IList expressions, diff --git a/src/Features/CSharp/Portable/ExternalAccess/Pythia/Api/IPythiaDeclarationNameRecommenderImplmentation.cs b/src/Features/CSharp/Portable/ExternalAccess/Pythia/Api/IPythiaDeclarationNameRecommenderImplmentation.cs index 9c592520a7c37..98f0f1cce3601 100644 --- a/src/Features/CSharp/Portable/ExternalAccess/Pythia/Api/IPythiaDeclarationNameRecommenderImplmentation.cs +++ b/src/Features/CSharp/Portable/ExternalAccess/Pythia/Api/IPythiaDeclarationNameRecommenderImplmentation.cs @@ -14,7 +14,7 @@ internal interface IPythiaDeclarationNameRecommenderImplementation /// /// Order of returned recommendation decides the order of those items in completion list /// - Task> ProvideRecommendationsAsync(PythiaDeclarationNameContext context, CancellationToken cancellationToken); + public Task> ProvideRecommendationsAsync(PythiaDeclarationNameContext context, CancellationToken cancellationToken); } internal readonly struct PythiaDeclarationNameContext(CSharpSyntaxContext context) diff --git a/src/Features/CSharp/Portable/InitializeParameter/CSharpInitializeMemberFromParameterCodeRefactoringProvider.cs b/src/Features/CSharp/Portable/InitializeParameter/CSharpInitializeMemberFromParameterCodeRefactoringProvider.cs index 6fb0669b07437..cb4955e25a9fd 100644 --- a/src/Features/CSharp/Portable/InitializeParameter/CSharpInitializeMemberFromParameterCodeRefactoringProvider.cs +++ b/src/Features/CSharp/Portable/InitializeParameter/CSharpInitializeMemberFromParameterCodeRefactoringProvider.cs @@ -9,7 +9,6 @@ using Microsoft.CodeAnalysis.InitializeParameter; namespace Microsoft.CodeAnalysis.CSharp.InitializeParameter; - [ExportCodeRefactoringProvider(LanguageNames.CSharp, Name = PredefinedCodeRefactoringProviderNames.InitializeMemberFromParameter), Shared] [ExtensionOrder(Before = nameof(CSharpAddParameterCheckCodeRefactoringProvider))] [ExtensionOrder(Before = PredefinedCodeRefactoringProviderNames.Wrapping)] diff --git a/src/Features/Core/Portable/DesignerAttribute/IDesignerAttributeDiscoveryService.cs b/src/Features/Core/Portable/DesignerAttribute/IDesignerAttributeDiscoveryService.cs index 58ff3949d9e0d..4bb68520a5e95 100644 --- a/src/Features/Core/Portable/DesignerAttribute/IDesignerAttributeDiscoveryService.cs +++ b/src/Features/Core/Portable/DesignerAttribute/IDesignerAttributeDiscoveryService.cs @@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.DesignerAttribute; internal partial interface IDesignerAttributeDiscoveryService : IWorkspaceService { - interface ICallback + public interface ICallback { ValueTask ReportDesignerAttributeDataAsync(ImmutableArray data, CancellationToken cancellationToken); } diff --git a/src/Features/Core/Portable/InheritanceMargin/AbstractInheritanceMarginService.cs b/src/Features/Core/Portable/InheritanceMargin/AbstractInheritanceMarginService.cs index b305684aa8128..b203e0c5db249 100644 --- a/src/Features/Core/Portable/InheritanceMargin/AbstractInheritanceMarginService.cs +++ b/src/Features/Core/Portable/InheritanceMargin/AbstractInheritanceMarginService.cs @@ -10,7 +10,6 @@ using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.InheritanceMargin; - internal abstract partial class AbstractInheritanceMarginService : IInheritanceMarginService { /// diff --git a/src/Features/Core/Portable/InitializeParameter/AbstractInitializeParameterCodeRefactoringProvider.cs b/src/Features/Core/Portable/InitializeParameter/AbstractInitializeParameterCodeRefactoringProvider.cs index 5aca841f9d528..db0c1cebd3b5b 100644 --- a/src/Features/Core/Portable/InitializeParameter/AbstractInitializeParameterCodeRefactoringProvider.cs +++ b/src/Features/Core/Portable/InitializeParameter/AbstractInitializeParameterCodeRefactoringProvider.cs @@ -18,7 +18,6 @@ using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.InitializeParameter; - internal abstract partial class AbstractInitializeParameterCodeRefactoringProvider< TTypeDeclarationSyntax, TParameterSyntax, diff --git a/src/Features/Core/Portable/Intents/IIntentProviderMetadata.cs b/src/Features/Core/Portable/Intents/IIntentProviderMetadata.cs index 45be8e946df21..9a62d58225514 100644 --- a/src/Features/Core/Portable/Intents/IIntentProviderMetadata.cs +++ b/src/Features/Core/Portable/Intents/IIntentProviderMetadata.cs @@ -6,6 +6,6 @@ namespace Microsoft.CodeAnalysis.Features.Intents; internal interface IIntentProviderMetadata { - string IntentName { get; } - string LanguageName { get; } + public string IntentName { get; } + public string LanguageName { get; } } diff --git a/src/Features/Core/Portable/MetadataAsSource/MetadataAsSourceFileService.cs b/src/Features/Core/Portable/MetadataAsSource/MetadataAsSourceFileService.cs index c741b9f3745aa..e21821dd8852a 100644 --- a/src/Features/Core/Portable/MetadataAsSource/MetadataAsSourceFileService.cs +++ b/src/Features/Core/Portable/MetadataAsSource/MetadataAsSourceFileService.cs @@ -47,9 +47,7 @@ internal sealed class MetadataAsSourceFileService : IMetadataAsSourceFileService /// We create a mutex so other processes can see if our directory is still alive. As long as we own the mutex, no /// other VS instance will try to delete our _rootTemporaryPathWithGuid folder. /// -#pragma warning disable IDE0052 // Remove unread private members. Used to communicate with other VS instances. private readonly Mutex _mutex; -#pragma warning restore IDE0052 // Remove unread private members private readonly string _rootTemporaryPathWithGuid; private readonly string _rootTemporaryPath = Path.Combine(Path.GetTempPath(), MetadataAsSource); diff --git a/src/Features/Core/Portable/NavigateTo/IRemoteNavigateToSearchService.cs b/src/Features/Core/Portable/NavigateTo/IRemoteNavigateToSearchService.cs index b135fc895a199..2b1d14b7578a3 100644 --- a/src/Features/Core/Portable/NavigateTo/IRemoteNavigateToSearchService.cs +++ b/src/Features/Core/Portable/NavigateTo/IRemoteNavigateToSearchService.cs @@ -25,7 +25,7 @@ internal interface IRemoteNavigateToSearchService ValueTask HydrateAsync(Checksum solutionChecksum, CancellationToken cancellationToken); - interface ICallback + public interface ICallback { ValueTask OnItemsFoundAsync(RemoteServiceCallbackId callbackId, ImmutableArray items); ValueTask OnProjectCompletedAsync(RemoteServiceCallbackId callbackId); diff --git a/src/Features/Core/Portable/Navigation/INavigableItem.cs b/src/Features/Core/Portable/Navigation/INavigableItem.cs index 400ce104d8afd..e27b14d99846f 100644 --- a/src/Features/Core/Portable/Navigation/INavigableItem.cs +++ b/src/Features/Core/Portable/Navigation/INavigableItem.cs @@ -48,7 +48,7 @@ internal interface INavigableItem ImmutableArray ChildItems { get; } - sealed record NavigableDocument(NavigableProject Project, string Name, string? FilePath, IReadOnlyList Folders, DocumentId Id, SourceGeneratedDocumentIdentity? SourceGeneratedDocumentIdentity, Workspace? Workspace) + public sealed record NavigableDocument(NavigableProject Project, string Name, string? FilePath, IReadOnlyList Folders, DocumentId Id, SourceGeneratedDocumentIdentity? SourceGeneratedDocumentIdentity, Workspace? Workspace) { public static NavigableDocument FromDocument(Document document) => new( @@ -87,7 +87,7 @@ internal async ValueTask GetTextAsync(Solution solution, Cancellatio } } - record struct NavigableProject(string Name, ProjectId Id) + public record struct NavigableProject(string Name, ProjectId Id) { public static NavigableProject FromProject(Project project) => new(project.Name, project.Id); diff --git a/src/Features/Core/Portable/Options/EditorConfig/IEditorConfigOptionsEnumerator.cs b/src/Features/Core/Portable/Options/EditorConfig/IEditorConfigOptionsEnumerator.cs index 562c07ffc4920..f2689a2ce5971 100644 --- a/src/Features/Core/Portable/Options/EditorConfig/IEditorConfigOptionsEnumerator.cs +++ b/src/Features/Core/Portable/Options/EditorConfig/IEditorConfigOptionsEnumerator.cs @@ -13,5 +13,5 @@ internal interface IEditorConfigOptionsEnumerator /// Returns all editorconfig options defined by the implementing language, grouped by feature. /// /// True to include undocumented options that the user can set in editorconfig file but we provide no support for them. - IEnumerable<(string feature, ImmutableArray options)> GetOptions(bool includeUnsupported); + public abstract IEnumerable<(string feature, ImmutableArray options)> GetOptions(bool includeUnsupported); } diff --git a/src/Features/Core/Portable/Snippets/SnippetFunctionService.cs b/src/Features/Core/Portable/Snippets/SnippetFunctionService.cs index 05b25558232b3..eae43c8abd010 100644 --- a/src/Features/Core/Portable/Snippets/SnippetFunctionService.cs +++ b/src/Features/Core/Portable/Snippets/SnippetFunctionService.cs @@ -14,7 +14,6 @@ using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis; - internal abstract class SnippetFunctionService : ILanguageService { /// diff --git a/src/Features/Core/Portable/Snippets/SnippetUtilities.cs b/src/Features/Core/Portable/Snippets/SnippetUtilities.cs index 1227a28808ac4..c8f9105313e1a 100644 --- a/src/Features/Core/Portable/Snippets/SnippetUtilities.cs +++ b/src/Features/Core/Portable/Snippets/SnippetUtilities.cs @@ -7,7 +7,6 @@ using System.Diagnostics.CodeAnalysis; namespace Microsoft.CodeAnalysis; - internal sealed class SnippetUtilities { public static bool TryGetWordOnLeft(int position, SourceText currentText, ISyntaxFactsService syntaxFactsService, [NotNullWhen(true)] out TextSpan? wordSpan) diff --git a/src/Features/Core/Portable/SymbolSearch/Windows/IFileDownloaderFactory.cs b/src/Features/Core/Portable/SymbolSearch/Windows/IFileDownloaderFactory.cs index b6a97f3c5d0b5..988909b50fa4c 100644 --- a/src/Features/Core/Portable/SymbolSearch/Windows/IFileDownloaderFactory.cs +++ b/src/Features/Core/Portable/SymbolSearch/Windows/IFileDownloaderFactory.cs @@ -18,5 +18,5 @@ internal interface IFileDownloaderFactory internal interface IFileDownloader : IDisposable { - Task ReadFileAsync(); + public Task ReadFileAsync(); } diff --git a/src/Features/Core/Portable/Testing/TestFrameworks/ITestFrameworkMetadata.cs b/src/Features/Core/Portable/Testing/TestFrameworks/ITestFrameworkMetadata.cs index 2e9e85cebe490..7b301c7cd5971 100644 --- a/src/Features/Core/Portable/Testing/TestFrameworks/ITestFrameworkMetadata.cs +++ b/src/Features/Core/Portable/Testing/TestFrameworks/ITestFrameworkMetadata.cs @@ -9,5 +9,5 @@ internal interface ITestFrameworkMetadata /// /// Determines if the input attribute token name matches known test method attribute names. /// - bool MatchesAttributeSyntacticName(string attributeSyntacticName); + public bool MatchesAttributeSyntacticName(string attributeSyntacticName); } diff --git a/src/Features/Lsif/Generator/Graph/Id.cs b/src/Features/Lsif/Generator/Graph/Id.cs index 6dcd81e87e58b..1eaeb1909e4eb 100644 --- a/src/Features/Lsif/Generator/Graph/Id.cs +++ b/src/Features/Lsif/Generator/Graph/Id.cs @@ -13,7 +13,7 @@ namespace Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.Graph; internal interface ISerializableId { - int NumericId { get; } + public int NumericId { get; } } internal static class IdExtensions diff --git a/src/Features/VisualBasic/Portable/Completion/CompletionProviders/CrefCompletionProvider.vb b/src/Features/VisualBasic/Portable/Completion/CompletionProviders/CrefCompletionProvider.vb index ec804e5f5fc05..8734d2fae1426 100644 --- a/src/Features/VisualBasic/Portable/Completion/CompletionProviders/CrefCompletionProvider.vb +++ b/src/Features/VisualBasic/Portable/Completion/CompletionProviders/CrefCompletionProvider.vb @@ -261,6 +261,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers End Function Private Shared ReadOnly s_WithoutOpenParen As CharacterSetModificationRule = CharacterSetModificationRule.Create(CharacterSetModificationKind.Remove, "("c) + Private Shared ReadOnly s_WithoutSpace As CharacterSetModificationRule = CharacterSetModificationRule.Create(CharacterSetModificationKind.Remove, " "c) Private Shared ReadOnly s_defaultRules As CompletionItemRules = CompletionItemRules.Default diff --git a/src/Features/VisualBasic/Portable/Completion/CompletionProviders/EnumCompletionProvider.vb b/src/Features/VisualBasic/Portable/Completion/CompletionProviders/EnumCompletionProvider.vb index fbdd93ecd0aab..ba05e293c4fb3 100644 --- a/src/Features/VisualBasic/Portable/Completion/CompletionProviders/EnumCompletionProvider.vb +++ b/src/Features/VisualBasic/Portable/Completion/CompletionProviders/EnumCompletionProvider.vb @@ -87,6 +87,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers Public Overrides ReadOnly Property TriggerCharacters As ImmutableHashSet(Of Char) = ImmutableHashSet.Create(" "c, "("c, "="c) + Private Shared Function GetTypeFromSymbol(symbol As ISymbol) As ITypeSymbol + Dim symbolType = If(TryCast(symbol, IFieldSymbol)?.Type, + If(TryCast(symbol, ILocalSymbol)?.Type, + If(TryCast(symbol, IParameterSymbol)?.Type, + TryCast(symbol, IPropertySymbol)?.Type))) + Return symbolType + End Function + ' PERF: Cached values for GetDisplayAndInsertionText. Cuts down on the number of calls to ToMinimalDisplayString for large enums. Private ReadOnly _gate As New Object() Private _cachedDisplayAndInsertionTextContainingType As INamedTypeSymbol diff --git a/src/Features/VisualBasic/Portable/Completion/CompletionProviders/NamedParameterCompletionProvider.vb b/src/Features/VisualBasic/Portable/Completion/CompletionProviders/NamedParameterCompletionProvider.vb index 5b74294f3beba..2ffacc9fe1727 100644 --- a/src/Features/VisualBasic/Portable/Completion/CompletionProviders/NamedParameterCompletionProvider.vb +++ b/src/Features/VisualBasic/Portable/Completion/CompletionProviders/NamedParameterCompletionProvider.vb @@ -195,6 +195,39 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Completion.Providers Return Nothing End Function + Private Shared Sub GetInvocableNode(token As SyntaxToken, ByRef invocableNode As SyntaxNode, ByRef argumentList As ArgumentListSyntax) + Dim current = token.Parent + + While current IsNot Nothing + If TypeOf current Is AttributeSyntax Then + invocableNode = current + argumentList = (DirectCast(current, AttributeSyntax)).ArgumentList + Return + End If + + If TypeOf current Is InvocationExpressionSyntax Then + invocableNode = current + argumentList = (DirectCast(current, InvocationExpressionSyntax)).ArgumentList + Return + End If + + If TypeOf current Is ObjectCreationExpressionSyntax Then + invocableNode = current + argumentList = (DirectCast(current, ObjectCreationExpressionSyntax)).ArgumentList + Return + End If + + If TypeOf current Is TypeArgumentListSyntax Then + Exit While + End If + + current = current.Parent + End While + + invocableNode = Nothing + argumentList = Nothing + End Sub + Protected Overrides Function GetTextChangeAsync(selectedItem As CompletionItem, ch As Char?, cancellationToken As CancellationToken) As Task(Of TextChange?) Dim symbolItem = selectedItem Dim insertionText = SymbolCompletionItem.GetInsertionText(selectedItem) diff --git a/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/BrokeredServiceContainer.cs b/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/BrokeredServiceContainer.cs index 088d183bc6701..e1eafc7a08326 100644 --- a/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/BrokeredServiceContainer.cs +++ b/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/BrokeredServices/BrokeredServiceContainer.cs @@ -12,7 +12,6 @@ using Microsoft.VisualStudio.Utilities.ServiceBroker; namespace Microsoft.CodeAnalysis.LanguageServer.BrokeredServices; - internal sealed class BrokeredServiceContainer : GlobalBrokeredServiceContainer { public BrokeredServiceContainer(TraceSource traceSource) diff --git a/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/ProjectDependencyHelper.cs b/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/ProjectDependencyHelper.cs index aa88faf77a0c3..8d229e510681b 100644 --- a/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/ProjectDependencyHelper.cs +++ b/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/ProjectDependencyHelper.cs @@ -13,7 +13,6 @@ using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer.HostWorkspace; - internal static class ProjectDependencyHelper { internal const string ProjectNeedsRestoreName = "workspace/_roslyn_projectNeedsRestore"; diff --git a/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/LspLogMessageLoggerProvider.cs b/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/LspLogMessageLoggerProvider.cs index 4961b162a56f9..45e1524a510de 100644 --- a/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/LspLogMessageLoggerProvider.cs +++ b/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Logging/LspLogMessageLoggerProvider.cs @@ -6,7 +6,6 @@ using Microsoft.Extensions.Logging; namespace Microsoft.CodeAnalysis.LanguageServer.Logging; - internal sealed class LspLogMessageLoggerProvider(ILoggerFactory fallbackLoggerFactory, ServerConfiguration serverConfiguration) : ILoggerProvider, ISupportExternalScope { private readonly ConcurrentDictionary _loggers = new(StringComparer.OrdinalIgnoreCase); diff --git a/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Services/StarredCompletions/StarredCompletionsAssemblyHelper.cs b/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Services/StarredCompletions/StarredCompletionsAssemblyHelper.cs index d535fbfade194..9702b71d27f11 100644 --- a/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Services/StarredCompletions/StarredCompletionsAssemblyHelper.cs +++ b/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Services/StarredCompletions/StarredCompletionsAssemblyHelper.cs @@ -11,7 +11,6 @@ using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.LanguageServer.StarredSuggestions; - internal static class StarredCompletionAssemblyHelper { private const string CompletionsDllName = "Microsoft.VisualStudio.IntelliCode.CSharp.dll"; diff --git a/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/AbstractRequestScope.cs b/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/AbstractRequestScope.cs index cba82de331629..a676aca30b044 100644 --- a/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/AbstractRequestScope.cs +++ b/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/AbstractRequestScope.cs @@ -8,7 +8,6 @@ using System; namespace Microsoft.CommonLanguageServerProtocol.Framework; - internal abstract class AbstractRequestScope(string name) : IDisposable { public string Name { get; } = name; diff --git a/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/IRequestHandler.cs b/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/IRequestHandler.cs index d6513086a1ac1..7d58b68427183 100644 --- a/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/IRequestHandler.cs +++ b/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/IRequestHandler.cs @@ -9,7 +9,6 @@ using System.Threading.Tasks; namespace Microsoft.CommonLanguageServerProtocol.Framework; - internal interface IRequestHandler : IMethodHandler { /// diff --git a/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/RequestShutdownEventArgs.cs b/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/RequestShutdownEventArgs.cs index 14a0e1e11fdcf..2351cf23539f9 100644 --- a/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/RequestShutdownEventArgs.cs +++ b/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/RequestShutdownEventArgs.cs @@ -8,7 +8,6 @@ using System; namespace Microsoft.CommonLanguageServerProtocol.Framework; - internal sealed class RequestShutdownEventArgs : EventArgs { public string Message { get; } diff --git a/src/LanguageServer/Protocol/Features/Diagnostics/DiagnosticDataExtensions.cs b/src/LanguageServer/Protocol/Features/Diagnostics/DiagnosticDataExtensions.cs index 6dbe43e5d9d0b..668de389af191 100644 --- a/src/LanguageServer/Protocol/Features/Diagnostics/DiagnosticDataExtensions.cs +++ b/src/LanguageServer/Protocol/Features/Diagnostics/DiagnosticDataExtensions.cs @@ -13,7 +13,6 @@ using System.Diagnostics.CodeAnalysis; namespace Microsoft.CodeAnalysis.LanguageServer.Features.Diagnostics; - internal static class DiagnosticDataExtensions { internal static bool TryGetUnnecessaryDataLocations(this DiagnosticData diagnosticData, [NotNullWhen(true)] out ImmutableArray? unnecessaryLocations) diff --git a/src/LanguageServer/Protocol/Protocol/Converters/SumConverter.cs b/src/LanguageServer/Protocol/Protocol/Converters/SumConverter.cs index 8c766764a6fbe..8e3089cc915c3 100644 --- a/src/LanguageServer/Protocol/Protocol/Converters/SumConverter.cs +++ b/src/LanguageServer/Protocol/Protocol/Converters/SumConverter.cs @@ -13,7 +13,6 @@ using Microsoft.CodeAnalysis.LanguageServer; namespace Roslyn.LanguageServer.Protocol; - internal sealed class SumConverter : JsonConverterFactory { public override bool CanConvert(Type typeToConvert) diff --git a/src/LanguageServer/Protocol/Protocol/Converters/TextDocumentSyncConverter.cs b/src/LanguageServer/Protocol/Protocol/Converters/TextDocumentSyncConverter.cs index 8fcd7928086dc..e09da17edc1b6 100644 --- a/src/LanguageServer/Protocol/Protocol/Converters/TextDocumentSyncConverter.cs +++ b/src/LanguageServer/Protocol/Protocol/Converters/TextDocumentSyncConverter.cs @@ -9,7 +9,6 @@ using Microsoft.CodeAnalysis.LanguageServer; namespace Roslyn.LanguageServer.Protocol; - internal sealed class TextDocumentSyncConverter : JsonConverter { public override TextDocumentSyncOptions Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) diff --git a/src/LanguageServer/Protocol/Protocol/Internal/Converters/ClassifiedTextElementConverter.cs b/src/LanguageServer/Protocol/Protocol/Internal/Converters/ClassifiedTextElementConverter.cs index 24a18c9b1d1d2..12ad171c556f5 100644 --- a/src/LanguageServer/Protocol/Protocol/Internal/Converters/ClassifiedTextElementConverter.cs +++ b/src/LanguageServer/Protocol/Protocol/Internal/Converters/ClassifiedTextElementConverter.cs @@ -9,7 +9,6 @@ using Roslyn.Text.Adornments; namespace Roslyn.LanguageServer.Protocol; - internal sealed class ClassifiedTextElementConverter : JsonConverter { public static readonly ClassifiedTextElementConverter Instance = new(); diff --git a/src/LanguageServer/Protocol/Protocol/Internal/Converters/ClassifiedTextRunConverter.cs b/src/LanguageServer/Protocol/Protocol/Internal/Converters/ClassifiedTextRunConverter.cs index 29c4ce255bddf..33d033ae1c029 100644 --- a/src/LanguageServer/Protocol/Protocol/Internal/Converters/ClassifiedTextRunConverter.cs +++ b/src/LanguageServer/Protocol/Protocol/Internal/Converters/ClassifiedTextRunConverter.cs @@ -8,7 +8,6 @@ using Roslyn.Text.Adornments; namespace Roslyn.LanguageServer.Protocol; - internal sealed class ClassifiedTextRunConverter : JsonConverter { public static readonly ClassifiedTextRunConverter Instance = new(); diff --git a/src/LanguageServer/Protocol/Protocol/WorkspaceDiagnosticReport.cs b/src/LanguageServer/Protocol/Protocol/WorkspaceDiagnosticReport.cs index 67ab89ae95ae6..27ba0b8d988a5 100644 --- a/src/LanguageServer/Protocol/Protocol/WorkspaceDiagnosticReport.cs +++ b/src/LanguageServer/Protocol/Protocol/WorkspaceDiagnosticReport.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. namespace Roslyn.LanguageServer.Protocol; - using System.Text.Json.Serialization; /// diff --git a/src/LanguageServer/Protocol/Protocol/WorkspaceDiagnosticReportPartialResult.cs b/src/LanguageServer/Protocol/Protocol/WorkspaceDiagnosticReportPartialResult.cs index 64190a9850cc1..49e3baa1bfe3f 100644 --- a/src/LanguageServer/Protocol/Protocol/WorkspaceDiagnosticReportPartialResult.cs +++ b/src/LanguageServer/Protocol/Protocol/WorkspaceDiagnosticReportPartialResult.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. namespace Roslyn.LanguageServer.Protocol; - using System.Text.Json.Serialization; /// diff --git a/src/LanguageServer/ProtocolUnitTests/Commands/ExecuteWorkspaceCommandTests.cs b/src/LanguageServer/ProtocolUnitTests/Commands/ExecuteWorkspaceCommandTests.cs index 334d7431bde2d..7dc1146708bee 100644 --- a/src/LanguageServer/ProtocolUnitTests/Commands/ExecuteWorkspaceCommandTests.cs +++ b/src/LanguageServer/ProtocolUnitTests/Commands/ExecuteWorkspaceCommandTests.cs @@ -18,7 +18,6 @@ using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Commands; - public sealed class ExecuteWorkspaceCommandTests : AbstractLanguageServerProtocolTests { protected override TestComposition Composition => base.Composition.AddParts( diff --git a/src/LanguageServer/ProtocolUnitTests/Diagnostics/AdditionalFileDiagnosticsTests.cs b/src/LanguageServer/ProtocolUnitTests/Diagnostics/AdditionalFileDiagnosticsTests.cs index d2046ea53e4c0..cd4ebfc7a2f03 100644 --- a/src/LanguageServer/ProtocolUnitTests/Diagnostics/AdditionalFileDiagnosticsTests.cs +++ b/src/LanguageServer/ProtocolUnitTests/Diagnostics/AdditionalFileDiagnosticsTests.cs @@ -15,7 +15,6 @@ using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Diagnostics; - public sealed class AdditionalFileDiagnosticsTests : AbstractPullDiagnosticTestsBase { public AdditionalFileDiagnosticsTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) diff --git a/src/LanguageServer/ProtocolUnitTests/Diagnostics/DiagnosticsPullCacheTests.cs b/src/LanguageServer/ProtocolUnitTests/Diagnostics/DiagnosticsPullCacheTests.cs index 1017a75137049..c643aa923d554 100644 --- a/src/LanguageServer/ProtocolUnitTests/Diagnostics/DiagnosticsPullCacheTests.cs +++ b/src/LanguageServer/ProtocolUnitTests/Diagnostics/DiagnosticsPullCacheTests.cs @@ -19,7 +19,6 @@ using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Diagnostics; - public sealed class DiagnosticsPullCacheTests(ITestOutputHelper testOutputHelper) : AbstractPullDiagnosticTestsBase(testOutputHelper) { diff --git a/src/LanguageServer/ProtocolUnitTests/Diagnostics/WorkspaceProjectDiagnosticsTests.cs b/src/LanguageServer/ProtocolUnitTests/Diagnostics/WorkspaceProjectDiagnosticsTests.cs index e3a9aa893d258..d7168da599f4e 100644 --- a/src/LanguageServer/ProtocolUnitTests/Diagnostics/WorkspaceProjectDiagnosticsTests.cs +++ b/src/LanguageServer/ProtocolUnitTests/Diagnostics/WorkspaceProjectDiagnosticsTests.cs @@ -14,7 +14,6 @@ using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Diagnostics; - public sealed class WorkspaceProjectDiagnosticsTests : AbstractPullDiagnosticTestsBase { public WorkspaceProjectDiagnosticsTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) diff --git a/src/LanguageServer/ProtocolUnitTests/References/FindAllReferencesHandlerFeaturesTests.cs b/src/LanguageServer/ProtocolUnitTests/References/FindAllReferencesHandlerFeaturesTests.cs index 20b8eaf3cbbb8..d57d43540f495 100644 --- a/src/LanguageServer/ProtocolUnitTests/References/FindAllReferencesHandlerFeaturesTests.cs +++ b/src/LanguageServer/ProtocolUnitTests/References/FindAllReferencesHandlerFeaturesTests.cs @@ -11,7 +11,6 @@ using LSP = Roslyn.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.References; - public sealed class FindAllReferencesHandlerFeaturesTests(ITestOutputHelper? testOutputHelper) : AbstractLanguageServerProtocolTests(testOutputHelper) { diff --git a/src/LanguageServer/ProtocolUnitTests/Workspaces/LspWorkspaceRegistrationServiceTests.cs b/src/LanguageServer/ProtocolUnitTests/Workspaces/LspWorkspaceRegistrationServiceTests.cs index 48864ffc338c0..06697e444956a 100644 --- a/src/LanguageServer/ProtocolUnitTests/Workspaces/LspWorkspaceRegistrationServiceTests.cs +++ b/src/LanguageServer/ProtocolUnitTests/Workspaces/LspWorkspaceRegistrationServiceTests.cs @@ -8,7 +8,6 @@ using Xunit.Abstractions; namespace Microsoft.CodeAnalysis.LanguageServer.UnitTests.Workspaces; - public sealed class LspWorkspaceRegistrationServiceTests : AbstractLanguageServerProtocolTests { public LspWorkspaceRegistrationServiceTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) diff --git a/src/Tools/PrepareTests/TestDiscovery.cs b/src/Tools/PrepareTests/TestDiscovery.cs index aec34c76d6aaf..1da14f7e27f19 100644 --- a/src/Tools/PrepareTests/TestDiscovery.cs +++ b/src/Tools/PrepareTests/TestDiscovery.cs @@ -13,7 +13,6 @@ using System.Text; namespace PrepareTests; - internal class TestDiscovery { private static readonly object s_lock = new(); diff --git a/src/Tools/Source/RunTests/TestHistoryManager.cs b/src/Tools/Source/RunTests/TestHistoryManager.cs index 80a11efab6502..52c192738feff 100644 --- a/src/Tools/Source/RunTests/TestHistoryManager.cs +++ b/src/Tools/Source/RunTests/TestHistoryManager.cs @@ -17,7 +17,6 @@ using Xunit; namespace RunTests; - internal class TestHistoryManager { /// diff --git a/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel_Utilities.cs b/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel_Utilities.cs index 7a337f68b93f3..f43638369658f 100644 --- a/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel_Utilities.cs +++ b/src/VisualStudio/Core/Def/DocumentOutline/DocumentOutlineViewModel_Utilities.cs @@ -18,7 +18,6 @@ using Roslyn.Utilities; namespace Microsoft.VisualStudio.LanguageServices.DocumentOutline; - internal delegate Task LanguageServiceBrokerCallback(Request request, CancellationToken cancellationToken); internal sealed partial class DocumentOutlineViewModel diff --git a/src/VisualStudio/Core/Def/Workspace/SourceGeneratedFileManager.cs b/src/VisualStudio/Core/Def/Workspace/SourceGeneratedFileManager.cs index 39712bb1af0d2..d58b016f39a64 100644 --- a/src/VisualStudio/Core/Def/Workspace/SourceGeneratedFileManager.cs +++ b/src/VisualStudio/Core/Def/Workspace/SourceGeneratedFileManager.cs @@ -234,6 +234,7 @@ private sealed class OpenSourceGeneratedFile : IDisposable private readonly SourceGeneratedFileManager _fileManager; private readonly ITextBuffer _textBuffer; private readonly SourceGeneratedDocumentIdentity _documentIdentity; + private readonly IWorkspaceConfigurationService? _workspaceConfigurationService; /// /// A read-only region that we create across the entire file to prevent edits unless we are the one making them. @@ -269,6 +270,7 @@ public OpenSourceGeneratedFile(SourceGeneratedFileManager fileManager, ITextBuff _fileManager = fileManager; _textBuffer = textBuffer; _documentIdentity = documentIdentity; + _workspaceConfigurationService = this.Workspace.Services.GetService(); // We'll create a read-only region for the file, but it'll be a dynamic region we can temporarily suspend // while we're doing edits. diff --git a/src/VisualStudio/Core/Test.Next/UnifiedSettings/TestModel/ResourceStringConverter.cs b/src/VisualStudio/Core/Test.Next/UnifiedSettings/TestModel/ResourceStringConverter.cs index 9ad8e5b8aa5bb..a10753afcfdea 100644 --- a/src/VisualStudio/Core/Test.Next/UnifiedSettings/TestModel/ResourceStringConverter.cs +++ b/src/VisualStudio/Core/Test.Next/UnifiedSettings/TestModel/ResourceStringConverter.cs @@ -7,7 +7,6 @@ using System.Text.Json.Serialization; namespace Roslyn.VisualStudio.Next.UnitTests.UnifiedSettings.TestModel; - internal sealed class ResourceStringConverter : JsonConverter { public override string? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpF1Help.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpF1Help.cs index 3291ede9406ef..fcea866909ec4 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpF1Help.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpF1Help.cs @@ -23,7 +23,7 @@ public CSharpF1Help() } [IdeFact] - public async Task F1Help() + private async Task F1Help() { var text = @" using System; diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpSourceGenerators.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpSourceGenerators.cs index a556af30ee9af..f37d5a8f0ec34 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpSourceGenerators.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpSourceGenerators.cs @@ -16,13 +16,16 @@ using Roslyn.VisualStudio.NewIntegrationTests.InProcess; using WindowsInput.Native; using Xunit; +using Xunit.Abstractions; namespace Roslyn.VisualStudio.NewIntegrationTests.CSharp; [Trait(Traits.Feature, Traits.Features.SourceGenerators)] -public sealed class CSharpSourceGenerators() +public sealed class CSharpSourceGenerators(ITestOutputHelper testOutputHelper) : AbstractEditorTest(nameof(CSharpSourceGenerators), WellKnownProjectTemplates.ConsoleApplication) { + private readonly ITestOutputHelper _testOutputHelper = testOutputHelper; + protected override string LanguageName => LanguageNames.CSharp; public override async Task InitializeAsync() diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicF1Help.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicF1Help.cs index d02e09fa1bd7e..af4b961eae419 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicF1Help.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/VisualBasic/BasicF1Help.cs @@ -23,7 +23,7 @@ public BasicF1Help() } [IdeFact] - public async Task F1Help() + private async Task F1Help() { var text = @" Imports System diff --git a/src/VisualStudio/Xaml/Impl/Features/AutoInsert/IXamlAutoInsertService.cs b/src/VisualStudio/Xaml/Impl/Features/AutoInsert/IXamlAutoInsertService.cs index 087b70bfc0087..f213936a3b650 100644 --- a/src/VisualStudio/Xaml/Impl/Features/AutoInsert/IXamlAutoInsertService.cs +++ b/src/VisualStudio/Xaml/Impl/Features/AutoInsert/IXamlAutoInsertService.cs @@ -13,5 +13,5 @@ namespace Microsoft.VisualStudio.LanguageServices.Xaml.Features.AutoInsert; internal interface IXamlAutoInsertService : ILanguageService { - Task GetAutoInsertAsync(TextDocument document, char typedChar, int position, CancellationToken cancellationToken); + public Task GetAutoInsertAsync(TextDocument document, char typedChar, int position, CancellationToken cancellationToken); } diff --git a/src/VisualStudio/Xaml/Impl/Features/TypeRename/IXamlTypeRenameService.cs b/src/VisualStudio/Xaml/Impl/Features/TypeRename/IXamlTypeRenameService.cs index 372fa2cdc8450..05ecb26beb825 100644 --- a/src/VisualStudio/Xaml/Impl/Features/TypeRename/IXamlTypeRenameService.cs +++ b/src/VisualStudio/Xaml/Impl/Features/TypeRename/IXamlTypeRenameService.cs @@ -11,5 +11,5 @@ namespace Microsoft.VisualStudio.LanguageServices.Xaml.Features.TypeRename; internal interface IXamlTypeRenameService : ILanguageService { - Task GetTypeRenameAsync(TextDocument document, int position, CancellationToken cancellationToken); + public Task GetTypeRenameAsync(TextDocument document, int position, CancellationToken cancellationToken); } diff --git a/src/Workspaces/Core/Portable/Options/ILegacyGlobalOptionsWorkspaceService.cs b/src/Workspaces/Core/Portable/Options/ILegacyGlobalOptionsWorkspaceService.cs index 5887c97a8f07d..c5161226ff7af 100644 --- a/src/Workspaces/Core/Portable/Options/ILegacyGlobalOptionsWorkspaceService.cs +++ b/src/Workspaces/Core/Portable/Options/ILegacyGlobalOptionsWorkspaceService.cs @@ -13,19 +13,19 @@ namespace Microsoft.CodeAnalysis.Options; /// internal interface ILegacyGlobalOptionsWorkspaceService : IWorkspaceService { - bool RazorUseTabs { get; } - int RazorTabSize { get; } + public bool RazorUseTabs { get; } + public int RazorTabSize { get; } - bool GenerateOverrides { get; set; } + public bool GenerateOverrides { get; set; } - bool GetGenerateEqualsAndGetHashCodeFromMembersGenerateOperators(string language); - void SetGenerateEqualsAndGetHashCodeFromMembersGenerateOperators(string language, bool value); + public bool GetGenerateEqualsAndGetHashCodeFromMembersGenerateOperators(string language); + public void SetGenerateEqualsAndGetHashCodeFromMembersGenerateOperators(string language, bool value); - bool GetGenerateEqualsAndGetHashCodeFromMembersImplementIEquatable(string language); - void SetGenerateEqualsAndGetHashCodeFromMembersImplementIEquatable(string language, bool value); + public bool GetGenerateEqualsAndGetHashCodeFromMembersImplementIEquatable(string language); + public void SetGenerateEqualsAndGetHashCodeFromMembersImplementIEquatable(string language, bool value); - bool GetGenerateConstructorFromMembersOptionsAddNullChecks(string language); - void SetGenerateConstructorFromMembersOptionsAddNullChecks(string language, bool value); + public bool GetGenerateConstructorFromMembersOptionsAddNullChecks(string language); + public void SetGenerateConstructorFromMembersOptionsAddNullChecks(string language, bool value); SyntaxFormattingOptions GetSyntaxFormattingOptions(LanguageServices languageServices); } diff --git a/src/Workspaces/Core/Portable/Telemetry/ITelemetryBlockLog.cs b/src/Workspaces/Core/Portable/Telemetry/ITelemetryBlockLog.cs index 583e10c16f283..5860c56141603 100644 --- a/src/Workspaces/Core/Portable/Telemetry/ITelemetryBlockLog.cs +++ b/src/Workspaces/Core/Portable/Telemetry/ITelemetryBlockLog.cs @@ -15,5 +15,5 @@ internal interface ITelemetryBlockLog : ITelemetryLog /// /// Event data to be sent /// Optional parameter used to determine whether to send the telemetry event (in milliseconds) - IDisposable? LogBlockTime(KeyValueLogMessage logMessage, int minThresholdMs = -1); + public IDisposable? LogBlockTime(KeyValueLogMessage logMessage, int minThresholdMs = -1); } diff --git a/src/Workspaces/Core/Portable/Telemetry/ITelemetryLog.cs b/src/Workspaces/Core/Portable/Telemetry/ITelemetryLog.cs index 147c2c916a0ef..c96bba2b4bb39 100644 --- a/src/Workspaces/Core/Portable/Telemetry/ITelemetryLog.cs +++ b/src/Workspaces/Core/Portable/Telemetry/ITelemetryLog.cs @@ -11,5 +11,5 @@ internal interface ITelemetryLog /// /// Adds a telemetry event with values obtained from context message /// - void Log(KeyValueLogMessage logMessage); + public void Log(KeyValueLogMessage logMessage); } diff --git a/src/Workspaces/Core/Portable/Telemetry/ITelemetryLogProvider.cs b/src/Workspaces/Core/Portable/Telemetry/ITelemetryLogProvider.cs index c670bdb1ebfd8..8ef0da7052293 100644 --- a/src/Workspaces/Core/Portable/Telemetry/ITelemetryLogProvider.cs +++ b/src/Workspaces/Core/Portable/Telemetry/ITelemetryLogProvider.cs @@ -12,7 +12,7 @@ internal interface ITelemetryLogProvider /// Returns an for logging telemetry. /// /// FunctionId representing the telemetry operation - ITelemetryBlockLog? GetLog(FunctionId functionId); + public ITelemetryBlockLog? GetLog(FunctionId functionId); /// /// Returns an aggregating for logging histogram based telemetry. @@ -20,16 +20,16 @@ internal interface ITelemetryLogProvider /// FunctionId representing the telemetry operation /// Optional values indicating bucket boundaries in milliseconds. If not specified, /// all aggregating events created will use a default configuration - ITelemetryBlockLog? GetHistogramLog(FunctionId functionId, double[]? bucketBoundaries = null); + public ITelemetryBlockLog? GetHistogramLog(FunctionId functionId, double[]? bucketBoundaries = null); /// /// Returns an aggregating for logging counter telemetry. /// /// FunctionId representing the telemetry operation - ITelemetryLog? GetCounterLog(FunctionId functionId); + public ITelemetryLog? GetCounterLog(FunctionId functionId); /// /// Flushes all telemetry logs /// - void Flush(); + public void Flush(); } diff --git a/src/Workspaces/Core/Portable/Workspace/Host/IWorkspaceTestLogger.cs b/src/Workspaces/Core/Portable/Workspace/Host/IWorkspaceTestLogger.cs index a13a1b666bf03..9aa5621db72b3 100644 --- a/src/Workspaces/Core/Portable/Workspace/Host/IWorkspaceTestLogger.cs +++ b/src/Workspaces/Core/Portable/Workspace/Host/IWorkspaceTestLogger.cs @@ -6,5 +6,5 @@ namespace Microsoft.CodeAnalysis.Host; internal interface IWorkspaceTestLogger : IWorkspaceService { - void Log(string message); + public void Log(string message); } diff --git a/src/Workspaces/Core/Portable/Workspace/Host/TemporaryStorage/ITemporaryStorageStreamHandle.cs b/src/Workspaces/Core/Portable/Workspace/Host/TemporaryStorage/ITemporaryStorageStreamHandle.cs index 808d8df094a50..2a237a6fd1a47 100644 --- a/src/Workspaces/Core/Portable/Workspace/Host/TemporaryStorage/ITemporaryStorageStreamHandle.cs +++ b/src/Workspaces/Core/Portable/Workspace/Host/TemporaryStorage/ITemporaryStorageStreamHandle.cs @@ -16,7 +16,7 @@ namespace Microsoft.CodeAnalysis.Host; /// internal interface ITemporaryStorageStreamHandle { - TemporaryStorageIdentifier Identifier { get; } + public TemporaryStorageIdentifier Identifier { get; } /// /// Reads the data indicated to by this handle into a stream. This stream can be created in a different process diff --git a/src/Workspaces/Core/Portable/Workspace/Host/TemporaryStorage/ITemporaryStorageTextHandle.cs b/src/Workspaces/Core/Portable/Workspace/Host/TemporaryStorage/ITemporaryStorageTextHandle.cs index 2fa55ef5ba798..d2c1dcccc88b1 100644 --- a/src/Workspaces/Core/Portable/Workspace/Host/TemporaryStorage/ITemporaryStorageTextHandle.cs +++ b/src/Workspaces/Core/Portable/Workspace/Host/TemporaryStorage/ITemporaryStorageTextHandle.cs @@ -10,7 +10,7 @@ namespace Microsoft.CodeAnalysis.Host; internal interface ITemporaryStorageTextHandle { - TemporaryStorageIdentifier Identifier { get; } + public TemporaryStorageIdentifier Identifier { get; } SourceText ReadFromTemporaryStorage(CancellationToken cancellationToken); Task ReadFromTemporaryStorageAsync(CancellationToken cancellationToken); diff --git a/src/Workspaces/CoreTest/ObjectSerializationTests.cs b/src/Workspaces/CoreTest/ObjectSerializationTests.cs index a27a1371f5b85..55b64e963c76b 100644 --- a/src/Workspaces/CoreTest/ObjectSerializationTests.cs +++ b/src/Workspaces/CoreTest/ObjectSerializationTests.cs @@ -495,7 +495,6 @@ private static void TestWritingPrimitiveValues(ObjectWriter writer) writer.WriteInt64((long)ELong.Value); writer.WriteInt64((long)EULong.Value); } - writer.WriteScalarValue(_testNow); } @@ -641,6 +640,11 @@ private static void TestRoundTripStringCharacter(ushort code) TestRoundTripString(new String((char)code, 1)); } + private static void TestRoundTripArray(T[] values) + { + TestRoundTripValue(values); + } + public static IEnumerable GetEncodingTestCases() => EncodingTestHelpers.GetEncodingTestCases(); diff --git a/src/Workspaces/CoreTestUtilities/GlobalizationUtilities.cs b/src/Workspaces/CoreTestUtilities/GlobalizationUtilities.cs index be399bcdf62cc..70799b4ef2fd2 100644 --- a/src/Workspaces/CoreTestUtilities/GlobalizationUtilities.cs +++ b/src/Workspaces/CoreTestUtilities/GlobalizationUtilities.cs @@ -5,7 +5,6 @@ using System.Globalization; namespace Microsoft.CodeAnalysis.UnitTests; - internal sealed class GlobalizationUtilities { /// diff --git a/src/Workspaces/MSBuild/Core/MSBuild/MSBuildProjectLoader.Worker.cs b/src/Workspaces/MSBuild/Core/MSBuild/MSBuildProjectLoader.Worker.cs index 4f92c9fea189b..83177f2becfc0 100644 --- a/src/Workspaces/MSBuild/Core/MSBuild/MSBuildProjectLoader.Worker.cs +++ b/src/Workspaces/MSBuild/Core/MSBuild/MSBuildProjectLoader.Worker.cs @@ -36,6 +36,11 @@ private sealed partial class Worker /// private readonly ImmutableArray _requestedProjectPaths; + /// + /// Global MSBuild properties to set when loading projects. + /// + private readonly ImmutableDictionary _globalProperties; + /// /// Map of s, project paths, and output file paths. /// @@ -73,6 +78,7 @@ public Worker( BuildHostProcessManager buildHostProcessManager, ImmutableArray requestedProjectPaths, string baseDirectory, + ImmutableDictionary globalProperties, ProjectMap? projectMap, IProgress? progress, DiagnosticReportingOptions requestedProjectOptions, @@ -86,6 +92,7 @@ public Worker( _buildHostProcessManager = buildHostProcessManager; _baseDirectory = baseDirectory; _requestedProjectPaths = requestedProjectPaths; + _globalProperties = globalProperties; _projectMap = projectMap ?? ProjectMap.Create(); _progress = progress; _requestedProjectOptions = requestedProjectOptions; diff --git a/src/Workspaces/MSBuild/Core/MSBuild/MSBuildProjectLoader.cs b/src/Workspaces/MSBuild/Core/MSBuild/MSBuildProjectLoader.cs index 042bf7b41b698..97cebc35edcb0 100644 --- a/src/Workspaces/MSBuild/Core/MSBuild/MSBuildProjectLoader.cs +++ b/src/Workspaces/MSBuild/Core/MSBuild/MSBuildProjectLoader.cs @@ -10,6 +10,7 @@ using Microsoft.Build.Framework; using Microsoft.CodeAnalysis.Host; using Roslyn.Utilities; +using MSB = Microsoft.Build; namespace Microsoft.CodeAnalysis.MSBuild; @@ -192,6 +193,7 @@ public async Task LoadSolutionInfoAsync( projectPaths, // TryGetAbsoluteSolutionPath should not return an invalid path baseDirectory: Path.GetDirectoryName(absoluteSolutionPath)!, + Properties, projectMap: null, progress, requestedProjectOptions: reportingOptions, @@ -252,6 +254,7 @@ public async Task> LoadProjectInfoAsync( buildHostProcessManager, requestedProjectPaths: [projectFilePath], baseDirectory: Directory.GetCurrentDirectory(), + globalProperties: Properties, projectMap, progress, requestedProjectOptions, diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EditorConfig/LanguageExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EditorConfig/LanguageExtensions.cs index 9cc0027cb0de1..f2f7e7f03b438 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EditorConfig/LanguageExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/EditorConfig/LanguageExtensions.cs @@ -5,7 +5,6 @@ using System.IO; namespace Microsoft.CodeAnalysis.EditorConfig; - using static Microsoft.CodeAnalysis.EditorConfig.LanguageConstants; internal static class LanguageExtensions diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Options/Option2.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Options/Option2.cs index 8e9530d56e9a5..0e4634707a473 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Options/Option2.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Options/Option2.cs @@ -24,7 +24,7 @@ internal interface ISingleValuedOption : IOption2 /// /// Note that this property is not (and should not be) used for computing option values or storing options. /// - string? LanguageName { get; } + public string? LanguageName { get; } } /// diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Workspace/Mef/ILayeredServiceMetadata.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Workspace/Mef/ILayeredServiceMetadata.cs index 0ba932eb35785..bdbb52959390f 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Workspace/Mef/ILayeredServiceMetadata.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Workspace/Mef/ILayeredServiceMetadata.cs @@ -8,7 +8,7 @@ namespace Microsoft.CodeAnalysis.Host.Mef; internal interface ILayeredServiceMetadata { - IReadOnlyList WorkspaceKinds { get; } - string Layer { get; } - string ServiceType { get; } + public IReadOnlyList WorkspaceKinds { get; } + public string Layer { get; } + public string ServiceType { get; } } From c88b85390262daf006cf4a6f8770a3d67a9a9f72 Mon Sep 17 00:00:00 2001 From: Rikki Gibson Date: Wed, 11 Jun 2025 17:46:17 -0700 Subject: [PATCH 4/6] fix warning --- .../Tagging/AbstractAsynchronousTaggerProvider.TagSource.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.TagSource.cs b/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.TagSource.cs index 1996dc21919fe..6c929302293d1 100644 --- a/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.TagSource.cs +++ b/src/EditorFeatures/Core/Tagging/AbstractAsynchronousTaggerProvider.TagSource.cs @@ -55,11 +55,6 @@ private sealed partial class TagSource private readonly AbstractAsynchronousTaggerProvider _dataSource; - /// - /// Information about what workspace the buffer we're tagging is associated with. - /// - private readonly WorkspaceRegistration _workspaceRegistration; - /// /// Work queue that collects high priority requests to call TagsChanged with. /// From cddbe0b55c7da74a6565485dd7b5cb582fbea6ce Mon Sep 17 00:00:00 2001 From: Rikki Gibson Date: Wed, 11 Jun 2025 19:00:23 -0700 Subject: [PATCH 5/6] Revert "Update to using unbound nameof(X<>) expressions (#78731)" This reverts commit 6a09280b2e91933aedf9e64ee45f991259b87211, reversing changes made to a7fa6814e8625dcc37b02664a34e8917f05bb40c. --- ...nExpressionForBuilderDiagnosticAnalyzer.cs | 16 ++++----- ...onExpressionForFluentDiagnosticAnalyzer.cs | 36 +++++++++---------- ...ctionExpressionForNewDiagnosticAnalyzer.cs | 2 +- .../UseCollectionExpressionHelpers.cs | 12 +++---- ...ngeOperatorDiagnosticAnalyzer.InfoCache.cs | 2 +- ...rpMakeMethodAsynchronousCodeFixProvider.cs | 4 +-- .../UseUtf8StringLiteralCodeFixProvider.cs | 2 +- ...rnaryConditionalCheckDiagnosticAnalyzer.cs | 4 +-- .../UpdateExpressionState.cs | 2 +- ...actUseNullPropagationDiagnosticAnalyzer.cs | 2 +- .../AbstractForEachCastCodeFixProvider.cs | 2 +- .../AbstractGenerateMethodService.State.cs | 2 +- ...stractUseNullPropagationCodeFixProvider.cs | 2 +- .../Lightup/ISmartRenameSessionWrapper.cs | 4 +-- .../Diagnostics/DiagnosticTaggerWrapper.cs | 2 +- .../ToToListConverter.cs | 2 +- ...parisonOperatorsCodeRefactoringProvider.cs | 2 +- .../MethodHandlerDetails.cs | 4 +-- .../RequestExecutionQueue.cs | 2 +- .../Helpers/DiagnosticWellKnownNames.cs | 2 +- .../Core/AbstractApplyTraitToClass`1.cs | 2 +- .../Core/AbstractCreateTestAccessor`1.cs | 2 +- .../ExtensionMessageHandlerWrapper.cs | 2 +- .../CodeModel/AbstractFileCodeElementTests.cs | 2 +- .../CoreTest/UtilityTest/AsyncLazyTests.cs | 4 +-- .../TypeStyle/CSharpUseImplicitTypeHelper.cs | 2 +- .../Utilities/ReferenceCountedDisposable.cs | 2 +- .../Symbols/ITypeSymbolExtensions.cs | 4 +-- ...CSharpTypeInferenceService.TypeInferrer.cs | 4 +-- .../Extensions/SyntaxGeneratorExtensions.cs | 2 +- 30 files changed, 66 insertions(+), 66 deletions(-) diff --git a/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs b/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs index 3f0c11bdaacc0..7406d96480af4 100644 --- a/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs +++ b/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForBuilderDiagnosticAnalyzer.cs @@ -27,7 +27,7 @@ internal sealed partial class CSharpUseCollectionExpressionForBuilderDiagnosticA EnforceOnBuildValues.UseCollectionExpressionForBuilder) { private const string CreateBuilderName = nameof(ImmutableArray.CreateBuilder); - private const string GetInstanceName = nameof(ArrayBuilder<>.GetInstance); + private const string GetInstanceName = nameof(ArrayBuilder.GetInstance); protected override void InitializeWorker(CodeBlockStartAnalysisContext context, INamedTypeSymbol? expressionType) => context.RegisterSyntaxNodeAction(context => AnalyzeInvocationExpression(context, expressionType), SyntaxKind.InvocationExpression); @@ -117,7 +117,7 @@ void FadeOutCode(SyntaxNodeAnalysisContext context, AnalysisResult analysisResul return null; if (memberAccessExpression.Name.Identifier.ValueText == GetInstanceName && - memberAccessExpression.Expression is not GenericNameSyntax { Identifier.ValueText: nameof(ArrayBuilder<>) }) + memberAccessExpression.Expression is not GenericNameSyntax { Identifier.ValueText: nameof(ArrayBuilder) }) { return null; } @@ -217,12 +217,12 @@ identifierName.Parent is MemberAccessExpressionSyntax(SyntaxKind.SimpleMemberAcc memberAccess.Expression == identifierName && memberAccess.Parent is InvocationExpressionSyntax { ArgumentList.Arguments.Count: 0 } invocationExpression && memberAccess.Name.Identifier.ValueText - is nameof(ImmutableArray<>.Builder.ToImmutable) - or nameof(ImmutableArray<>.Builder.MoveToImmutable) - or nameof(ImmutableArray<>.Builder.ToArray) - or nameof(ArrayBuilder<>.ToImmutableAndClear) - or nameof(ArrayBuilder<>.ToImmutableAndFree) - or nameof(ArrayBuilder<>.ToArrayAndFree) + is nameof(ImmutableArray.Builder.ToImmutable) + or nameof(ImmutableArray.Builder.MoveToImmutable) + or nameof(ImmutableArray.Builder.ToArray) + or nameof(ArrayBuilder.ToImmutableAndClear) + or nameof(ArrayBuilder.ToImmutableAndFree) + or nameof(ArrayBuilder.ToArrayAndFree) or nameof(Enumerable.ToList)) { return invocationExpression; diff --git a/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs b/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs index 6a4510707005b..db35d9137dbb4 100644 --- a/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs +++ b/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForFluentDiagnosticAnalyzer.cs @@ -42,24 +42,24 @@ internal sealed partial class CSharpUseCollectionExpressionForFluentDiagnosticAn private static readonly ImmutableArray s_suffixes = [ nameof(Array), - nameof(Span<>), - nameof(ReadOnlySpan<>), - nameof(System.Collections.Generic.List<>), - nameof(HashSet<>), - nameof(LinkedList<>), - nameof(Queue<>), - nameof(SortedSet<>), - nameof(Stack<>), - nameof(ICollection<>), - nameof(IReadOnlyCollection<>), - nameof(IList<>), - nameof(IReadOnlyList<>), - nameof(ImmutableArray<>), - nameof(ImmutableHashSet<>), - nameof(ImmutableList<>), - nameof(ImmutableQueue<>), - nameof(ImmutableSortedSet<>), - nameof(ImmutableStack<>), + nameof(Span), + nameof(ReadOnlySpan), + nameof(System.Collections.Generic.List), + nameof(HashSet), + nameof(LinkedList), + nameof(Queue), + nameof(SortedSet), + nameof(Stack), + nameof(ICollection), + nameof(IReadOnlyCollection), + nameof(IList), + nameof(IReadOnlyList), + nameof(ImmutableArray), + nameof(ImmutableHashSet), + nameof(ImmutableList), + nameof(ImmutableQueue), + nameof(ImmutableSortedSet), + nameof(ImmutableStack), nameof(System.Collections.Immutable), ]; diff --git a/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs b/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs index cd9f1f005d860..24db63134a0ba 100644 --- a/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs +++ b/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/CSharpUseCollectionExpressionForNewDiagnosticAnalyzer.cs @@ -53,7 +53,7 @@ private void AnalyzeBaseObjectCreationExpression( var symbol = semanticModel.GetSymbolInfo(objectCreationExpression, cancellationToken).Symbol; if (symbol is not IMethodSymbol { MethodKind: MethodKind.Constructor, Parameters: [var constructorParameter] } || - constructorParameter.Type.Name != nameof(IEnumerable<>)) + constructorParameter.Type.Name != nameof(IEnumerable)) { return; } diff --git a/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/UseCollectionExpressionHelpers.cs b/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/UseCollectionExpressionHelpers.cs index 4a6ff87c46508..3ad3e5986aad9 100644 --- a/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/UseCollectionExpressionHelpers.cs +++ b/src/Analyzers/CSharp/Analyzers/UseCollectionExpression/UseCollectionExpressionHelpers.cs @@ -193,11 +193,11 @@ bool IsSafeConversionWhenTypesDoNotMatch(out bool changesSemantics) var convertedType = originalTypeInfo.ConvertedType; var convertedToReadOnlySpan = - convertedType.Name == nameof(ReadOnlySpan<>) && + convertedType.Name == nameof(ReadOnlySpan) && convertedType.OriginalDefinition.Equals(compilation.ReadOnlySpanOfTType()); var convertedToSpan = - convertedType.Name == nameof(Span<>) && + convertedType.Name == nameof(Span) && convertedType.OriginalDefinition.Equals(compilation.SpanOfTType()); // ReadOnlySpan x = stackalloc[] ... @@ -206,7 +206,7 @@ bool IsSafeConversionWhenTypesDoNotMatch(out bool changesSemantics) // restrictive than Span var isSpanToReadOnlySpan = convertedToReadOnlySpan && - type.Name == nameof(Span<>) && + type.Name == nameof(Span) && type.OriginalDefinition.Equals(compilation.SpanOfTType()) && convertedType.GetTypeArguments()[0].Equals(type.GetTypeArguments()[0]); if (isSpanToReadOnlySpan) @@ -264,7 +264,7 @@ bool IsSafeConversionWhenTypesDoNotMatch(out bool changesSemantics) // disallow converting those types to ensure semantics are preserved. We do this even though // allowSemanticsChange is true because this will basically be certain to break semantics, as opposed to // the more common case where semantics may change slightly, but likely not in a way that breaks code. - if (type.Name is nameof(ObservableCollection<>) or nameof(ReadOnlyObservableCollection<>)) + if (type.Name is nameof(ObservableCollection) or nameof(ReadOnlyObservableCollection)) return false; // If the original expression was creating a set, but is being assigned to one of the well known @@ -933,7 +933,7 @@ bool IsCompatibleSignatureAndArguments( { Type: INamedTypeSymbol { - Name: nameof(IEnumerable<>), + Name: nameof(IEnumerable), TypeArguments: [ITypeParameterSymbol { TypeParameterKind: TypeParameterKind.Method }] } enumerableType }] && @@ -980,7 +980,7 @@ originalCreateMethod.Parameters is [ { Type: INamedTypeSymbol { - Name: nameof(Span<>) or nameof(ReadOnlySpan<>), + Name: nameof(Span) or nameof(ReadOnlySpan), TypeArguments: [ITypeParameterSymbol { TypeParameterKind: TypeParameterKind.Method }] } spanType }]) diff --git a/src/Analyzers/CSharp/Analyzers/UseIndexOrRangeOperator/CSharpUseRangeOperatorDiagnosticAnalyzer.InfoCache.cs b/src/Analyzers/CSharp/Analyzers/UseIndexOrRangeOperator/CSharpUseRangeOperatorDiagnosticAnalyzer.InfoCache.cs index dee9c249b8a93..26ea15936fa4a 100644 --- a/src/Analyzers/CSharp/Analyzers/UseIndexOrRangeOperator/CSharpUseRangeOperatorDiagnosticAnalyzer.InfoCache.cs +++ b/src/Analyzers/CSharp/Analyzers/UseIndexOrRangeOperator/CSharpUseRangeOperatorDiagnosticAnalyzer.InfoCache.cs @@ -158,7 +158,7 @@ private MemberInfo ComputeMemberInfo(IMethodSymbol sliceLikeMethod, bool require // Also, look to see if the type has a `.Slice(int start, int length)` method. // This is also a method the compiler knows to look for when a user writes `x[a..b]` var actualSliceMethod = - sliceLikeMethod.ContainingType.GetMembers(nameof(Span<>.Slice)) + sliceLikeMethod.ContainingType.GetMembers(nameof(Span.Slice)) .OfType() .FirstOrDefault(s => IsTwoArgumentSliceLikeMethod(s)); if (actualSliceMethod != null) diff --git a/src/Analyzers/CSharp/CodeFixes/MakeMethodAsynchronous/CSharpMakeMethodAsynchronousCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/MakeMethodAsynchronous/CSharpMakeMethodAsynchronousCodeFixProvider.cs index 1450fca34c80f..ebdf9616f9161 100644 --- a/src/Analyzers/CSharp/CodeFixes/MakeMethodAsynchronous/CSharpMakeMethodAsynchronousCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/MakeMethodAsynchronous/CSharpMakeMethodAsynchronousCodeFixProvider.cs @@ -131,13 +131,13 @@ private static TypeSyntax FixMethodReturnType( if (IsIEnumerable(returnType, knownTypes) && IsIterator(methodSymbol, cancellationToken)) { newReturnType = knownTypes.IAsyncEnumerableOfTType is null - ? MakeGenericType(nameof(IAsyncEnumerable<>), methodSymbol.ReturnType) + ? MakeGenericType(nameof(IAsyncEnumerable), methodSymbol.ReturnType) : knownTypes.IAsyncEnumerableOfTType.Construct(methodSymbol.ReturnType.GetTypeArguments()[0]).GenerateTypeSyntax(); } else if (IsIEnumerator(returnType, knownTypes) && IsIterator(methodSymbol, cancellationToken)) { newReturnType = knownTypes.IAsyncEnumeratorOfTType is null - ? MakeGenericType(nameof(IAsyncEnumerator<>), methodSymbol.ReturnType) + ? MakeGenericType(nameof(IAsyncEnumerator), methodSymbol.ReturnType) : knownTypes.IAsyncEnumeratorOfTType.Construct(methodSymbol.ReturnType.GetTypeArguments()[0]).GenerateTypeSyntax(); } else if (IsIAsyncEnumerableOrEnumerator(returnType, knownTypes)) diff --git a/src/Analyzers/CSharp/CodeFixes/UseUtf8StringLiteral/UseUtf8StringLiteralCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseUtf8StringLiteral/UseUtf8StringLiteralCodeFixProvider.cs index 067362b58ca4f..f82a29f839e6e 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseUtf8StringLiteral/UseUtf8StringLiteralCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseUtf8StringLiteral/UseUtf8StringLiteralCodeFixProvider.cs @@ -206,7 +206,7 @@ private static ExpressionSyntax CreateUtf8String(SyntaxTriviaList leadingTrivia, MemberAccessExpression( SyntaxKind.SimpleMemberAccessExpression, stringLiteral, - IdentifierName(nameof(ReadOnlySpan<>.ToArray)))) + IdentifierName(nameof(ReadOnlySpan.ToArray)))) .WithTrailingTrivia(trailingTrivia); } } diff --git a/src/Analyzers/Core/Analyzers/UseCoalesceExpression/AbstractUseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticAnalyzer.cs b/src/Analyzers/Core/Analyzers/UseCoalesceExpression/AbstractUseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticAnalyzer.cs index 92251b50c672f..515eb7d8a2efa 100644 --- a/src/Analyzers/Core/Analyzers/UseCoalesceExpression/AbstractUseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticAnalyzer.cs +++ b/src/Analyzers/Core/Analyzers/UseCoalesceExpression/AbstractUseCoalesceExpressionForNullableTernaryConditionalCheckDiagnosticAnalyzer.cs @@ -80,7 +80,7 @@ private void AnalyzeSyntax(SyntaxNodeAnalysisContext context) syntaxFacts.GetPartsOfMemberAccessExpression(conditionMemberAccess, out var conditionExpression, out var conditionSimpleName); syntaxFacts.GetNameAndArityOfSimpleName(conditionSimpleName, out var conditionName, out _); - if (conditionName != nameof(Nullable<>.HasValue)) + if (conditionName != nameof(Nullable.HasValue)) return; var whenPartToCheck = notHasValueExpression ? whenFalseNodeLow : whenTrueNodeLow; @@ -90,7 +90,7 @@ private void AnalyzeSyntax(SyntaxNodeAnalysisContext context) syntaxFacts.GetPartsOfMemberAccessExpression(whenPartMemberAccess, out var whenPartExpression, out var whenPartSimpleName); syntaxFacts.GetNameAndArityOfSimpleName(whenPartSimpleName, out var whenPartName, out _); - if (whenPartName != nameof(Nullable<>.Value)) + if (whenPartName != nameof(Nullable.Value)) return; if (!syntaxFacts.AreEquivalent(conditionExpression, whenPartExpression)) diff --git a/src/Analyzers/Core/Analyzers/UseCollectionInitializer/UpdateExpressionState.cs b/src/Analyzers/Core/Analyzers/UseCollectionInitializer/UpdateExpressionState.cs index 274f8c9dc8f3f..73fd6a7f9a76f 100644 --- a/src/Analyzers/Core/Analyzers/UseCollectionInitializer/UpdateExpressionState.cs +++ b/src/Analyzers/Core/Analyzers/UseCollectionInitializer/UpdateExpressionState.cs @@ -26,7 +26,7 @@ internal readonly struct UpdateExpressionState< { private static readonly ImmutableArray<(string name, bool isLinq)> s_multiAddNames = [ - (nameof(List<>.AddRange), isLinq: false), + (nameof(List.AddRange), isLinq: false), (nameof(Enumerable.Concat), isLinq: true), (nameof(Enumerable.Append), isLinq: true), ]; diff --git a/src/Analyzers/Core/Analyzers/UseNullPropagation/AbstractUseNullPropagationDiagnosticAnalyzer.cs b/src/Analyzers/Core/Analyzers/UseNullPropagation/AbstractUseNullPropagationDiagnosticAnalyzer.cs index aa4ad20955515..4bec6bacab283 100644 --- a/src/Analyzers/Core/Analyzers/UseNullPropagation/AbstractUseNullPropagationDiagnosticAnalyzer.cs +++ b/src/Analyzers/Core/Analyzers/UseNullPropagation/AbstractUseNullPropagationDiagnosticAnalyzer.cs @@ -22,7 +22,7 @@ internal static class UseNullPropagationHelpers public static bool IsSystemNullableValueProperty([NotNullWhen(true)] ISymbol? symbol) => symbol is { - Name: nameof(Nullable<>.Value), + Name: nameof(Nullable.Value), ContainingType.OriginalDefinition.SpecialType: SpecialType.System_Nullable_T, }; } diff --git a/src/Analyzers/Core/CodeFixes/ForEachCast/AbstractForEachCastCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/ForEachCast/AbstractForEachCastCodeFixProvider.cs index 9e8c2917accf2..cfd86259a4a42 100644 --- a/src/Analyzers/Core/CodeFixes/ForEachCast/AbstractForEachCastCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/ForEachCast/AbstractForEachCastCodeFixProvider.cs @@ -29,7 +29,7 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) { if (context.Diagnostics.First().Properties.ContainsKey(ForEachCastHelpers.IsFixable)) { - RegisterCodeFix(context, AnalyzersResources.Add_explicit_cast, nameof(AbstractForEachCastCodeFixProvider<>)); + RegisterCodeFix(context, AnalyzersResources.Add_explicit_cast, nameof(AbstractForEachCastCodeFixProvider)); } return Task.CompletedTask; diff --git a/src/Analyzers/Core/CodeFixes/GenerateParameterizedMember/AbstractGenerateMethodService.State.cs b/src/Analyzers/Core/CodeFixes/GenerateParameterizedMember/AbstractGenerateMethodService.State.cs index 5e252f1496c75..c558aa0d8f354 100644 --- a/src/Analyzers/Core/CodeFixes/GenerateParameterizedMember/AbstractGenerateMethodService.State.cs +++ b/src/Analyzers/Core/CodeFixes/GenerateParameterizedMember/AbstractGenerateMethodService.State.cs @@ -167,7 +167,7 @@ private bool TryInitializeSimpleName( { // If we inferred Func/Action here, attempt to create better parameter names than the default // 'arg1/arg2/arg3' form that the delegate specifies. - var parameterNames = delegateInvokeMethod.ContainingType is { Name: nameof(Action) or nameof(Func<>), ContainingNamespace.Name: nameof(System) } + var parameterNames = delegateInvokeMethod.ContainingType is { Name: nameof(Action) or nameof(Func), ContainingNamespace.Name: nameof(System) } ? GenerateParameterNamesBasedOnParameterTypes(delegateInvokeMethod.Parameters) : delegateInvokeMethod.Parameters.SelectAsArray(p => p.Name); diff --git a/src/Analyzers/Core/CodeFixes/UseNullPropagation/AbstractUseNullPropagationCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseNullPropagation/AbstractUseNullPropagationCodeFixProvider.cs index 87c4059ab1c3e..c1e6714f1e0ac 100644 --- a/src/Analyzers/Core/CodeFixes/UseNullPropagation/AbstractUseNullPropagationCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseNullPropagation/AbstractUseNullPropagationCodeFixProvider.cs @@ -243,7 +243,7 @@ private void FixIfStatement( syntaxFacts.GetNameAndArityOfSimpleName(nameNode, out var name, out var arity); var comparer = syntaxFacts.StringComparer; - if (arity == 0 && comparer.Equals(name, nameof(Nullable<>.Value))) + if (arity == 0 && comparer.Equals(name, nameof(Nullable.Value))) { // They're calling ".Value" off of a nullable. Because we're moving to ?. // we want to remove the .Value as well. i.e. we should generate: diff --git a/src/EditorFeatures/Core/Lightup/ISmartRenameSessionWrapper.cs b/src/EditorFeatures/Core/Lightup/ISmartRenameSessionWrapper.cs index e81fc283634cf..45efb9baff566 100644 --- a/src/EditorFeatures/Core/Lightup/ISmartRenameSessionWrapper.cs +++ b/src/EditorFeatures/Core/Lightup/ISmartRenameSessionWrapper.cs @@ -63,10 +63,10 @@ static ISmartRenameSessionWrapper() defaultValue: SpecializedTasks.Null()); s_renameContextImmutableListBuilderAddAccessor = LightupHelpers.CreateActionAccessor(typeof(ImmutableArray<>.Builder).MakeGenericType(s_wrappedRenameContextType), - nameof(ImmutableArray<>.Builder.Add), + nameof(ImmutableArray.Builder.Add), s_wrappedRenameContextType); s_renameContextImmutableListBuilderToArrayAccessor = LightupHelpers.CreateFunctionAccessor(typeof(ImmutableArray<>.Builder).MakeGenericType(s_wrappedRenameContextType), - nameof(ImmutableArray<>.Builder.ToImmutable), + nameof(ImmutableArray.Builder.ToImmutable), typeof(ImmutableArray<>).MakeGenericType(s_wrappedRenameContextType)); var immutableArrayOfRenameContextType = typeof(ImmutableArray<>).MakeGenericType(s_wrappedRenameContextType); diff --git a/src/EditorFeatures/TestUtilities/Diagnostics/DiagnosticTaggerWrapper.cs b/src/EditorFeatures/TestUtilities/Diagnostics/DiagnosticTaggerWrapper.cs index 9cdf858031e31..3dfd854ead0d1 100644 --- a/src/EditorFeatures/TestUtilities/Diagnostics/DiagnosticTaggerWrapper.cs +++ b/src/EditorFeatures/TestUtilities/Diagnostics/DiagnosticTaggerWrapper.cs @@ -55,7 +55,7 @@ public AbstractDiagnosticsTaggerProvider TaggerProvider { if (_taggerProvider == null) { - WpfTestRunner.RequireWpfFact($"{nameof(DiagnosticTaggerWrapper<,>)}.{nameof(TaggerProvider)} creates asynchronous taggers"); + WpfTestRunner.RequireWpfFact($"{nameof(DiagnosticTaggerWrapper)}.{nameof(TaggerProvider)} creates asynchronous taggers"); if (typeof(TProvider) == typeof(InlineDiagnosticsTaggerProvider)) { diff --git a/src/Features/CSharp/Portable/ConvertLinq/ConvertForEachToLinqQuery/ToToListConverter.cs b/src/Features/CSharp/Portable/ConvertLinq/ConvertForEachToLinqQuery/ToToListConverter.cs index 234c5ba672848..5785807a26f2f 100644 --- a/src/Features/CSharp/Portable/ConvertLinq/ConvertForEachToLinqQuery/ToToListConverter.cs +++ b/src/Features/CSharp/Portable/ConvertLinq/ConvertForEachToLinqQuery/ToToListConverter.cs @@ -49,6 +49,6 @@ protected override StatementSyntax CreateDefaultStatement(ExpressionSyntax query SyntaxFactory.MemberAccessExpression( SyntaxKind.SimpleMemberAccessExpression, expression, - SyntaxFactory.IdentifierName(nameof(List<>.AddRange))), + SyntaxFactory.IdentifierName(nameof(List.AddRange))), SyntaxFactory.ArgumentList([SyntaxFactory.Argument(queryOrLinqInvocationExpression)]))); } diff --git a/src/Features/Core/Portable/GenerateComparisonOperators/GenerateComparisonOperatorsCodeRefactoringProvider.cs b/src/Features/Core/Portable/GenerateComparisonOperators/GenerateComparisonOperatorsCodeRefactoringProvider.cs index 3eab31892e73a..eedf9f85b4836 100644 --- a/src/Features/Core/Portable/GenerateComparisonOperators/GenerateComparisonOperatorsCodeRefactoringProvider.cs +++ b/src/Features/Core/Portable/GenerateComparisonOperators/GenerateComparisonOperatorsCodeRefactoringProvider.cs @@ -119,7 +119,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte private static IMethodSymbol? TryGetCompareMethodImpl(INamedTypeSymbol containingType, ITypeSymbol comparableType) { - foreach (var member in comparableType.GetMembers(nameof(IComparable<>.CompareTo))) + foreach (var member in comparableType.GetMembers(nameof(IComparable.CompareTo))) { if (member is IMethodSymbol method) return (IMethodSymbol?)containingType.FindImplementationForInterfaceMember(method); diff --git a/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/MethodHandlerDetails.cs b/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/MethodHandlerDetails.cs index 62d8c66ad2c36..83f087cb0eb3e 100644 --- a/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/MethodHandlerDetails.cs +++ b/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/MethodHandlerDetails.cs @@ -115,9 +115,9 @@ private static (string name, IEnumerable languages) GetRequestHandlerMet static LanguageServerEndpointAttribute? GetMethodAttributeFromHandlerMethod(Type handlerType, Type? requestType, Type contextType, Type? responseType) { - const string HandleRequestName = nameof(IRequestHandler<,,>.HandleRequestAsync); + const string HandleRequestName = nameof(IRequestHandler.HandleRequestAsync); const string HandleRequestSuffix = "." + HandleRequestName; - const string HandleNotificationName = nameof(INotificationHandler<,>.HandleNotificationAsync); + const string HandleNotificationName = nameof(INotificationHandler.HandleNotificationAsync); const string HandleNotificationSuffix = "." + HandleNotificationName; foreach (var methodInfo in handlerType.GetRuntimeMethods()) diff --git a/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/RequestExecutionQueue.cs b/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/RequestExecutionQueue.cs index f8f0cb307fb63..a45651f422bab 100644 --- a/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/RequestExecutionQueue.cs +++ b/src/LanguageServer/Microsoft.CommonLanguageServerProtocol.Framework/RequestExecutionQueue.cs @@ -55,7 +55,7 @@ namespace Microsoft.CommonLanguageServerProtocol.Framework; internal class RequestExecutionQueue : IRequestExecutionQueue { private static readonly MethodInfo s_processQueueCoreAsync = typeof(RequestExecutionQueue) - .GetMethod(nameof(RequestExecutionQueue<>.ProcessQueueCoreAsync), BindingFlags.NonPublic | BindingFlags.Instance)!; + .GetMethod(nameof(RequestExecutionQueue.ProcessQueueCoreAsync), BindingFlags.NonPublic | BindingFlags.Instance)!; protected readonly ILspLogger _logger; protected readonly AbstractHandlerProvider _handlerProvider; diff --git a/src/RoslynAnalyzers/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/Helpers/DiagnosticWellKnownNames.cs b/src/RoslynAnalyzers/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/Helpers/DiagnosticWellKnownNames.cs index 922f3132c659f..1cf75aeaeaf68 100644 --- a/src/RoslynAnalyzers/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/Helpers/DiagnosticWellKnownNames.cs +++ b/src/RoslynAnalyzers/Microsoft.CodeAnalysis.Analyzers/Core/MetaAnalyzers/Helpers/DiagnosticWellKnownNames.cs @@ -11,7 +11,7 @@ internal static class DiagnosticWellKnownNames internal const string RegisterSyntaxNodeActionName = nameof(AnalysisContext.RegisterSyntaxNodeAction); internal const string RegisterSymbolActionName = nameof(AnalysisContext.RegisterSymbolAction); internal const string RegisterCodeBlockStartActionName = nameof(AnalysisContext.RegisterCodeBlockStartAction); - internal const string RegisterCodeBlockEndActionName = nameof(CodeBlockStartAnalysisContext<>.RegisterCodeBlockEndAction); + internal const string RegisterCodeBlockEndActionName = nameof(CodeBlockStartAnalysisContext.RegisterCodeBlockEndAction); internal const string RegisterCodeBlockActionName = nameof(AnalysisContext.RegisterCodeBlockAction); internal const string RegisterOperationBlockStartActionName = nameof(AnalysisContext.RegisterOperationBlockStartAction); internal const string RegisterOperationBlockEndActionName = nameof(OperationBlockStartAnalysisContext.RegisterOperationBlockEndAction); diff --git a/src/RoslynAnalyzers/Roslyn.Diagnostics.Analyzers/Core/AbstractApplyTraitToClass`1.cs b/src/RoslynAnalyzers/Roslyn.Diagnostics.Analyzers/Core/AbstractApplyTraitToClass`1.cs index 43e41122137b8..7504d7d45c2ee 100644 --- a/src/RoslynAnalyzers/Roslyn.Diagnostics.Analyzers/Core/AbstractApplyTraitToClass`1.cs +++ b/src/RoslynAnalyzers/Roslyn.Diagnostics.Analyzers/Core/AbstractApplyTraitToClass`1.cs @@ -61,7 +61,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte CodeAction.Create( RoslynDiagnosticsAnalyzersResources.ApplyTraitToContainingType, cancellationToken => ApplyTraitToClassAsync(state, cancellationToken), - nameof(AbstractApplyTraitToClass<>))); + nameof(AbstractApplyTraitToClass))); } private async Task ApplyTraitToClassAsync(State state, CancellationToken cancellationToken) diff --git a/src/RoslynAnalyzers/Roslyn.Diagnostics.Analyzers/Core/AbstractCreateTestAccessor`1.cs b/src/RoslynAnalyzers/Roslyn.Diagnostics.Analyzers/Core/AbstractCreateTestAccessor`1.cs index 4ac28004fcd50..54dcd6456817b 100644 --- a/src/RoslynAnalyzers/Roslyn.Diagnostics.Analyzers/Core/AbstractCreateTestAccessor`1.cs +++ b/src/RoslynAnalyzers/Roslyn.Diagnostics.Analyzers/Core/AbstractCreateTestAccessor`1.cs @@ -49,7 +49,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte CodeAction.Create( RoslynDiagnosticsAnalyzersResources.CreateTestAccessorMessage, cancellationToken => CreateTestAccessorAsync(context.Document, location.SourceSpan, cancellationToken), - nameof(AbstractCreateTestAccessor<>))); + nameof(AbstractCreateTestAccessor))); } private static bool IsClassOrStruct(ITypeSymbol typeSymbol) diff --git a/src/Tools/ExternalAccess/Extensions/Internal/ExtensionMessageHandlerWrapper.cs b/src/Tools/ExternalAccess/Extensions/Internal/ExtensionMessageHandlerWrapper.cs index f93565fcb6c1d..7cc16748d45d3 100644 --- a/src/Tools/ExternalAccess/Extensions/Internal/ExtensionMessageHandlerWrapper.cs +++ b/src/Tools/ExternalAccess/Extensions/Internal/ExtensionMessageHandlerWrapper.cs @@ -27,7 +27,7 @@ protected ExtensionHandlerWrapper(object handler, Type customMessageHandlerInter ExtensionIdentifier = extensionIdentifier; _executeAsyncMethod = customMessageHandlerInterface.GetMethod(nameof(ExecuteAsync)); - _responseTaskResultProperty = typeof(Task<>).MakeGenericType(ResponseType).GetProperty(nameof(Task<>.Result)); + _responseTaskResultProperty = typeof(Task<>).MakeGenericType(ResponseType).GetProperty(nameof(Task.Result)); } public Type MessageType { get; } diff --git a/src/VisualStudio/CSharp/Test/CodeModel/AbstractFileCodeElementTests.cs b/src/VisualStudio/CSharp/Test/CodeModel/AbstractFileCodeElementTests.cs index 11dcb0e058834..8e648c1479f99 100644 --- a/src/VisualStudio/CSharp/Test/CodeModel/AbstractFileCodeElementTests.cs +++ b/src/VisualStudio/CSharp/Test/CodeModel/AbstractFileCodeElementTests.cs @@ -61,7 +61,7 @@ protected static (EditorTestWorkspace workspace, FileCodeModel fileCodeModel) Cr protected CodeElement GetCodeElement(params object[] path) { - WpfTestRunner.RequireWpfFact($"Tests create {nameof(CodeElement)}s which use the affinitized {nameof(CleanableWeakComHandleTable<,>)}"); + WpfTestRunner.RequireWpfFact($"Tests create {nameof(CodeElement)}s which use the affinitized {nameof(CleanableWeakComHandleTable)}"); if (path.Length == 0) { diff --git a/src/Workspaces/CoreTest/UtilityTest/AsyncLazyTests.cs b/src/Workspaces/CoreTest/UtilityTest/AsyncLazyTests.cs index e0ee92943f719..c9424a771e567 100644 --- a/src/Workspaces/CoreTest/UtilityTest/AsyncLazyTests.cs +++ b/src/Workspaces/CoreTest/UtilityTest/AsyncLazyTests.cs @@ -183,7 +183,7 @@ private static void GetValueOrGetValueAsyncThrowsCorrectExceptionDuringCancellat try { doGetValue(lazy, cancellationTokenSource.Token); - AssertEx.Fail(nameof(AsyncLazy<>.GetValue) + " did not throw an exception."); + AssertEx.Fail(nameof(AsyncLazy.GetValue) + " did not throw an exception."); } catch (OperationCanceledException oce) { @@ -211,7 +211,7 @@ public void GetValueAsyncThatIsCancelledReturnsTaskCancelledWithCorrectToken() try { task.Wait(); - AssertEx.Fail(nameof(AsyncLazy<>.GetValueAsync) + " did not throw an exception."); + AssertEx.Fail(nameof(AsyncLazy.GetValueAsync) + " did not throw an exception."); } catch (AggregateException ex) { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Utilities/TypeStyle/CSharpUseImplicitTypeHelper.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Utilities/TypeStyle/CSharpUseImplicitTypeHelper.cs index 5f38dac59b397..0ad0363d96bfd 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Utilities/TypeStyle/CSharpUseImplicitTypeHelper.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Utilities/TypeStyle/CSharpUseImplicitTypeHelper.cs @@ -321,7 +321,7 @@ protected override bool AssignmentSupportsStylePreference( return declaredType.Equals(initializerType) && declaredType is { - Name: nameof(Func<>) or nameof(Action<>), + Name: nameof(Func) or nameof(Action), ContainingSymbol: INamespaceSymbol { Name: nameof(System), ContainingNamespace.IsGlobalNamespace: true } }; } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/ReferenceCountedDisposable.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/ReferenceCountedDisposable.cs index 8dad134d0367b..e1d76bd0d909d 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/ReferenceCountedDisposable.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Utilities/ReferenceCountedDisposable.cs @@ -115,7 +115,7 @@ private ReferenceCountedDisposable(T instance, BoxedReferenceCount referenceCoun /// it returns after any code invokes . /// /// The target object. - public T Target => _instance ?? throw new ObjectDisposedException(nameof(ReferenceCountedDisposable<>)); + public T Target => _instance ?? throw new ObjectDisposedException(nameof(ReferenceCountedDisposable)); /// /// Increments the reference count for the disposable object, and returns a new disposable reference to it. diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Extensions/Symbols/ITypeSymbolExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Extensions/Symbols/ITypeSymbolExtensions.cs index 903d92bd3a723..66f23193e84ea 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Extensions/Symbols/ITypeSymbolExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Extensions/Symbols/ITypeSymbolExtensions.cs @@ -749,7 +749,7 @@ public static bool IsSpanOrReadOnlySpan([NotNullWhen(true)] this ITypeSymbol? ty public static bool IsSpan([NotNullWhen(true)] this ITypeSymbol? type) => type is INamedTypeSymbol { - Name: nameof(Span<>), + Name: nameof(Span), TypeArguments.Length: 1, ContainingNamespace: { Name: nameof(System), ContainingNamespace.IsGlobalNamespace: true } }; @@ -757,7 +757,7 @@ public static bool IsSpan([NotNullWhen(true)] this ITypeSymbol? type) public static bool IsReadOnlySpan([NotNullWhen(true)] this ISymbol? symbol) => symbol is INamedTypeSymbol { - Name: nameof(ReadOnlySpan<>), + Name: nameof(ReadOnlySpan), TypeArguments.Length: 1, ContainingNamespace: { Name: nameof(System), ContainingNamespace.IsGlobalNamespace: true } }; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpTypeInferenceService.TypeInferrer.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpTypeInferenceService.TypeInferrer.cs index ce0579c5c755c..85325ad9d36d0 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpTypeInferenceService.TypeInferrer.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpTypeInferenceService.TypeInferrer.cs @@ -1723,13 +1723,13 @@ private IEnumerable InferTypeForExpressionOfMemberAccessExpre // then we can figure out what 'goo' should be based on teh await // context. var name = memberAccessExpression.Name.Identifier.Value; - if (name.Equals(nameof(Task<>.ConfigureAwait)) && + if (name.Equals(nameof(Task.ConfigureAwait)) && memberAccessExpression?.Parent is InvocationExpressionSyntax invocation && memberAccessExpression.Parent.IsParentKind(SyntaxKind.AwaitExpression)) { return InferTypes(invocation); } - else if (name.Equals(nameof(Task<>.ContinueWith))) + else if (name.Equals(nameof(Task.ContinueWith))) { // goo.ContinueWith(...) // We want to infer Task. For now, we'll just do Task, diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/SyntaxGeneratorExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/SyntaxGeneratorExtensions.cs index 36f291679cddc..605627f735c8c 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/SyntaxGeneratorExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/SyntaxGeneratorExtensions.cs @@ -77,7 +77,7 @@ public static SyntaxNode GetDefaultEqualityComparer( { var equalityComparerType = compilation.EqualityComparerOfTType(); var typeExpression = equalityComparerType == null - ? factory.GenericName(nameof(EqualityComparer<>), type) + ? factory.GenericName(nameof(EqualityComparer), type) : generatorInternal.Type(equalityComparerType.Construct(type), typeContext: false); return factory.MemberAccessExpression(typeExpression, factory.IdentifierName(DefaultName)); From 71cc05dad5f064ebe57814a727bed959737306f2 Mon Sep 17 00:00:00 2001 From: Rikki Gibson Date: Wed, 11 Jun 2025 19:39:13 -0700 Subject: [PATCH 6/6] Revert "Update to using simple untyped lambdas (#78732)" This reverts commit a8808be5f59ea35691b3b7c1f945c895f685b320, reversing changes made to 6a09280b2e91933aedf9e64ee45f991259b87211. --- .../EditAndContinueLanguageServiceTests.cs | 2 +- ...CSharpConvertLinqQueryToForEachProvider.cs | 3 +- ...NotImplementedExceptionFixProviderTests.cs | 2 +- .../RemoteEditAndContinueServiceTests.cs | 2 +- ...LanguageServerClientTests.TestLspClient.cs | 2 +- .../PropertySetAnalysisTests.cs | 56 +++++++++---------- ...bstractCategorizedAnalyzerConfigOptions.cs | 2 +- ...gregateCategorizedAnalyzerConfigOptions.cs | 2 +- .../Options/AnalyzerOptionsExtensions.cs | 2 +- .../DisposeAnalysis/DisposeAnalysis.cs | 3 +- ...sis.PropertySetDataFlowOperationVisitor.cs | 8 +-- .../HardcodedSymmetricAlgorithmKeysSources.cs | 2 +- src/Tools/PrepareTests/Program.cs | 6 +- src/Tools/Source/RunTests/Options.cs | 34 +++++------ .../Common/TableControlFocusFixer.cs | 2 +- .../VisualStudioWorkspaceImpl.cs | 2 +- ...ferencesTableProvider.ColumnDefinitions.cs | 2 +- .../CSharpCodeGenerationService.cs | 4 +- 18 files changed, 69 insertions(+), 67 deletions(-) diff --git a/src/EditorFeatures/Test/EditAndContinue/EditAndContinueLanguageServiceTests.cs b/src/EditorFeatures/Test/EditAndContinue/EditAndContinueLanguageServiceTests.cs index 4adad87eca107..5f0c1571e4343 100644 --- a/src/EditorFeatures/Test/EditAndContinue/EditAndContinueLanguageServiceTests.cs +++ b/src/EditorFeatures/Test/EditAndContinue/EditAndContinueLanguageServiceTests.cs @@ -143,7 +143,7 @@ await localWorkspace.ChangeSolutionAsync(localWorkspace.CurrentSolution // EnterBreakStateAsync - mockEncService.BreakStateOrCapabilitiesChangedImpl = inBreakState => + mockEncService.BreakStateOrCapabilitiesChangedImpl = (bool? inBreakState) => { Assert.True(inBreakState); }; diff --git a/src/Features/CSharp/Portable/ConvertLinq/CSharpConvertLinqQueryToForEachProvider.cs b/src/Features/CSharp/Portable/ConvertLinq/CSharpConvertLinqQueryToForEachProvider.cs index b200a250d3aa4..0babb22fbf6a6 100644 --- a/src/Features/CSharp/Portable/ConvertLinq/CSharpConvertLinqQueryToForEachProvider.cs +++ b/src/Features/CSharp/Portable/ConvertLinq/CSharpConvertLinqQueryToForEachProvider.cs @@ -760,7 +760,8 @@ private bool TryConvertIfInReturnStatement( // } // // yield break; - var statements = GenerateStatements(expression => YieldStatement(SyntaxKind.YieldReturnStatement, expression), queryExpressionProcessingInfo); + var statements = GenerateStatements((ExpressionSyntax expression) + => YieldStatement(SyntaxKind.YieldReturnStatement, expression), queryExpressionProcessingInfo); // add an yield break to avoid throws after the return. var yieldBreakStatement = YieldStatement(SyntaxKind.YieldBreakStatement); diff --git a/src/Features/CSharpTest/Copilot/CSharpImplementNotImplementedExceptionFixProviderTests.cs b/src/Features/CSharpTest/Copilot/CSharpImplementNotImplementedExceptionFixProviderTests.cs index ef907cb0c55fa..3e7bf465b0193 100644 --- a/src/Features/CSharpTest/Copilot/CSharpImplementNotImplementedExceptionFixProviderTests.cs +++ b/src/Features/CSharpTest/Copilot/CSharpImplementNotImplementedExceptionFixProviderTests.cs @@ -176,7 +176,7 @@ public interface IMathService } .WithMockCopilotService(copilotService => { - copilotService.SetupFixAll = (document, memberReferences, cancellationToken) => + copilotService.SetupFixAll = (Document document, ImmutableDictionary> memberReferences, CancellationToken cancellationToken) => { // Create a map of method/property implementations var implementationMap = new Dictionary diff --git a/src/Features/Test/EditAndContinue/RemoteEditAndContinueServiceTests.cs b/src/Features/Test/EditAndContinue/RemoteEditAndContinueServiceTests.cs index 943282d04a608..a2c51883bcb7d 100644 --- a/src/Features/Test/EditAndContinue/RemoteEditAndContinueServiceTests.cs +++ b/src/Features/Test/EditAndContinue/RemoteEditAndContinueServiceTests.cs @@ -154,7 +154,7 @@ await localWorkspace.ChangeSolutionAsync(localWorkspace.CurrentSolution // BreakStateChanged - mockEncService.BreakStateOrCapabilitiesChangedImpl = inBreakState => + mockEncService.BreakStateOrCapabilitiesChangedImpl = (bool? inBreakState) => { Assert.True(inBreakState); }; diff --git a/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Utilities/AbstractLanguageServerClientTests.TestLspClient.cs b/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Utilities/AbstractLanguageServerClientTests.TestLspClient.cs index 2bfef2e95b7e2..6c316b120015e 100644 --- a/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Utilities/AbstractLanguageServerClientTests.TestLspClient.cs +++ b/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/Utilities/AbstractLanguageServerClientTests.TestLspClient.cs @@ -162,7 +162,7 @@ Action GetMessageLogger(string method) { var logger = _loggerFactory.CreateLogger($"LSP {method}"); - return (type, message) => + return (int type, string message) => { var logLevel = (MessageType)type switch { diff --git a/src/RoslynAnalyzers/Utilities.UnitTests/FlowAnalysis/Analysis/PropertySetAnalysis/PropertySetAnalysisTests.cs b/src/RoslynAnalyzers/Utilities.UnitTests/FlowAnalysis/Analysis/PropertySetAnalysis/PropertySetAnalysisTests.cs index 7bc11c1c05e9c..62a481955ac45 100644 --- a/src/RoslynAnalyzers/Utilities.UnitTests/FlowAnalysis/Analysis/PropertySetAnalysis/PropertySetAnalysisTests.cs +++ b/src/RoslynAnalyzers/Utilities.UnitTests/FlowAnalysis/Analysis/PropertySetAnalysis/PropertySetAnalysisTests.cs @@ -224,7 +224,7 @@ public static void StaticMethod(TestTypeToTrack staticMethodParameter) new PropertyMapperCollection( new PropertyMapper( // Definitely null => unflagged, definitely non-null => flagged, otherwise => maybe. "AString", - pointsToAbstractValue => + (PointsToAbstractValue pointsToAbstractValue) => { return pointsToAbstractValue.NullState switch { @@ -237,7 +237,7 @@ public static void StaticMethod(TestTypeToTrack staticMethodParameter) new HazardousUsageEvaluatorCollection( new HazardousUsageEvaluator( // When TypeToTrack.Method() is invoked, need to evaluate its state. "Method", - (methodSymbol, abstractValue) => + (IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) => { // When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments. @@ -253,7 +253,7 @@ public static void StaticMethod(TestTypeToTrack staticMethodParameter) "OtherClass", "OtherMethod", "t", - (methodSymbol, abstractValue) => + (IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) => { // When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments. @@ -270,7 +270,7 @@ public static void StaticMethod(TestTypeToTrack staticMethodParameter) "OtherClass", "StaticMethod", "staticMethodParameter", - (methodSymbol, abstractValue) => + (IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) => { // When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments. @@ -399,7 +399,7 @@ void TestMethod() new( "TestTypeToTrackWithConstructor", new ConstructorMapper( - (method, argumentPointsToAbstractValues) => + (IMethodSymbol method, IReadOnlyList argumentPointsToAbstractValues) => { // When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments. PropertySetAbstractValueKind kind = PropertySetAbstractValueKind.Unknown; @@ -420,7 +420,7 @@ void TestMethod() new PropertyMapperCollection( new PropertyMapper( // Definitely null => unflagged, definitely non-null => flagged, otherwise => maybe. "AString", - pointsToAbstractValue => + (PointsToAbstractValue pointsToAbstractValue) => { return pointsToAbstractValue.NullState switch { @@ -433,7 +433,7 @@ void TestMethod() new HazardousUsageEvaluatorCollection( new HazardousUsageEvaluator( "Method", - (methodSymbol, abstractValue) => + (IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) => { // When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments. @@ -525,14 +525,14 @@ void TestMethod() new PropertyMapperCollection( new PropertyMapper( "AnEnum", - valueContentAbstractValue => + (ValueContentAbstractValue valueContentAbstractValue) => { return PropertySetCallbacks.EvaluateLiteralValues(valueContentAbstractValue, v => v is not null && v.Equals(0)); })), new HazardousUsageEvaluatorCollection( new HazardousUsageEvaluator( // When TypeToTrack.Method() is invoked, need to evaluate its state. "Method", - (methodSymbol, abstractValue) => + (IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) => { // When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments. @@ -586,7 +586,7 @@ void TestMethod() new( "TestTypeToTrackWithConstructor", new ConstructorMapper( - (method, argumentValueContentAbstractValues, argumentPointsToAbstractValues) => + (IMethodSymbol method, IReadOnlyList argumentValueContentAbstractValues, IReadOnlyList argumentPointsToAbstractValues) => { // When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments. @@ -598,14 +598,14 @@ void TestMethod() new PropertyMapperCollection( new PropertyMapper( "AnEnum", - valueContentAbstractValue => + (ValueContentAbstractValue valueContentAbstractValue) => { return PropertySetCallbacks.EvaluateLiteralValues(valueContentAbstractValue, v => v is not null && v.Equals(0)); })), new HazardousUsageEvaluatorCollection( new HazardousUsageEvaluator( // When TypeToTrack.Method() is invoked, need to evaluate its state. "Method", - (methodSymbol, abstractValue) => + (IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) => { // When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments. @@ -663,7 +663,7 @@ void TestMethod() new PropertyMapperCollection( new PropertyMapper( "AString", - valueContentAbstractValue => + (ValueContentAbstractValue valueContentAbstractValue) => { return PropertySetCallbacks.EvaluateLiteralValues( valueContentAbstractValue, @@ -671,14 +671,14 @@ void TestMethod() }), new PropertyMapper( "AnEnum", - valueContentAbstractValue => + (ValueContentAbstractValue valueContentAbstractValue) => { return PropertySetCallbacks.EvaluateLiteralValues(valueContentAbstractValue, v => v is not null && v.Equals(2)); })), new HazardousUsageEvaluatorCollection( new HazardousUsageEvaluator( "Method", - (methodSymbol, abstractValue) => + (IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) => { // When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments. @@ -823,7 +823,7 @@ void TestMethod() new( "TestTypeToTrackWithConstructor", new ConstructorMapper( - (constructorMethodSymbol, argumentPointsToAbstractValues) => + (IMethodSymbol constructorMethodSymbol, IReadOnlyList argumentPointsToAbstractValues) => { // When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments. @@ -845,7 +845,7 @@ void TestMethod() new PropertyMapperCollection( new PropertyMapper( "AnObject", - pointsToAbstractValue => + (PointsToAbstractValue pointsToAbstractValue) => { // Better to compare LocationTypeOpt to INamedTypeSymbol, but for this demonstration, just using MetadataName. PropertySetAbstractValueKind kind; @@ -865,7 +865,7 @@ void TestMethod() new HazardousUsageEvaluatorCollection( new HazardousUsageEvaluator( // When TypeToTrack.Method() is invoked, need to evaluate its state. "Method", - (methodSymbol, abstractValue) => + (IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) => { // When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments. @@ -946,9 +946,9 @@ void TestMethod() new( "TestTypeToTrackWithConstructor", new ConstructorMapper( - (constructorMethodSymbol, - argumentValueContentAbstractValues, - argumentPointsToAbstractValues) => + (IMethodSymbol constructorMethodSymbol, + IReadOnlyList argumentValueContentAbstractValues, + IReadOnlyList argumentPointsToAbstractValues) => { // When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments. @@ -960,7 +960,7 @@ void TestMethod() new PropertyMapperCollection( new PropertyMapper( "AString", - valueContentAbstractValue => + (ValueContentAbstractValue valueContentAbstractValue) => { return PropertySetCallbacks.EvaluateLiteralValues( valueContentAbstractValue, @@ -969,7 +969,7 @@ void TestMethod() new HazardousUsageEvaluatorCollection( new HazardousUsageEvaluator( // When TypeToTrackWithConstructor.Method() is invoked, need to evaluate its state. "Method", - (methodSymbol, abstractValue) => + (IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) => { // When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments. @@ -1038,7 +1038,7 @@ TestTypeToTrackWithConstructor GetTestType() new PropertyMapperCollection( new PropertyMapper( // Definitely null => unflagged, definitely non-null => flagged, otherwise => maybe. "AString", - pointsToAbstractValue => + (PointsToAbstractValue pointsToAbstractValue) => { return pointsToAbstractValue.NullState switch { @@ -1051,7 +1051,7 @@ TestTypeToTrackWithConstructor GetTestType() new HazardousUsageEvaluatorCollection( new HazardousUsageEvaluator( HazardousUsageEvaluatorKind.Return, - abstractValue => + (PropertySetAbstractValue abstractValue) => { // With only one property being tracked, this is straightforward. return abstractValue[0] switch @@ -1142,7 +1142,7 @@ object TestMethod() new PropertyMapperCollection( new PropertyMapper( // Definitely null => unflagged, definitely non-null => flagged, otherwise => maybe. "AString", - pointsToAbstractValue => + (PointsToAbstractValue pointsToAbstractValue) => { return pointsToAbstractValue.NullState switch { @@ -1155,7 +1155,7 @@ object TestMethod() propertyIndex: 0), // Both AString and AnObject point to index 0. new PropertyMapper( // Definitely null => unflagged, definitely non-null => flagged, otherwise => maybe. "AnObject", - pointsToAbstractValue => + (PointsToAbstractValue pointsToAbstractValue) => { return pointsToAbstractValue.NullState switch { @@ -1169,7 +1169,7 @@ object TestMethod() new HazardousUsageEvaluatorCollection( new HazardousUsageEvaluator( // When TypeToTrack.Method() is invoked, need to evaluate its state. "Method", - (methodSymbol, abstractValue) => + (IMethodSymbol methodSymbol, PropertySetAbstractValue abstractValue) => { // When doing this for reals, need to examine the method to make sure we're looking at the right method and arguments. diff --git a/src/RoslynAnalyzers/Utilities/Compiler/Options/AbstractCategorizedAnalyzerConfigOptions.cs b/src/RoslynAnalyzers/Utilities/Compiler/Options/AbstractCategorizedAnalyzerConfigOptions.cs index 45a7f16852e65..677f050498b13 100644 --- a/src/RoslynAnalyzers/Utilities/Compiler/Options/AbstractCategorizedAnalyzerConfigOptions.cs +++ b/src/RoslynAnalyzers/Utilities/Compiler/Options/AbstractCategorizedAnalyzerConfigOptions.cs @@ -34,7 +34,7 @@ public T GetOptionValue(string optionName, SyntaxTree? tree, DiagnosticDescri optionName, kind, rule, - static (s, tryParseValue, [MaybeNullWhen(returnValue: false)] out parsedValue) => tryParseValue(s, out parsedValue), + static (string s, TryParseValue tryParseValue, [MaybeNullWhen(returnValue: false)] out T parsedValue) => tryParseValue(s, out parsedValue), tryParseValue, defaultValue, out var value)) diff --git a/src/RoslynAnalyzers/Utilities/Compiler/Options/AggregateCategorizedAnalyzerConfigOptions.cs b/src/RoslynAnalyzers/Utilities/Compiler/Options/AggregateCategorizedAnalyzerConfigOptions.cs index 1076a3673a69d..f2c2be47a47c2 100644 --- a/src/RoslynAnalyzers/Utilities/Compiler/Options/AggregateCategorizedAnalyzerConfigOptions.cs +++ b/src/RoslynAnalyzers/Utilities/Compiler/Options/AggregateCategorizedAnalyzerConfigOptions.cs @@ -88,7 +88,7 @@ public T GetOptionValue(string optionName, SyntaxTree? tree, DiagnosticDescri kind, tree, rule, - static (s, tryParseValue, [MaybeNullWhen(returnValue: false)] out parsedValue) => tryParseValue(s, out parsedValue), + static (string s, TryParseValue tryParseValue, [MaybeNullWhen(returnValue: false)] out T parsedValue) => tryParseValue(s, out parsedValue), tryParseValue, defaultValue, out var value)) diff --git a/src/RoslynAnalyzers/Utilities/Compiler/Options/AnalyzerOptionsExtensions.cs b/src/RoslynAnalyzers/Utilities/Compiler/Options/AnalyzerOptionsExtensions.cs index b22afb5a28d82..7591e6a8c8fe2 100644 --- a/src/RoslynAnalyzers/Utilities/Compiler/Options/AnalyzerOptionsExtensions.cs +++ b/src/RoslynAnalyzers/Utilities/Compiler/Options/AnalyzerOptionsExtensions.cs @@ -141,7 +141,7 @@ private static TEnum GetFlagsEnumOptionValue( var analyzerConfigOptions = options.GetOrComputeCategorizedAnalyzerConfigOptions(compilation); return analyzerConfigOptions.GetOptionValue( optionName, tree, rule, - tryParseValue: static (value, out result) => Enum.TryParse(value, ignoreCase: true, result: out result), + tryParseValue: static (string value, out TEnum result) => Enum.TryParse(value, ignoreCase: true, result: out result), defaultValue: defaultValue); } diff --git a/src/RoslynAnalyzers/Utilities/FlowAnalysis/FlowAnalysis/Analysis/DisposeAnalysis/DisposeAnalysis.cs b/src/RoslynAnalyzers/Utilities/FlowAnalysis/FlowAnalysis/Analysis/DisposeAnalysis/DisposeAnalysis.cs index 5ce34d0475b48..2809979ab4e9b 100644 --- a/src/RoslynAnalyzers/Utilities/FlowAnalysis/FlowAnalysis/Analysis/DisposeAnalysis/DisposeAnalysis.cs +++ b/src/RoslynAnalyzers/Utilities/FlowAnalysis/FlowAnalysis/Analysis/DisposeAnalysis/DisposeAnalysis.cs @@ -73,7 +73,8 @@ private DisposeAnalysis(DisposeAnalysisDomain analysisDomain, DisposeDataFlowOpe defaultPointsToAnalysisKind), performCopyAnalysis: analyzerOptions.GetCopyAnalysisOption(rule, owningSymbol, wellKnownTypeProvider.Compilation, defaultValue: performCopyAnalysisIfNotUserConfigured), - isDisposableTypeNotRequiringToBeDisposed: typeSymbol => disposeAnalysisHelper?.IsDisposableTypeNotRequiringToBeDisposed(typeSymbol) == true + isDisposableTypeNotRequiringToBeDisposed: (ITypeSymbol typeSymbol) => + disposeAnalysisHelper?.IsDisposableTypeNotRequiringToBeDisposed(typeSymbol) == true || analyzerOptions.IsConfiguredToSkipAnalysis(rule, typeSymbol, owningSymbol, wellKnownTypeProvider.Compilation), out pointsToAnalysisResult); } diff --git a/src/RoslynAnalyzers/Utilities/FlowAnalysis/FlowAnalysis/Analysis/PropertySetAnalysis/PropertySetAnalysis.PropertySetDataFlowOperationVisitor.cs b/src/RoslynAnalyzers/Utilities/FlowAnalysis/FlowAnalysis/Analysis/PropertySetAnalysis/PropertySetAnalysis.PropertySetDataFlowOperationVisitor.cs index e49802c12a261..c3e6515b97212 100644 --- a/src/RoslynAnalyzers/Utilities/FlowAnalysis/FlowAnalysis/Analysis/PropertySetAnalysis/PropertySetAnalysis.PropertySetDataFlowOperationVisitor.cs +++ b/src/RoslynAnalyzers/Utilities/FlowAnalysis/FlowAnalysis/Analysis/PropertySetAnalysis/PropertySetAnalysis.PropertySetDataFlowOperationVisitor.cs @@ -201,7 +201,7 @@ public override PropertySetAbstractValue VisitObjectCreation(IObjectCreationOper operation.Syntax, operation.Constructor, propertySetInstance, - abstractValue => hazardousUsageEvaluator.InvocationEvaluator!( + (PropertySetAbstractValue abstractValue) => hazardousUsageEvaluator.InvocationEvaluator!( operation.Constructor, abstractValue)); } @@ -466,7 +466,7 @@ public override PropertySetAbstractValue VisitInvocation_NonLambdaOrDelegateOrLo visitedArgument.Value.Syntax, null, visitedArgument.Value, - abstractValue => argumentHazardousUsageEvaluator.ValueEvaluator!(abstractValue)); + (PropertySetAbstractValue abstractValue) => argumentHazardousUsageEvaluator.ValueEvaluator!(abstractValue)); } } } @@ -490,7 +490,7 @@ public override PropertySetAbstractValue VisitInvocation_NonLambdaOrDelegateOrLo originalOperation.Syntax, method, propertySetInstance, - abstractValue => hazardousUsageEvaluator!.InvocationEvaluator!(method, abstractValue)); + (PropertySetAbstractValue abstractValue) => hazardousUsageEvaluator!.InvocationEvaluator!(method, abstractValue)); } else { @@ -659,7 +659,7 @@ protected override void ProcessReturnValue(IOperation? returnValue) returnValue.Syntax, null, returnValue, - abstractValue => hazardousUsageEvaluator.ValueEvaluator!(abstractValue)); + (PropertySetAbstractValue abstractValue) => hazardousUsageEvaluator.ValueEvaluator!(abstractValue)); } } diff --git a/src/RoslynAnalyzers/Utilities/FlowAnalysis/FlowAnalysis/Analysis/TaintedDataAnalysis/HardcodedSymmetricAlgorithmKeysSources.cs b/src/RoslynAnalyzers/Utilities/FlowAnalysis/FlowAnalysis/Analysis/TaintedDataAnalysis/HardcodedSymmetricAlgorithmKeysSources.cs index 69a232747b7e6..703af4f7815bd 100644 --- a/src/RoslynAnalyzers/Utilities/FlowAnalysis/FlowAnalysis/Analysis/TaintedDataAnalysis/HardcodedSymmetricAlgorithmKeysSources.cs +++ b/src/RoslynAnalyzers/Utilities/FlowAnalysis/FlowAnalysis/Analysis/TaintedDataAnalysis/HardcodedSymmetricAlgorithmKeysSources.cs @@ -38,7 +38,7 @@ private static ImmutableHashSet BuildSources() (argumentPointsTos, argumentValueContents) => argumentValueContents.Length == 1 && argumentValueContents[0].LiteralValues.Any( - v => v is string s && s.Length % 4 == 0 && IsLegalKeySize(s.Length * 3 / 4)) + (object? v) => v is string s && s.Length % 4 == 0 && IsLegalKeySize(s.Length * 3 / 4)) } ), }); diff --git a/src/Tools/PrepareTests/Program.cs b/src/Tools/PrepareTests/Program.cs index 4bc87e57c1389..9736449d3a423 100644 --- a/src/Tools/PrepareTests/Program.cs +++ b/src/Tools/PrepareTests/Program.cs @@ -21,10 +21,10 @@ public static int Main(string[] args) var options = new OptionSet() { - { "source=", "Path to binaries", s => source = s }, - { "destination=", "Output path", s => destination = s }, + { "source=", "Path to binaries", (string s) => source = s }, + { "destination=", "Output path", (string s) => destination = s }, { "unix", "If true, prepares tests for unix environment instead of Windows", o => isUnix = o is object }, - { "dotnetPath=", "Path to the dotnet CLI", s => dotnetPath = s }, + { "dotnetPath=", "Path to the dotnet CLI", (string s) => dotnetPath = s }, }; options.Parse(args); diff --git a/src/Tools/Source/RunTests/Options.cs b/src/Tools/Source/RunTests/Options.cs index a148c2dd517e0..40460d1e477c9 100644 --- a/src/Tools/Source/RunTests/Options.cs +++ b/src/Tools/Source/RunTests/Options.cs @@ -166,30 +166,30 @@ public Options( string? targetBranchName = null; var optionSet = new OptionSet() { - { "dotnet=", "Path to dotnet", s => dotnetFilePath = s }, - { "configuration=", "Configuration to test: Debug or Release", s => configuration = s }, + { "dotnet=", "Path to dotnet", (string s) => dotnetFilePath = s }, + { "configuration=", "Configuration to test: Debug or Release", (string s) => configuration = s }, { "runtime=", "The runtime to test: both, core or framework", (TestRuntime t) => testRuntime = t}, - { "include=", "Expression for including unit test dlls: default *.UnitTests.dll", s => includeFilter.Add(s) }, - { "exclude=", "Expression for excluding unit test dlls: default is empty", s => excludeFilter.Add(s) }, - { "arch=", "Architecture to test on: x86, x64 or arm64", s => architecture = s }, + { "include=", "Expression for including unit test dlls: default *.UnitTests.dll", (string s) => includeFilter.Add(s) }, + { "exclude=", "Expression for excluding unit test dlls: default is empty", (string s) => excludeFilter.Add(s) }, + { "arch=", "Architecture to test on: x86, x64 or arm64", (string s) => architecture = s }, { "html", "Include HTML file output", o => includeHtml = o is object }, { "sequential", "Run tests sequentially", o => sequential = o is object }, { "helix", "Run tests on Helix", o => helix = o is object }, - { "helixQueueName=", "Name of the Helix queue to run tests on", s => helixQueueName = s }, - { "helixApiAccessToken=", "Access token for internal helix queues", s => helixApiAccessToken = s }, - { "testfilter=", "xUnit string to pass to --filter, e.g. FullyQualifiedName~TestClass1|Category=CategoryA", s => testFilter = s }, + { "helixQueueName=", "Name of the Helix queue to run tests on", (string s) => helixQueueName = s }, + { "helixApiAccessToken=", "Access token for internal helix queues", (string s) => helixApiAccessToken = s }, + { "testfilter=", "xUnit string to pass to --filter, e.g. FullyQualifiedName~TestClass1|Category=CategoryA", (string s) => testFilter = s }, { "timeout=", "Minute timeout to limit the tests to", (int i) => timeout = i }, - { "out=", "Test result file directory (when running on Helix, this is relative to the Helix work item directory)", s => resultFileDirectory = s }, - { "logs=", "Log file directory (when running on Helix, this is relative to the Helix work item directory)", s => logFileDirectory = s }, + { "out=", "Test result file directory (when running on Helix, this is relative to the Helix work item directory)", (string s) => resultFileDirectory = s }, + { "logs=", "Log file directory (when running on Helix, this is relative to the Helix work item directory)", (string s) => logFileDirectory = s }, { "display=", "Display", (Display d) => display = d }, - { "artifactspath=", "Path to the artifacts directory", s => artifactsPath = s }, - { "procdumppath=", "Path to procdump", s => procDumpFilePath = s }, + { "artifactspath=", "Path to the artifacts directory", (string s) => artifactsPath = s }, + { "procdumppath=", "Path to procdump", (string s) => procDumpFilePath = s }, { "collectdumps", "Whether or not to gather dumps on timeouts and crashes", o => collectDumps = o is object }, - { "accessToken=", "Pipeline access token with permissions to view test history", s => accessToken = s }, - { "projectUri=", "ADO project containing the pipeline", s => projectUri = s }, - { "pipelineDefinitionId=", "Pipeline definition id", s => pipelineDefinitionId = s }, - { "phaseName=", "Pipeline phase name associated with this test run", s => phaseName = s }, - { "targetBranchName=", "Target branch of this pipeline run", s => targetBranchName = s }, + { "accessToken=", "Pipeline access token with permissions to view test history", (string s) => accessToken = s }, + { "projectUri=", "ADO project containing the pipeline", (string s) => projectUri = s }, + { "pipelineDefinitionId=", "Pipeline definition id", (string s) => pipelineDefinitionId = s }, + { "phaseName=", "Pipeline phase name associated with this test run", (string s) => phaseName = s }, + { "targetBranchName=", "Target branch of this pipeline run", (string s) => targetBranchName = s }, }; List assemblyList; diff --git a/src/VisualStudio/Core/Def/EditorConfigSettings/Common/TableControlFocusFixer.cs b/src/VisualStudio/Core/Def/EditorConfigSettings/Common/TableControlFocusFixer.cs index c077bc100d0c7..ec2563b334319 100644 --- a/src/VisualStudio/Core/Def/EditorConfigSettings/Common/TableControlFocusFixer.cs +++ b/src/VisualStudio/Core/Def/EditorConfigSettings/Common/TableControlFocusFixer.cs @@ -20,7 +20,7 @@ internal static class TableControlFocusFixer /// public static void DoNotLoseFocusOnBucketExpandOrCollapse(this IWpfTableControl tableControl) { - tableControl.Control.PreviewLostKeyboardFocus += (sender, e) => + tableControl.Control.PreviewLostKeyboardFocus += (object sender, KeyboardFocusChangedEventArgs e) => { // The tabular data control is a list view, the new focus changing to a different control tells us we've hit this case. // This workaround will break if the underlying implementation of the tabular data control is changed someday. diff --git a/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.cs b/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.cs index 76b11a8c7963a..5adcc2e5756bc 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.cs @@ -172,7 +172,7 @@ internal void SubscribeExternalErrorDiagnosticUpdateSourceToSolutionBuildEvents( // This pattern ensures that we are called whenever the build starts/completes even if it is already in progress. KnownUIContexts.SolutionBuildingContext.WhenActivated(() => { - KnownUIContexts.SolutionBuildingContext.UIContextChanged += (_, e) => + KnownUIContexts.SolutionBuildingContext.UIContextChanged += (object _, UIContextChangedEventArgs e) => { if (e.Activated) { diff --git a/src/VisualStudio/Core/Def/UnusedReferences/Dialog/UnusedReferencesTableProvider.ColumnDefinitions.cs b/src/VisualStudio/Core/Def/UnusedReferences/Dialog/UnusedReferencesTableProvider.ColumnDefinitions.cs index 1547f41a2f163..ec215d1bc0c40 100644 --- a/src/VisualStudio/Core/Def/UnusedReferences/Dialog/UnusedReferencesTableProvider.ColumnDefinitions.cs +++ b/src/VisualStudio/Core/Def/UnusedReferences/Dialog/UnusedReferencesTableProvider.ColumnDefinitions.cs @@ -314,7 +314,7 @@ public override bool TryCreateColumnContent(ITableEntryHandle entry, bool single }; } - combobox.SelectionChanged += (sender, e) => + combobox.SelectionChanged += (object sender, SelectionChangedEventArgs e) => { var action = combobox.SelectedIndex switch { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationService.cs index 7334ce1a85a21..2a2dace9c17a9 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationService.cs @@ -454,13 +454,13 @@ private static SyntaxList RemoveAttributeFromAttributeLists if (attributes.Count == 1) { // Remove the entire attribute list. - ComputePositionAndTriviaForRemoveAttributeList(attributeList, t => t.IsKind(SyntaxKind.EndOfLineTrivia), out positionOfRemovedNode, out trivia); + ComputePositionAndTriviaForRemoveAttributeList(attributeList, (SyntaxTrivia t) => t.IsKind(SyntaxKind.EndOfLineTrivia), out positionOfRemovedNode, out trivia); newAttributeLists = attributeLists.Where(aList => aList != attributeList); } else { // Remove just the given attribute from the attribute list. - ComputePositionAndTriviaForRemoveAttributeFromAttributeList(attributeToRemove, t => t.IsKind(SyntaxKind.CommaToken), out positionOfRemovedNode, out trivia); + ComputePositionAndTriviaForRemoveAttributeFromAttributeList(attributeToRemove, (SyntaxToken t) => t.IsKind(SyntaxKind.CommaToken), out positionOfRemovedNode, out trivia); var newAttributes = SeparatedList(attributes.Where(a => a != attributeToRemove)); var newAttributeList = attributeList.WithAttributes(newAttributes); newAttributeLists = attributeLists.Select(attrList => attrList == attributeList ? newAttributeList : attrList);