From a71761b1ad891a7d74fdec219dea371ad09fbc01 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Thu, 3 Sep 2026 13:09:26 -0700 Subject: [PATCH 01/47] Delete the DiagnosticsToolWindow Nobody on the team has used this in awhile, so we can just delete it. --- Ide.slnf | 1 - Roslyn.slnx | 2 - eng/build.ps1 | 1 - eng/test-determinism.ps1 | 4 - eng/test-rebuild.ps1 | 1 - .../Core/Logging/FunctionIdOptions.cs | 51 ----- ...crosoft.CodeAnalysis.EditorFeatures.csproj | 1 - .../Microsoft.CodeAnalysis.Features.csproj | 1 - src/VisualStudio/Core/Def/Guids.cs | 7 - .../Core/Def/Log/LoggerOptionsStorage.cs | 14 -- ...osoft.VisualStudio.LanguageServices.csproj | 1 - .../Def/Options/VisualStudioOptionStorage.cs | 3 - ...dio.LanguageServices.Implementation.csproj | 1 - .../ServiceHubServicesTests_Telemetry.cs | 61 ----- .../IntegrationTestBuildProject.csproj | 1 - .../DiagnosticsWindow.cs | 74 ------ .../Guids.cs | 20 -- .../Loggers/OutputWindowEventSink.cs | 127 ----------- .../OptionPages/ForceLowMemoryMode.cs | 155 ------------- .../OptionPages/ForceLowMemoryModePage.cs | 46 ---- .../OptionPages/InternalOptionsControl.cs | 215 ------------------ .../OptionPages/PerformanceFunctionIdPage.cs | 20 -- .../OptionPages/PerformanceLoggersPage.cs | 97 -------- .../PackageRegistration.pkgdef | 74 ------ .../Panels/TelemetryPanel.xaml | 26 --- .../Panels/TelemetryPanel.xaml.cs | 153 ------------- .../Panels/WorkspacePanel.xaml | 23 -- .../Panels/WorkspacePanel.xaml.cs | 114 ---------- .../PerfMargin/ActivityLevel.cs | 92 -------- .../PerfMargin/DataModel.cs | 56 ----- .../PerfMargin/PerfActivityEventSink.cs | 42 ---- .../PerfMargin/PerfMarginPanel.cs | 162 ------------- .../PerfMargin/StatusIndicator.xaml | 29 --- .../PerfMargin/StatusIndicator.xaml.cs | 70 ------ .../PkgCmdID.cs | 10 - .../Resources.resx | 123 ---------- .../Resources/Images.png | Bin 989 -> 0 bytes .../Resources/Package.ico | Bin 2998 -> 0 bytes ...slyn.VisualStudio.DiagnosticsWindow.csproj | 70 ------ .../VSPackage.resx | 133 ----------- .../VenusMargin/ProjectionBufferMargin.xaml | 58 ----- .../ProjectionBufferMargin.xaml.cs | 68 ------ .../VenusMargin/ProjectionBufferViewModel.cs | 22 -- .../VenusMargin/ProjectionSpanTag.cs | 21 -- .../ProjectionSpanTagDefinition.cs | 29 --- .../VenusMargin/ProjectionSpanTagger.cs | 79 ------- .../VenusMargin/VenusMargin.cs | 128 ----------- .../VenusMargin/VenusMarginFactory.cs | 43 ---- .../VisualStudioDiagnosticsWindow.vsct | 93 -------- .../VisualStudioDiagnosticsWindowPackage.cs | 118 ---------- .../source.extension.vsixmanifest | 21 -- .../xlf/Resources.cs.xlf | 17 -- .../xlf/Resources.de.xlf | 17 -- .../xlf/Resources.es.xlf | 17 -- .../xlf/Resources.fr.xlf | 17 -- .../xlf/Resources.it.xlf | 17 -- .../xlf/Resources.ja.xlf | 17 -- .../xlf/Resources.ko.xlf | 17 -- .../xlf/Resources.pl.xlf | 17 -- .../xlf/Resources.pt-BR.xlf | 17 -- .../xlf/Resources.ru.xlf | 17 -- .../xlf/Resources.tr.xlf | 17 -- .../xlf/Resources.zh-Hans.xlf | 17 -- .../xlf/Resources.zh-Hant.xlf | 17 -- .../xlf/VSPackage.cs.xlf | 17 -- .../xlf/VSPackage.de.xlf | 17 -- .../xlf/VSPackage.es.xlf | 17 -- .../xlf/VSPackage.fr.xlf | 17 -- .../xlf/VSPackage.it.xlf | 17 -- .../xlf/VSPackage.ja.xlf | 17 -- .../xlf/VSPackage.ko.xlf | 17 -- .../xlf/VSPackage.pl.xlf | 17 -- .../xlf/VSPackage.pt-BR.xlf | 17 -- .../xlf/VSPackage.ru.xlf | 17 -- .../xlf/VSPackage.tr.xlf | 17 -- .../xlf/VSPackage.zh-Hans.xlf | 17 -- .../xlf/VSPackage.zh-Hant.xlf | 17 -- .../VisualStudioDiagnosticsWindow.vsct.cs.xlf | 17 -- .../VisualStudioDiagnosticsWindow.vsct.de.xlf | 17 -- .../VisualStudioDiagnosticsWindow.vsct.es.xlf | 17 -- .../VisualStudioDiagnosticsWindow.vsct.fr.xlf | 17 -- .../VisualStudioDiagnosticsWindow.vsct.it.xlf | 17 -- .../VisualStudioDiagnosticsWindow.vsct.ja.xlf | 17 -- .../VisualStudioDiagnosticsWindow.vsct.ko.xlf | 17 -- .../VisualStudioDiagnosticsWindow.vsct.pl.xlf | 17 -- ...sualStudioDiagnosticsWindow.vsct.pt-BR.xlf | 17 -- .../VisualStudioDiagnosticsWindow.vsct.ru.xlf | 17 -- .../VisualStudioDiagnosticsWindow.vsct.tr.xlf | 17 -- ...alStudioDiagnosticsWindow.vsct.zh-Hans.xlf | 17 -- ...alStudioDiagnosticsWindow.vsct.zh-Hant.xlf | 17 -- ...oft.CodeAnalysis.Workspaces.Desktop.csproj | 1 - .../Microsoft.CodeAnalysis.Workspaces.csproj | 1 - .../IRemoteProcessTelemetryService.cs | 7 - ...soft.CodeAnalysis.Remote.Workspaces.csproj | 1 - .../RemoteProcessTelemetryService.cs | 26 --- 95 files changed, 3460 deletions(-) delete mode 100644 src/EditorFeatures/Core/Logging/FunctionIdOptions.cs delete mode 100644 src/VisualStudio/Core/Def/Log/LoggerOptionsStorage.cs delete mode 100644 src/VisualStudio/Core/Test.Next/Services/ServiceHubServicesTests_Telemetry.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/DiagnosticsWindow.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/Guids.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/Loggers/OutputWindowEventSink.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/ForceLowMemoryMode.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/ForceLowMemoryModePage.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/InternalOptionsControl.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/PerformanceFunctionIdPage.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/PerformanceLoggersPage.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/PackageRegistration.pkgdef delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/Panels/TelemetryPanel.xaml delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/Panels/TelemetryPanel.xaml.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/Panels/WorkspacePanel.xaml delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/Panels/WorkspacePanel.xaml.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/PerfMargin/ActivityLevel.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/PerfMargin/DataModel.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/PerfMargin/PerfActivityEventSink.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/PerfMargin/PerfMarginPanel.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/PerfMargin/StatusIndicator.xaml delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/PerfMargin/StatusIndicator.xaml.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/PkgCmdID.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/Resources.resx delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/Resources/Images.png delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/Resources/Package.ico delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/Roslyn.VisualStudio.DiagnosticsWindow.csproj delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/VSPackage.resx delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/VenusMargin/ProjectionBufferMargin.xaml delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/VenusMargin/ProjectionBufferMargin.xaml.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/VenusMargin/ProjectionBufferViewModel.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/VenusMargin/ProjectionSpanTag.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/VenusMargin/ProjectionSpanTagDefinition.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/VenusMargin/ProjectionSpanTagger.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/VenusMargin/VenusMargin.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/VenusMargin/VenusMarginFactory.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/VisualStudioDiagnosticsWindow.vsct delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/VisualStudioDiagnosticsWindowPackage.cs delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/source.extension.vsixmanifest delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/Resources.cs.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/Resources.de.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/Resources.es.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/Resources.fr.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/Resources.it.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/Resources.ja.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/Resources.ko.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/Resources.pl.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/Resources.pt-BR.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/Resources.ru.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/Resources.tr.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/Resources.zh-Hans.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/Resources.zh-Hant.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VSPackage.cs.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VSPackage.de.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VSPackage.es.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VSPackage.fr.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VSPackage.it.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VSPackage.ja.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VSPackage.ko.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VSPackage.pl.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VSPackage.pt-BR.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VSPackage.ru.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VSPackage.tr.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VSPackage.zh-Hans.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VSPackage.zh-Hant.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VisualStudioDiagnosticsWindow.vsct.cs.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VisualStudioDiagnosticsWindow.vsct.de.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VisualStudioDiagnosticsWindow.vsct.es.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VisualStudioDiagnosticsWindow.vsct.fr.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VisualStudioDiagnosticsWindow.vsct.it.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VisualStudioDiagnosticsWindow.vsct.ja.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VisualStudioDiagnosticsWindow.vsct.ko.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VisualStudioDiagnosticsWindow.vsct.pl.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VisualStudioDiagnosticsWindow.vsct.pt-BR.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VisualStudioDiagnosticsWindow.vsct.ru.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VisualStudioDiagnosticsWindow.vsct.tr.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VisualStudioDiagnosticsWindow.vsct.zh-Hans.xlf delete mode 100644 src/VisualStudio/VisualStudioDiagnosticsToolWindow/xlf/VisualStudioDiagnosticsWindow.vsct.zh-Hant.xlf diff --git a/Ide.slnf b/Ide.slnf index d15708ca46582..7baab02d09810 100644 --- a/Ide.slnf +++ b/Ide.slnf @@ -227,7 +227,6 @@ "src\\VisualStudio\\Setup\\Roslyn.VisualStudio.Setup.csproj", "src\\VisualStudio\\TestUtilities2\\Microsoft.VisualStudio.LanguageServices.Test.Utilities2.vbproj", "src\\VisualStudio\\VisualBasic\\Impl\\Microsoft.VisualStudio.LanguageServices.VisualBasic.vbproj", - "src\\VisualStudio\\VisualStudioDiagnosticsToolWindow\\Roslyn.VisualStudio.DiagnosticsWindow.csproj", "src\\VisualStudio\\Xaml\\Impl\\Microsoft.VisualStudio.LanguageServices.Xaml.csproj", "src\\Workspaces\\CSharpTest\\Microsoft.CodeAnalysis.CSharp.Workspaces.UnitTests.csproj", "src\\Workspaces\\CSharp\\Portable\\Microsoft.CodeAnalysis.CSharp.Workspaces.csproj", diff --git a/Roslyn.slnx b/Roslyn.slnx index ae9bbe622206d..5e3b125f35207 100644 --- a/Roslyn.slnx +++ b/Roslyn.slnx @@ -462,7 +462,6 @@ - @@ -490,7 +489,6 @@ - diff --git a/eng/build.ps1 b/eng/build.ps1 index f8f3e55816a65..8558dbbc08f39 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -659,7 +659,6 @@ function Deploy-VsixViaTool() { "Microsoft.VisualStudio.RazorExtension.Dependencies.vsix", "Microsoft.VisualStudio.RazorExtension.vsix", "ExpressionEvaluatorPackage.vsix", - "Roslyn.VisualStudio.DiagnosticsWindow.vsix", "Microsoft.VisualStudio.IntegrationTest.Setup.vsix") foreach ($vsixFileName in $orderedVsixFileNames) { diff --git a/eng/test-determinism.ps1 b/eng/test-determinism.ps1 index 5e890f395b32f..08a9f2afa1933 100644 --- a/eng/test-determinism.ps1 +++ b/eng/test-determinism.ps1 @@ -28,9 +28,6 @@ $script:skipList = @( # Added to work around https://github.com/dotnet/roslyn/issues/48417 "Microsoft.CodeAnalysis.EditorFeatures2.UnitTests.dll", - # Work around XLF issues https://github.com/dotnet/roslyn/issues/58840 - "Roslyn.VisualStudio.DiagnosticsWindow.dll.key", - # Work around the same XLF ResXFileRef determinism issue in Razor's VSIX package resources. "Microsoft.VisualStudio.RazorExtension.dll.key", @@ -319,4 +316,3 @@ catch { finally { Pop-Location } - diff --git a/eng/test-rebuild.ps1 b/eng/test-rebuild.ps1 index 459be1ffeb953..5cc95502e21ca 100644 --- a/eng/test-rebuild.ps1 +++ b/eng/test-rebuild.ps1 @@ -58,7 +58,6 @@ try { " --exclude net472\Microsoft.VisualStudio.LanguageServices.Implementation.dll" + " --exclude net472\Microsoft.VisualStudio.LanguageServices.VisualBasic.dll" + " --exclude net472\Roslyn.Hosting.Diagnostics.dll" + - " --exclude net472\Roslyn.VisualStudio.DiagnosticsWindow.dll" + # Match Roslyn's existing WindowsDesktop VS package exclusions, which still rebuild with output differences. " --exclude net472\Microsoft.VisualStudio.RazorExtension.dll" + # BuildValidator cannot reliably replay Roslyn SDK WindowsDesktop VS extension builds because diff --git a/src/EditorFeatures/Core/Logging/FunctionIdOptions.cs b/src/EditorFeatures/Core/Logging/FunctionIdOptions.cs deleted file mode 100644 index 3b120e1b8beae..0000000000000 --- a/src/EditorFeatures/Core/Logging/FunctionIdOptions.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; -using Microsoft.CodeAnalysis.Options; - -namespace Microsoft.CodeAnalysis.Internal.Log; - -internal static class FunctionIdOptions -{ - private static readonly ConcurrentDictionary> s_options = []; - - private static readonly Func> s_optionCreator = CreateOption; - - private static Option2 CreateOption(FunctionId id) - { - var name = id.ToString(); - - // This local storage location can be set via vsregedit. Which is available on any VS Command Prompt. - // - // To enable logging: - // - // vsregedit set local [hive name] HKCU Roslyn\Internal\Performance\FunctionId [function name] dword 1 - // - // To disable logging - // - // vsregedit delete local [hive name] HKCU Roslyn\Internal\Performance\FunctionId [function name] - // - // If you want to set it for the default hive, use "" as the hive name (i.e. an empty argument) - return new("FunctionIdOptions_" + name, defaultValue: false); - } - - private static IEnumerable GetFunctionIds() - => Enum.GetValues(); - - public static IEnumerable GetOptions() - => GetFunctionIds().Select(GetOption); - - public static Option2 GetOption(FunctionId id) - => s_options.GetOrAdd(id, s_optionCreator); - - public static Func CreateFunctionIsEnabledPredicate(IGlobalOptionService globalOptions) - { - var functionIdOptions = GetFunctionIds().ToDictionary(id => id, id => globalOptions.GetOption(GetOption(id))); - return functionId => functionIdOptions[functionId]; - } -} diff --git a/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj b/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj index e6c8576a0d315..d05826c64c982 100644 --- a/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj +++ b/src/EditorFeatures/Core/Microsoft.CodeAnalysis.EditorFeatures.csproj @@ -85,7 +85,6 @@ - diff --git a/src/Features/Core/Portable/Microsoft.CodeAnalysis.Features.csproj b/src/Features/Core/Portable/Microsoft.CodeAnalysis.Features.csproj index 76729a862d298..4d99e37d1f090 100644 --- a/src/Features/Core/Portable/Microsoft.CodeAnalysis.Features.csproj +++ b/src/Features/Core/Portable/Microsoft.CodeAnalysis.Features.csproj @@ -109,7 +109,6 @@ - diff --git a/src/VisualStudio/Core/Def/Guids.cs b/src/VisualStudio/Core/Def/Guids.cs index e1f0cda08ed57..fae6b2c4d34bd 100644 --- a/src/VisualStudio/Core/Def/Guids.cs +++ b/src/VisualStudio/Core/Def/Guids.cs @@ -106,13 +106,6 @@ internal static class Guids public const string RoslynCommandSetIdString = "9ed8fbd1-02d6-4223-a99c-a938f97e6dbe"; public const string RoslynGroupIdString = "b61e1a20-8c13-49a9-a727-a0ec091647dd"; - public const string RoslynOptionPageFeatureManagerComponentsIdString = "6F738951-348C-4816-9BA4-F60D92D3E98E"; - public const string RoslynOptionPageFeatureManagerFeaturesIdString = "67989704-F8D7-454A-9053-8E1D3CFF679C"; - public const string RoslynOptionPagePerformanceFunctionIdIdString = "0C537218-3BDD-4CC8-AC4B-CEC152D4871A"; - public const string RoslynOptionPagePerformanceLoggersIdString = "236AC96F-A60D-4BD6-A480-D315151EDC2B"; - public const string RoslynOptionPageInternalDiagnosticsIdString = "48993C4C-C619-42AD-B1C8-79378AD8BEF2"; - public const string RoslynOptionPageInternalSolutionCrawlerIdString = "9702D3BD-F06C-4A6A-974B-7D0C2BC89A72"; - public static readonly Guid RoslynPackageId = new(RoslynPackageIdString); public static readonly Guid RoslynCommandSetId = new(RoslynCommandSetIdString); public static readonly Guid RoslynGroupId = new(RoslynGroupIdString); diff --git a/src/VisualStudio/Core/Def/Log/LoggerOptionsStorage.cs b/src/VisualStudio/Core/Def/Log/LoggerOptionsStorage.cs deleted file mode 100644 index 1c1ae22263b3d..0000000000000 --- a/src/VisualStudio/Core/Def/Log/LoggerOptionsStorage.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.CodeAnalysis.Options; - -namespace Microsoft.VisualStudio.LanguageServices.Implementation; - -internal sealed class LoggerOptionsStorage -{ - public static readonly Option2 EtwLoggerKey = new("visual_studio_etw_logger_key", defaultValue: true); - public static readonly Option2 TraceLoggerKey = new("visual_studio_trace_logger_key", defaultValue: false); - public static readonly Option2 OutputWindowLoggerKey = new("visual_studio_output_window_logger_key", defaultValue: false); -} diff --git a/src/VisualStudio/Core/Def/Microsoft.VisualStudio.LanguageServices.csproj b/src/VisualStudio/Core/Def/Microsoft.VisualStudio.LanguageServices.csproj index 8ea29594e886d..d3fe21937918c 100644 --- a/src/VisualStudio/Core/Def/Microsoft.VisualStudio.LanguageServices.csproj +++ b/src/VisualStudio/Core/Def/Microsoft.VisualStudio.LanguageServices.csproj @@ -76,7 +76,6 @@ - diff --git a/src/VisualStudio/Core/Def/Options/VisualStudioOptionStorage.cs b/src/VisualStudio/Core/Def/Options/VisualStudioOptionStorage.cs index 27bb2d171d873..40e864d2974a5 100644 --- a/src/VisualStudio/Core/Def/Options/VisualStudioOptionStorage.cs +++ b/src/VisualStudio/Core/Def/Options/VisualStudioOptionStorage.cs @@ -403,9 +403,6 @@ public bool TryFetch(LocalUserRegistryOptionPersister persister, OptionKey2 opti {"visual_studio_key_binding_needs_reset", new LocalUserProfileStorage(@"Roslyn\Internal\KeybindingsStatus", "NeedsReset")}, {"visual_studio_key_binding_reset_never_show_again", new LocalUserProfileStorage(@"Roslyn\Internal\KeybindingsStatus", "NeverShowAgain")}, {"visual_studio_resharper_key_binding_status", new LocalUserProfileStorage(@"Roslyn\Internal\KeybindingsStatus", "ReSharperStatus")}, - {"visual_studio_etw_logger_key", new LocalUserProfileStorage(@"Roslyn\Internal\Performance\Logger", "EtwLogger")}, - {"visual_studio_output_window_logger_key", new LocalUserProfileStorage(@"Roslyn\Internal\Performance\Logger", "OutputWindowLogger")}, - {"visual_studio_trace_logger_key", new LocalUserProfileStorage(@"Roslyn\Internal\Performance\Logger", "TraceLogger")}, {"dotnet_enable_lsp_editor", new FeatureFlagStorage(@"Roslyn.LSP.Editor")}, {"dotnet_enable_lsp_semantic_tokens", new FeatureFlagStorage(@"Roslyn.LSP.SemanticTokens")}, {"dotnet_lsp_max_completion_list_size", new LocalUserProfileStorage(@"Roslyn\Internal\Lsp", "MaxCompletionListSize")}, diff --git a/src/VisualStudio/Core/Impl/Microsoft.VisualStudio.LanguageServices.Implementation.csproj b/src/VisualStudio/Core/Impl/Microsoft.VisualStudio.LanguageServices.Implementation.csproj index d54df109ad905..7eb4e6d84cc8a 100644 --- a/src/VisualStudio/Core/Impl/Microsoft.VisualStudio.LanguageServices.Implementation.csproj +++ b/src/VisualStudio/Core/Impl/Microsoft.VisualStudio.LanguageServices.Implementation.csproj @@ -22,7 +22,6 @@ - diff --git a/src/VisualStudio/Core/Test.Next/Services/ServiceHubServicesTests_Telemetry.cs b/src/VisualStudio/Core/Test.Next/Services/ServiceHubServicesTests_Telemetry.cs deleted file mode 100644 index 5068de1d1a073..0000000000000 --- a/src/VisualStudio/Core/Test.Next/Services/ServiceHubServicesTests_Telemetry.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -#nullable disable - -using System.Collections.Immutable; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Internal.Log; -using Microsoft.CodeAnalysis.Remote; -using Microsoft.CodeAnalysis.Remote.Testing; -using Xunit; - -namespace Roslyn.VisualStudio.Next.UnitTests.Remote; - -public sealed partial class ServiceHubServicesTests -{ - /// - /// The Performance Loggers options page pushes diagnostic logger enablement into the OOP process - /// over this API. Covers that the remote host registers a sink while it is enabled and unregisters - /// it when it is not, observed through whether anything is listening for a given - /// - which is also what makes logging free when nothing is. - /// - [Fact] - public async Task TestRemoteProcessEnableLogging() - { - using var workspace = CreateWorkspace(); - using var client = await InProcRemoteHostClient.GetTestClientAsync(workspace).ConfigureAwait(false); - - Assert.False(AnythingIsListening(FunctionId.TestEvent_NotUsed)); - - Assert.True(await SetRemoteLoggingAsync([nameof(TraceEventSink)], [FunctionId.TestEvent_NotUsed])); - Assert.True(AnythingIsListening(FunctionId.TestEvent_NotUsed)); - - // The sink was built with a predicate covering only the requested ids. - Assert.False(AnythingIsListening(FunctionId.RemoteHost_Connect)); - - Assert.True(await SetRemoteLoggingAsync([], [])); - Assert.False(AnythingIsListening(FunctionId.TestEvent_NotUsed)); - - Task SetRemoteLoggingAsync(ImmutableArray loggerTypeNames, ImmutableArray functionIds) - => client.TryInvokeAsync( - (service, cancellationToken) => service.EnableLoggingAsync(loggerTypeNames, functionIds, cancellationToken), - CancellationToken.None).AsTask(); - - // RoslynTelemetry only builds a message when some sink is enabled for the id, so the message - // factory running is exactly "a sink is registered and wants this id". - static bool AnythingIsListening(FunctionId functionId) - { - var listening = false; - RoslynTelemetry.Log(functionId, () => - { - listening = true; - return string.Empty; - }); - - return listening; - } - } -} diff --git a/src/VisualStudio/IntegrationTest/IntegrationTestBuildProject.csproj b/src/VisualStudio/IntegrationTest/IntegrationTestBuildProject.csproj index b82dc3ea2f4fc..53f238a309a9e 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTestBuildProject.csproj +++ b/src/VisualStudio/IntegrationTest/IntegrationTestBuildProject.csproj @@ -31,7 +31,6 @@ - diff --git a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/DiagnosticsWindow.cs b/src/VisualStudio/VisualStudioDiagnosticsToolWindow/DiagnosticsWindow.cs deleted file mode 100644 index a829047a5c922..0000000000000 --- a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/DiagnosticsWindow.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.InteropServices; -using System.Windows.Controls; -using Microsoft.CodeAnalysis; -using Microsoft.VisualStudio.LanguageServices; -using Microsoft.VisualStudio.Shell; -using Roslyn.Hosting.Diagnostics.PerfMargin; - -namespace Roslyn.VisualStudio.DiagnosticsWindow; - -[Guid("b2da68d7-fd1c-491a-a9a0-24f597b9f56c")] -public sealed class DiagnosticsWindow : ToolWindowPane -{ - public VisualStudioWorkspace? Workspace { get; private set; } - - /// - /// Standard constructor for the tool window. - /// - public DiagnosticsWindow(object _) - : base(null) - { - // Set the window title reading it from the resources. - Caption = Resources.ToolWindowTitle; - // Set the image that will appear on the tab of the window frame - // when docked with an other window - // The resource ID correspond to the one defined in the resx file - // while the Index is the offset in the bitmap strip. Each image in - // the strip being 16x16. - BitmapResourceID = 301; - BitmapIndex = 1; - - // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable, - // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on - // the object returned by the Content property. - var perfMarginPanel = new TabItem() - { - Header = "Perf", - Content = new PerfMarginPanel() - }; - - var telemetryPanel = new TabItem() - { - Header = "Telemetry", - Content = new TelemetryPanel() - }; - - var workspacePanel = new TabItem() - { - Header = "Workspace", - Content = new WorkspacePanel(this) - }; - - var tabControl = new TabControl - { - TabStripPlacement = Dock.Bottom - }; - - tabControl.Items.Add(perfMarginPanel); - tabControl.Items.Add(telemetryPanel); - tabControl.Items.Add(workspacePanel); - - Content = tabControl; - } - - public void Initialize(VisualStudioWorkspace workspace) - { - Contract.ThrowIfFalse(Workspace == null); - Workspace = workspace; - } -} diff --git a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/Guids.cs b/src/VisualStudio/VisualStudioDiagnosticsToolWindow/Guids.cs deleted file mode 100644 index 7dc2b9df9bef8..0000000000000 --- a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/Guids.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -#nullable disable - -// MUST match guids.h - -using System; - -namespace Roslyn.VisualStudio.DiagnosticsWindow; - -internal static class GuidList -{ - public const string guidVisualStudioDiagnosticsWindowPkgString = "49e24138-9ee3-49e0-8ede-6b39f49303bf"; - public const string guidVisualStudioDiagnosticsWindowCmdSetString = "f22c2499-790a-4b6c-b0fd-b6f0491e1c9c"; - public const string guidToolWindowPersistanceString = "b2da68d7-fd1c-491a-a9a0-24f597b9f56c"; - - public static readonly Guid guidVisualStudioDiagnosticsWindowCmdSet = new(guidVisualStudioDiagnosticsWindowCmdSetString); -}; diff --git a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/Loggers/OutputWindowEventSink.cs b/src/VisualStudio/VisualStudioDiagnosticsToolWindow/Loggers/OutputWindowEventSink.cs deleted file mode 100644 index 812097d913cf4..0000000000000 --- a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/Loggers/OutputWindowEventSink.cs +++ /dev/null @@ -1,127 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -#nullable disable - -using System; -using System.Threading; -using Microsoft.CodeAnalysis.Editor.Shared.Extensions; -using Microsoft.CodeAnalysis.Editor.Shared.Utilities; -using Microsoft.VisualStudio; -using Microsoft.VisualStudio.ComponentModelHost; -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Shell.Interop; - -namespace Microsoft.CodeAnalysis.Internal.Log; - -/// -/// Implementation of that output to output window -/// -internal sealed class OutputWindowEventSink : IEventSink -{ - private readonly Func _isEnabledPredicate; - - public OutputWindowEventSink(Func isEnabledPredicate) - { - _isEnabledPredicate = isEnabledPredicate; - } - - public bool IsEnabled(FunctionId functionId) - => _isEnabledPredicate(functionId); - - public void Log(FunctionId functionId, LogMessage logMessage) - { - OutputPane.WriteLine(string.Format("[{0}] {1} - {2}", Environment.CurrentManagedThreadId, functionId.ToString(), logMessage.GetMessage())); - } - - public void LogBlockStart(FunctionId functionId, LogMessage logMessage, int uniquePairId, CancellationToken cancellationToken) - { - OutputPane.WriteLine(string.Format("[{0}] Start({1}) : {2} - {3}", Environment.CurrentManagedThreadId, uniquePairId, functionId.ToString(), logMessage.GetMessage())); - } - - public void LogBlockEnd(FunctionId functionId, LogMessage logMessage, int uniquePairId, int delta, CancellationToken cancellationToken) - { - var functionString = functionId.ToString() + (cancellationToken.IsCancellationRequested ? " Canceled" : string.Empty); - OutputPane.WriteLine(string.Format("[{0}] End({1}) : [{2}ms] {3}", Environment.CurrentManagedThreadId, uniquePairId, delta, functionString)); - } - - private sealed class OutputPane - { - private static readonly Guid s_outputPaneGuid = new("BBAFF416-4AF5-41F2-9F93-91F283E43C3B"); - - public static readonly OutputPane s_instance = new(); - - private readonly IServiceProvider _serviceProvider; - private readonly IThreadingContext _threadingContext; - - public static void WriteLine(string value) - { - s_instance.WriteLineInternal(value); - } - - public OutputPane() - { - _serviceProvider = ServiceProvider.GlobalProvider; - - var componentModel = (IComponentModel)_serviceProvider.GetService(typeof(SComponentModel)); - _threadingContext = componentModel.GetService(); - } - - private IVsOutputWindowPane _doNotAccessDirectlyOutputPane; - - private void WriteLineInternal(string value) - { - var pane = GetPane(); - if (pane == null) - { - return; - } - - pane.OutputStringThreadSafe(value + Environment.NewLine); - } - - private IVsOutputWindowPane GetPane() - { - if (_doNotAccessDirectlyOutputPane == null) - { - _threadingContext.JoinableTaskFactory.Run(async () => - { - await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(); - - if (_doNotAccessDirectlyOutputPane != null) - { - // check whether other one already initialized output window. - // the output API already handle double initialization, so this is just quick bail - // rather than any functional issue - return; - } - - var outputWindow = (IVsOutputWindow)_serviceProvider.GetService(typeof(SVsOutputWindow)); - - // this should bring outout window to the front - _doNotAccessDirectlyOutputPane = CreateOutputPane(outputWindow); - }); - } - - return _doNotAccessDirectlyOutputPane; - } - - private IVsOutputWindowPane CreateOutputPane(IVsOutputWindow outputWindow) - { - _threadingContext.ThrowIfNotOnUIThread(); - - // Try to get the workspace pane if it has already been registered - var workspacePaneGuid = s_outputPaneGuid; - - // If the pane has already been created, CreatePane returns it - if (ErrorHandler.Succeeded(outputWindow.CreatePane(ref workspacePaneGuid, "Roslyn Logger Output", fInitVisible: 1, fClearWithSolution: 1)) && - ErrorHandler.Succeeded(outputWindow.GetPane(ref workspacePaneGuid, out var pane))) - { - return pane; - } - - return null; - } - } -} diff --git a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/ForceLowMemoryMode.cs b/src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/ForceLowMemoryMode.cs deleted file mode 100644 index e38d53f5a0733..0000000000000 --- a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/ForceLowMemoryMode.cs +++ /dev/null @@ -1,155 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Options; - -namespace Roslyn.VisualStudio.DiagnosticsWindow.OptionsPages; - -internal sealed class ForceLowMemoryMode -{ - public static readonly Option2 Enabled = new("ForceLowMemoryMode_Enabled", defaultValue: false); - public static readonly Option2 SizeInMegabytes = new("ForceLowMemoryMode_Enabled", defaultValue: 500); - - private readonly IGlobalOptionService _globalOptions; - private MemoryHogger? _hogger; - - public ForceLowMemoryMode(IGlobalOptionService globalOptions) - { - _globalOptions = globalOptions; - - globalOptions.AddOptionChangedHandler(this, Options_OptionChanged); - - RefreshFromSettings(); - } - - private void Options_OptionChanged(object sender, object target, OptionChangedEventArgs e) - { - if (e.HasOption(static option => option.Equals(Enabled) || option.Equals(SizeInMegabytes))) - { - RefreshFromSettings(); - } - } - - private void RefreshFromSettings() - { - var enabled = _globalOptions.GetOption(Enabled); - - if (_hogger != null) - { - _hogger.Cancel(); - _hogger = null; - } - - if (enabled) - { - _hogger = new MemoryHogger(); - _ = _hogger.PopulateAndMonitorAsync(_globalOptions.GetOption(SizeInMegabytes)); - } - } - - private sealed class MemoryHogger - { - private const int BlockSize = 1024 * 1024; // megabyte blocks - private const int MonitorDelay = 10000; // 10 seconds - - private readonly List _blocks = []; - private readonly CancellationTokenSource _cancellationTokenSource = new(); - - public MemoryHogger() - { - } - - public int Count - { - get { return _blocks.Count; } - } - - public void Cancel() - { - _cancellationTokenSource.Cancel(); - } - - public Task PopulateAndMonitorAsync(int size) - { - // run on background thread - return Task.Factory.StartNew(() => this.PopulateAndMonitorWorkerAsync(size), CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default).Unwrap(); - } - - private async Task PopulateAndMonitorWorkerAsync(int size) - { - try - { - try - { - for (var n = 0; n < size; n++) - { - _cancellationTokenSource.Token.ThrowIfCancellationRequested(); - - var block = new byte[BlockSize]; - - // initialize block bits (so the memory actually gets allocated.. silly runtime!) - for (var i = 0; i < BlockSize; i++) - { - block[i] = 0xFF; - } - - _blocks.Add(block); - - // don't hog the thread - await Task.Yield(); - } - } - catch (OutOfMemoryException) - { - } - - // monitor memory to keep it paged in - while (true) - { - _cancellationTokenSource.Token.ThrowIfCancellationRequested(); - - try - { - // access all block bytes - for (var b = 0; b < _blocks.Count; b++) - { - _cancellationTokenSource.Token.ThrowIfCancellationRequested(); - - var block = _blocks[b]; - - byte tmp; - for (var i = 0; i < block.Length; i++) - { - tmp = block[i]; - } - - // don't hog the thread - await Task.Yield(); - } - } - catch (OutOfMemoryException) - { - } - - await Task.Delay(MonitorDelay, _cancellationTokenSource.Token).ConfigureAwait(false); - } - } - catch (OperationCanceledException) - { - _blocks.Clear(); - - // force garbage collection - for (var i = 0; i < 5; i++) - { - GC.Collect(GC.MaxGeneration); - GC.WaitForPendingFinalizers(); - } - } - } - } -} diff --git a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/ForceLowMemoryModePage.cs b/src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/ForceLowMemoryModePage.cs deleted file mode 100644 index bda476d521b8a..0000000000000 --- a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/ForceLowMemoryModePage.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -#nullable disable - -using System; -using System.Runtime.InteropServices; -using System.Windows.Controls; -using Microsoft.VisualStudio.LanguageServices; -using Microsoft.VisualStudio.LanguageServices.Implementation.Options; - -namespace Roslyn.VisualStudio.DiagnosticsWindow.OptionsPages; - -[Guid(Guids.RoslynOptionPageFeatureManagerFeaturesIdString)] -internal sealed class ForceLowMemoryModePage : AbstractOptionPage -{ - protected override AbstractOptionPageControl CreateOptionPage(IServiceProvider serviceProvider, OptionStore optionStore) - => new Control(optionStore); - - internal sealed class Control : InternalOptionsControl - { - public Control(OptionStore optionStore) - : base([], optionStore) - { - } - - protected override void AddOptions(Panel panel) - { - // add force low memory mode option - var lowMemoryGroup = new WrapPanel(); - - var cb = new CheckBox { Content = "Forced Low Memory Mode: allocate" }; - BindToOption(cb, ForceLowMemoryMode.Enabled); - lowMemoryGroup.Children.Add(cb); - - var textBox = new TextBox { MinWidth = 60 }; - BindToOption(textBox, ForceLowMemoryMode.SizeInMegabytes); - lowMemoryGroup.Children.Add(textBox); - - lowMemoryGroup.Children.Add(new TextBlock { Text = "megabytes of extra memory in devenv.exe" }); - - panel.Children.Add(lowMemoryGroup); - } - } -} diff --git a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/InternalOptionsControl.cs b/src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/InternalOptionsControl.cs deleted file mode 100644 index ff997bd13c740..0000000000000 --- a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/InternalOptionsControl.cs +++ /dev/null @@ -1,215 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Windows; -using System.Windows.Controls; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Options; -using Roslyn.Utilities; - -namespace Microsoft.VisualStudio.LanguageServices.Implementation.Options; - -internal partial class InternalOptionsControl : AbstractOptionPageControl -{ - private readonly IEnumerable _options; - - public InternalOptionsControl(IEnumerable options, OptionStore optionStore) - : base(optionStore) - { - _options = options; - - // options - var optionsPanel = new StackPanel(); - this.AddOptions(optionsPanel); - - // scroll - var viewer = new ScrollViewer() - { - VerticalScrollBarVisibility = ScrollBarVisibility.Auto, - HorizontalScrollBarVisibility = ScrollBarVisibility.Auto - }; - - viewer.Content = optionsPanel; - - // search - var searchBox = new TextBox() { MinWidth = 200, HorizontalAlignment = HorizontalAlignment.Stretch }; - - var searchButton = new Button() { Content = "Search" }; - searchButton.Click += (o, a) => - { - foreach (var item in optionsPanel.Children.OfType()) - { - if (item.Content is not string title) - { - continue; - } - - // pattern not match - if (title.IndexOf(searchBox.Text, StringComparison.OrdinalIgnoreCase) < 0) - { - // hide it - item.Visibility = Visibility.Collapsed; - } - else - { - item.Visibility = Visibility.Visible; - } - } - }; - - var clearButton = new Button() { Content = "Clear" }; - clearButton.Click += (o, a) => optionsPanel.Children.OfType().Do(c => c.Visibility = Visibility.Visible); - - var searchPanel = new StackPanel() - { - Orientation = Orientation.Horizontal, - Margin = new Thickness(5), - HorizontalAlignment = HorizontalAlignment.Stretch - }; - - searchPanel.Children.Add(searchBox); - searchPanel.Children.Add(searchButton); - searchPanel.Children.Add(clearButton); - - // button - var checkAllButton = new Button() { Content = "Check All" }; - checkAllButton.Click += (o, a) => optionsPanel.Children.OfType().Where(c => c.Visibility == Visibility.Visible).Do(c => c.IsChecked = true); - - var uncheckAllButton = new Button() { Content = "Uncheck All" }; - uncheckAllButton.Click += (o, a) => optionsPanel.Children.OfType().Where(c => c.Visibility == Visibility.Visible).Do(c => c.IsChecked = false); - - var selectionPanel = new StackPanel() - { - Orientation = Orientation.Horizontal, - Margin = new Thickness(5), - HorizontalAlignment = HorizontalAlignment.Stretch - }; - - selectionPanel.Children.Add(checkAllButton); - selectionPanel.Children.Add(uncheckAllButton); - - // main panel - var mainPanel = new DockPanel() { HorizontalAlignment = HorizontalAlignment.Stretch }; - mainPanel.Children.Add(searchPanel); - mainPanel.Children.Add(selectionPanel); - mainPanel.Children.Add(viewer); - - DockPanel.SetDock(searchPanel, Dock.Top); - DockPanel.SetDock(selectionPanel, Dock.Bottom); - - this.Content = mainPanel; - } - - protected virtual void AddOptions(Panel panel) - { - foreach (var option in _options) - { - if (!option.IsPerLanguage) - { - AddOption(panel, option); - } - else - { - AddPerLanguageOption(panel, option, LanguageNames.CSharp); - AddPerLanguageOption(panel, option, LanguageNames.VisualBasic); - } - } - } - - protected void AddOption(Panel panel, IOption2 option, string additional = null) - { - var uiElement = CreateControl(option, additional: additional); - if (uiElement != null) - { - panel.Children.Add(uiElement); - } - } - - protected void AddPerLanguageOption(Panel panel, IOption2 option, string languageName, string additional = null) - { - var uiElement = CreateControl(option, languageName, additional); - if (uiElement != null) - { - panel.Children.Add(uiElement); - } - } - - private UIElement CreateControl(IOption2 option, string languageName = null, string additional = null) - { - // Underscores in WPF mean that the next character is the access key for keyboard navigation - // but thats not why our option names have underscores. Also removing them looks nicer. - var optionDisplay = option.Definition.ConfigName.Replace('_', ' ') + GetLanguage(languageName) + GetAdditionalText(additional); - - if (option.Type == typeof(bool)) - { - var checkBox = new CheckBox() { Content = optionDisplay }; - BindToCheckBox(checkBox, option, languageName); - return checkBox; - } - - if (option.Type == typeof(int)) - { - var label = new Label() { Content = optionDisplay }; - var textBox = new TextBox(); - BindToTextBox(textBox, option, languageName); - - var panel = new StackPanel(); - panel.Children.Add(label); - panel.Children.Add(textBox); - - AddSearchHandler(label); - - return panel; - } - - return null; - } - - private static string GetAdditionalText(string additional) - { - if (additional == null) - { - return string.Empty; - } - - return " [" + additional + "]"; - } - - private static string GetLanguage(string languageName) - { - if (languageName == null) - { - return string.Empty; - } - - return " [" + languageName + "]"; - } - - private void BindToCheckBox(CheckBox checkBox, IOption2 option, string languageName = null) - { - if (languageName == null) - { - BindToOption(checkBox, (Option2)option); - return; - } - - BindToOption(checkBox, (PerLanguageOption2)option, languageName); - } - - private void BindToTextBox(TextBox textBox, IOption2 option, string languageName = null) - { - if (languageName == null) - { - BindToOption(textBox, (Option2)option); - return; - } - - BindToOption(textBox, (PerLanguageOption2)option, languageName); - } -} diff --git a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/PerformanceFunctionIdPage.cs b/src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/PerformanceFunctionIdPage.cs deleted file mode 100644 index 37e2788a45444..0000000000000 --- a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/PerformanceFunctionIdPage.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Runtime.InteropServices; -using Microsoft.CodeAnalysis.Internal.Log; -using Microsoft.VisualStudio.LanguageServices; -using Microsoft.VisualStudio.LanguageServices.Implementation.Options; - -namespace Roslyn.VisualStudio.DiagnosticsWindow.OptionsPages; - -[Guid(Guids.RoslynOptionPagePerformanceFunctionIdIdString)] -internal sealed class PerformanceFunctionIdPage : AbstractOptionPage -{ - protected override AbstractOptionPageControl CreateOptionPage(IServiceProvider serviceProvider, OptionStore optionStore) - { - return new InternalOptionsControl(FunctionIdOptions.GetOptions(), optionStore); - } -} diff --git a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/PerformanceLoggersPage.cs b/src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/PerformanceLoggersPage.cs deleted file mode 100644 index f7e63341c3bcd..0000000000000 --- a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/OptionPages/PerformanceLoggersPage.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Runtime.InteropServices; -using System.Threading; -using Microsoft.CodeAnalysis.Editor.Shared.Utilities; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Internal.Log; -using Microsoft.CodeAnalysis.Options; -using Microsoft.CodeAnalysis.Remote; -using Microsoft.VisualStudio.ComponentModelHost; -using Microsoft.VisualStudio.LanguageServices; -using Microsoft.VisualStudio.LanguageServices.Implementation; -using Microsoft.VisualStudio.LanguageServices.Implementation.Options; -using Microsoft.VisualStudio.LanguageServices.Telemetry; -using Roslyn.Utilities; - -namespace Roslyn.VisualStudio.DiagnosticsWindow.OptionsPages; - -[Guid(Guids.RoslynOptionPagePerformanceLoggersIdString)] -internal sealed class PerformanceLoggersPage : AbstractOptionPage -{ - private IGlobalOptionService _globalOptions; - private IThreadingContext _threadingContext; - private SolutionServices _workspaceServices; - - private static IDisposable s_etwRegistration; - private static IDisposable s_traceRegistration; - private static IDisposable s_outputWindowRegistration; - - protected override AbstractOptionPageControl CreateOptionPage(IServiceProvider serviceProvider, OptionStore optionStore) - { - if (_globalOptions == null) - { - var componentModel = (IComponentModel)serviceProvider.GetService(typeof(SComponentModel)); - - _globalOptions = componentModel.GetService(); - _threadingContext = componentModel.GetService(); - - var workspace = componentModel.GetService(); - _workspaceServices = workspace.Services.SolutionServices; - } - - return new InternalOptionsControl(FunctionIdOptions.GetOptions(), optionStore); - } - - protected override void OnApply(PageApplyEventArgs e) - { - base.OnApply(e); - - SetLoggers(_globalOptions, _threadingContext, _workspaceServices); - } - - public static void SetLoggers(IGlobalOptionService globalOptions, IThreadingContext threadingContext, SolutionServices workspaceServices) - { - var isEnabled = FunctionIdOptions.CreateFunctionIsEnabledPredicate(globalOptions); - - var etwEnabled = globalOptions.GetOption(LoggerOptionsStorage.EtwLoggerKey); - var traceEnabled = globalOptions.GetOption(LoggerOptionsStorage.TraceLoggerKey); - var outputWindowEnabled = globalOptions.GetOption(LoggerOptionsStorage.OutputWindowLoggerKey); - - // These sinks exist only for this page, so each is registered while enabled and unregistered - // when not. isEnabled is a snapshot of the per-FunctionId options, which is why a fresh sink is - // built on every apply. - Register(ref s_etwRegistration, etwEnabled, () => new EtwEventSink(isEnabled)); - Register(ref s_traceRegistration, traceEnabled, () => new TraceEventSink(isEnabled)); - Register(ref s_outputWindowRegistration, outputWindowEnabled, () => new OutputWindowEventSink(isEnabled)); - - // update loggers in remote process - var client = threadingContext.JoinableTaskFactory.Run(() => RemoteHostClient.TryGetClientAsync(workspaceServices, CancellationToken.None)); - if (client != null) - { - var loggerTypeNames = ImmutableArray.Empty; - if (etwEnabled) - loggerTypeNames = loggerTypeNames.Add(nameof(EtwEventSink)); - if (traceEnabled) - loggerTypeNames = loggerTypeNames.Add(nameof(TraceEventSink)); - - var functionIds = Enum.GetValues().WhereAsArray(isEnabled); - - threadingContext.JoinableTaskFactory.Run(async () => _ = await client.TryInvokeAsync( - (service, cancellationToken) => service.EnableLoggingAsync(loggerTypeNames, functionIds, cancellationToken), - CancellationToken.None).ConfigureAwait(false)); - } - - static void Register(ref IDisposable registration, bool enabled, Func create) - { - Interlocked.Exchange(ref registration, enabled ? RoslynTelemetry.AddEventSink(create()) : null)?.Dispose(); - } - } -} diff --git a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/PackageRegistration.pkgdef b/src/VisualStudio/VisualStudioDiagnosticsToolWindow/PackageRegistration.pkgdef deleted file mode 100644 index 70a262f84bc83..0000000000000 --- a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/PackageRegistration.pkgdef +++ /dev/null @@ -1,74 +0,0 @@ -// ProvideAutoLoad(UIContextGuids80.SolutionExists, PackageAutoLoadFlags.BackgroundLoad) -[$RootKey$\AutoLoadPackages\{f1536ef8-92ec-443c-9ed7-fdadf150da82}] -"{49e24138-9ee3-49e0-8ede-6b39f49303bf}"=dword:00000002 - -[$RootKey$\Menus] -"{49e24138-9ee3-49e0-8ede-6b39f49303bf}"=", Menus.ctmenu, 1" - -// The option page configuration is duplicated on VisualStudioDiagnosticsWindowPackage type definition. - -[$RootKey$\ToolsOptionsPages\Roslyn\FeatureManager] -@="#0" -"Package"="{49e24138-9ee3-49e0-8ede-6b39f49303bf}" - -[$RootKey$\AutomationProperties\Roslyn\FeatureManager] -"Package"="{49e24138-9ee3-49e0-8ede-6b39f49303bf}" - -[$RootKey$\ToolsOptionsPages\Roslyn\FeatureManager] -@="#0" -"Package"="{49e24138-9ee3-49e0-8ede-6b39f49303bf}" - -[$RootKey$\ToolsOptionsPages\Roslyn\FeatureManager\Features] -@="#0" -"Package"="{49e24138-9ee3-49e0-8ede-6b39f49303bf}" -"Page"="{67989704-f8d7-454a-9053-8e1d3cff679c}" - -[$RootKey$\AutomationProperties\Roslyn\FeatureManager] -"Package"="{49e24138-9ee3-49e0-8ede-6b39f49303bf}" - -[$RootKey$\AutomationProperties\Roslyn\FeatureManager\Features] -"Package"="{49e24138-9ee3-49e0-8ede-6b39f49303bf}" - -[$RootKey$\AutomationProperties\Roslyn\FeatureManager\Features] -"Name"="Roslyn\FeatureManager.Features" - -[$RootKey$\ToolsOptionsPages\Roslyn\Performance] -@="#0" -"Package"="{49e24138-9ee3-49e0-8ede-6b39f49303bf}" - -[$RootKey$\ToolsOptionsPages\Roslyn\Performance\FunctionId] -@="#0" -"Package"="{49e24138-9ee3-49e0-8ede-6b39f49303bf}" -"Page"="{0c537218-3bdd-4cc8-ac4b-cec152d4871a}" - -[$RootKey$\AutomationProperties\Roslyn\Performance] -"Package"="{49e24138-9ee3-49e0-8ede-6b39f49303bf}" - -[$RootKey$\AutomationProperties\Roslyn\Performance\FunctionId] -"Package"="{49e24138-9ee3-49e0-8ede-6b39f49303bf}" - -[$RootKey$\AutomationProperties\Roslyn\Performance\FunctionId] -"Name"="Roslyn\Performance.FunctionId" - -[$RootKey$\ToolsOptionsPages\Roslyn\Performance] -@="#0" -"Package"="{49e24138-9ee3-49e0-8ede-6b39f49303bf}" - -[$RootKey$\ToolsOptionsPages\Roslyn\Performance\Loggers] -@="#0" -"Package"="{49e24138-9ee3-49e0-8ede-6b39f49303bf}" -"Page"="{236ac96f-a60d-4bd6-a480-d315151edc2b}" - -[$RootKey$\AutomationProperties\Roslyn\Performance] -"Package"="{49e24138-9ee3-49e0-8ede-6b39f49303bf}" - -[$RootKey$\AutomationProperties\Roslyn\Performance\Loggers] -"Package"="{49e24138-9ee3-49e0-8ede-6b39f49303bf}" - -[$RootKey$\AutomationProperties\Roslyn\Performance\Loggers] -"Name"="Roslyn\Performance.Loggers" - -[$RootKey$\ToolWindows\{b2da68d7-fd1c-491a-a9a0-24f597b9f56c}] -@="{49e24138-9ee3-49e0-8ede-6b39f49303bf}" -"Name"="Roslyn.VisualStudio.DiagnosticsWindow.DiagnosticsWindow" - diff --git a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/Panels/TelemetryPanel.xaml b/src/VisualStudio/VisualStudioDiagnosticsToolWindow/Panels/TelemetryPanel.xaml deleted file mode 100644 index 73ac3cc8c7930..0000000000000 --- a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/Panels/TelemetryPanel.xaml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - -