diff --git a/NuGet.config b/NuGet.config index 687b1bf8e..e0e61bbbf 100644 --- a/NuGet.config +++ b/NuGet.config @@ -6,7 +6,6 @@ - diff --git a/Roslyn-SDK.sln b/Roslyn-SDK.sln index e53c9247b..2715ebfa9 100644 --- a/Roslyn-SDK.sln +++ b/Roslyn-SDK.sln @@ -189,8 +189,6 @@ Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.Visu EndProject Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Microsoft.CodeAnalysis.VisualBasic.SourceGenerators.Testing.XUnit.UnitTests", "tests\Microsoft.CodeAnalysis.Testing\Microsoft.CodeAnalysis.VisualBasic.SourceGenerators.Testing.XUnit.UnitTests\Microsoft.CodeAnalysis.VisualBasic.SourceGenerators.Testing.XUnit.UnitTests.vbproj", "{92BD1781-5DB4-4F72-BCCB-0D64C0790A2B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Roslyn.ComponentDebugger", "src\VisualStudio.Roslyn.SDK\ComponentDebugger\Roslyn.ComponentDebugger.csproj", "{7E91C1C7-A836-4378-8ABC-9298C13228D1}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -541,10 +539,6 @@ Global {92BD1781-5DB4-4F72-BCCB-0D64C0790A2B}.Debug|Any CPU.Build.0 = Debug|Any CPU {92BD1781-5DB4-4F72-BCCB-0D64C0790A2B}.Release|Any CPU.ActiveCfg = Release|Any CPU {92BD1781-5DB4-4F72-BCCB-0D64C0790A2B}.Release|Any CPU.Build.0 = Release|Any CPU - {7E91C1C7-A836-4378-8ABC-9298C13228D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7E91C1C7-A836-4378-8ABC-9298C13228D1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7E91C1C7-A836-4378-8ABC-9298C13228D1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7E91C1C7-A836-4378-8ABC-9298C13228D1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -641,7 +635,6 @@ Global {7D9C0EF5-7383-4E35-811B-3288B3C806F3} = {9905147E-CC1F-42A0-BD27-05586C583DF7} {7C3FE60E-055B-4E0C-BB85-C7E94A640074} = {9905147E-CC1F-42A0-BD27-05586C583DF7} {92BD1781-5DB4-4F72-BCCB-0D64C0790A2B} = {9905147E-CC1F-42A0-BD27-05586C583DF7} - {7E91C1C7-A836-4378-8ABC-9298C13228D1} = {F9B73995-76C6-4056-ADA9-18342F951361} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {56695AA9-EA80-47A7-8562-E51285906C54} diff --git a/eng/Versions.props b/eng/Versions.props index e84c615fa..2976df46c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -10,7 +10,7 @@ true true true - 3.8.0-5.final + 3.8.0-4.20464.1 16.1.1 diff --git a/src/VisualStudio.Roslyn.SDK/ComponentDebugger/CapabilityProvider.cs b/src/VisualStudio.Roslyn.SDK/ComponentDebugger/CapabilityProvider.cs deleted file mode 100644 index b24b37ca4..000000000 --- a/src/VisualStudio.Roslyn.SDK/ComponentDebugger/CapabilityProvider.cs +++ /dev/null @@ -1,43 +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.Collections.Immutable; -using System.ComponentModel.Composition; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.VisualStudio.ProjectSystem; - -namespace Roslyn.ComponentDebugger -{ - [Export(ExportContractNames.Scopes.ConfiguredProject, typeof(IProjectCapabilitiesProvider))] - [AppliesTo(ProjectCapabilities.CSharp + " | " + ProjectCapabilities.VB)] - public class CapabilityProvider : ConfiguredProjectCapabilitiesProviderBase - { - private readonly IProjectSnapshotService snapshotService; - - [ImportingConstructor] - [System.Obsolete("This exported object must be obtained through the MEF export provider.", error: true)] - public CapabilityProvider(ConfiguredProject configuredProject, IProjectSnapshotService snapshotService) - : base(nameof(CapabilityProvider), configuredProject) - { - this.snapshotService = snapshotService; - } - - protected override async Task> GetCapabilitiesAsync(CancellationToken cancellationToken) - { - // an alternative design could be to have 'IsRoslynComponent' just define the _compilerRoot; - - [ImportingConstructor] - [Obsolete("This exported object must be obtained through the MEF export provider.", error: true)] - public DebugProfileProvider(ConfiguredProject configuredProject, IDebugTokenReplacer tokenReplacer, SVsServiceProvider? serviceProvider) - { - _configuredProject = configuredProject; - _tokenReplacer = tokenReplacer; - _compilerRoot = new AsyncLazy(() => GetCompilerRootAsync(serviceProvider), ThreadHelper.JoinableTaskFactory); - } - - public Task OnAfterLaunchAsync(DebugLaunchOptions launchOptions, ILaunchProfile profile) => Task.CompletedTask; - - public Task OnBeforeLaunchAsync(DebugLaunchOptions launchOptions, ILaunchProfile profile) => Task.CompletedTask; - - public bool SupportsProfile(ILaunchProfile? profile) => Constants.CommandName.Equals(profile?.CommandName, StringComparison.Ordinal); - - public async Task> QueryDebugTargetsAsync(DebugLaunchOptions launchOptions, ILaunchProfile? profile) - { - // set up the managed (net fx) debugger to start a process - // https://github.com/dotnet/roslyn-sdk/issues/729 - var settings = new DebugLaunchSettings(launchOptions) - { - LaunchDebugEngineGuid = Microsoft.VisualStudio.ProjectSystem.Debug.DebuggerEngines.ManagedOnlyEngine, - LaunchOperation = DebugLaunchOperation.CreateProcess - }; - - // try and get the target project - var targetProjectUnconfigured = await TryGetTargetProjectAsync(profile).ConfigureAwait(false); - if (targetProjectUnconfigured is object) - { - settings.CurrentDirectory = Path.GetDirectoryName(targetProjectUnconfigured.FullPath); - var compiler = _configuredProject.Capabilities.Contains(ProjectCapabilities.VB) ? "vbc.exe" : "csc.exe"; - var compilerRoot = await _compilerRoot.GetValueAsync().ConfigureAwait(false); - settings.Executable = Path.Combine(compilerRoot, compiler); - - // try and get the configured version of the target project - var targetProject = await targetProjectUnconfigured.GetSuggestedConfiguredProjectAsync().ConfigureAwait(false); - if (targetProject is object) - { - // get its compilation args - var args = await targetProject.GetCompilationArgumentsAsync().ConfigureAwait(false); - - // append the command line args to the debugger launch - settings.Arguments = string.Join(" ", args); - } - } - - // https://github.com/dotnet/roslyn-sdk/issues/728 : better error handling - return new IDebugLaunchSettings[] { settings }; - } - - private static async Task GetCompilerRootAsync(SVsServiceProvider? serviceProvider) - { - await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); - - // https://github.com/dotnet/roslyn-sdk/issues/729 - object rootDir = string.Empty; - var shell = (IVsShell?)serviceProvider?.GetService(typeof(SVsShell)); - shell?.GetProperty((int)__VSSPROPID2.VSSPROPID_InstallRootDir, out rootDir); - return Path.Combine((string)rootDir, "MSBuild", "Current", "Bin", "Roslyn"); - } - - private async Task TryGetTargetProjectAsync(ILaunchProfile? profile) - { - UnconfiguredProject? targetProject = null; - object? value = null; - profile?.OtherSettings?.TryGetValue(Constants.TargetProjectPropertyName, out value); - - if (value is string targetProjectPath) - { - // expand any variables in the path, and root it based on this project - var replacedProjectPath = await _tokenReplacer.ReplaceTokensInStringAsync(targetProjectPath, true).ConfigureAwait(false); - replacedProjectPath = _configuredProject.UnconfiguredProject.MakeRooted(replacedProjectPath); - - targetProject = _configuredProject.Services.ProjectService.LoadedUnconfiguredProjects.SingleOrDefault(p => p.FullPath == replacedProjectPath); - } - - return targetProject; - } - } -} diff --git a/src/VisualStudio.Roslyn.SDK/ComponentDebugger/DebuggerOptions.xaml b/src/VisualStudio.Roslyn.SDK/ComponentDebugger/DebuggerOptions.xaml deleted file mode 100644 index b0b54746a..000000000 --- a/src/VisualStudio.Roslyn.SDK/ComponentDebugger/DebuggerOptions.xaml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/VisualStudio.Roslyn.SDK/ComponentDebugger/DebuggerOptions.xaml.cs b/src/VisualStudio.Roslyn.SDK/ComponentDebugger/DebuggerOptions.xaml.cs deleted file mode 100644 index 0f8a6440e..000000000 --- a/src/VisualStudio.Roslyn.SDK/ComponentDebugger/DebuggerOptions.xaml.cs +++ /dev/null @@ -1,19 +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.Windows.Controls; - -namespace Roslyn.ComponentDebugger -{ - /// - /// Interaction logic for DebuggerOptions.xaml - /// - internal sealed partial class DebuggerOptions : UserControl - { - public DebuggerOptions() - { - InitializeComponent(); - } - } -} diff --git a/src/VisualStudio.Roslyn.SDK/ComponentDebugger/DebuggerOptionsViewModel.cs b/src/VisualStudio.Roslyn.SDK/ComponentDebugger/DebuggerOptionsViewModel.cs deleted file mode 100644 index 00dae05fc..000000000 --- a/src/VisualStudio.Roslyn.SDK/ComponentDebugger/DebuggerOptionsViewModel.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.Collections.Generic; -using System.Collections.Immutable; -using System.ComponentModel; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.VisualStudio.ProjectSystem; -using Microsoft.VisualStudio.ProjectSystem.Debug; - -namespace Roslyn.ComponentDebugger -{ - internal class DebuggerOptionsViewModel : INotifyPropertyChanged - { - private IWritableLaunchProfile? _launchProfile; - - private readonly ImmutableArray _targetProjects; - - private readonly IEnumerable _targetProjectNames; - - public event PropertyChangedEventHandler? PropertyChanged; - - public DebuggerOptionsViewModel(ImmutableArray targetProjects) - { - _targetProjects = targetProjects; - _targetProjectNames = _targetProjects.Select(t => Path.GetFileNameWithoutExtension(t.UnconfiguredProject.FullPath)); - } - - public IEnumerable ProjectNames { get => _targetProjectNames; } - - public IWritableLaunchProfile? LaunchProfile - { - get => _launchProfile; - set - { - _launchProfile = value; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(SelectedProjectIndex))); - } - } - - public int SelectedProjectIndex - { - get - { - if (LaunchProfile?.OtherSettings.ContainsKey(Constants.TargetProjectPropertyName) == true) - { - var target = LaunchProfile.OtherSettings[Constants.TargetProjectPropertyName].ToString(); - for (var i = 0; i < _targetProjects.Length; i++) - { - if (_targetProjects[i].UnconfiguredProject.FullPath.Equals(target, StringComparison.OrdinalIgnoreCase)) - { - return i; - } - } - } - return -1; - } - set - { - if (LaunchProfile is object) - { - var newTargetProject = _targetProjects[value].UnconfiguredProject; - LaunchProfile.OtherSettings[Constants.TargetProjectPropertyName] = newTargetProject.FullPath; - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(SelectedProjectIndex))); - } - } - } - } -} diff --git a/src/VisualStudio.Roslyn.SDK/ComponentDebugger/LaunchSettingsProvider.cs b/src/VisualStudio.Roslyn.SDK/ComponentDebugger/LaunchSettingsProvider.cs deleted file mode 100644 index 7e10b807a..000000000 --- a/src/VisualStudio.Roslyn.SDK/ComponentDebugger/LaunchSettingsProvider.cs +++ /dev/null @@ -1,90 +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.ComponentModel.Composition; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using System.Windows.Controls; -using Microsoft.VisualStudio.ProjectSystem; -using Microsoft.VisualStudio.ProjectSystem.Debug; -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Threading; -using Microsoft.VisualStudio.Utilities; - -namespace Roslyn.ComponentDebugger -{ - [Export(typeof(ILaunchSettingsUIProvider))] - [AppliesTo(Constants.RoslynComponentCapability)] - public class LaunchSettingsProvider : ILaunchSettingsUIProvider - { - private readonly UnconfiguredProject _unconfiguredProject; - private readonly AsyncLazy _viewModel; - - [ImportingConstructor] - [Obsolete("This exported object must be obtained through the MEF export provider.", error: true)] - public LaunchSettingsProvider(UnconfiguredProject unconfiguredProject) - { - _unconfiguredProject = unconfiguredProject; - _viewModel = new AsyncLazy(GetViewModelAsync, ThreadHelper.JoinableTaskFactory); - } - - public string CommandName { get => Constants.CommandName; } - - // https://github.com/dotnet/roslyn-sdk/issues/730 : localization - public string FriendlyName { get => "Roslyn Component"; } - - public UserControl? CustomUI { get => new DebuggerOptions() { DataContext = _viewModel.GetValue() }; } - - public void ProfileSelected(IWritableLaunchSettings curSettings) - { - // Update the viewmodel's current profile. - this._viewModel.GetValue().LaunchProfile = curSettings?.ActiveProfile; - } - - public bool ShouldEnableProperty(string propertyName) - { - // we disable all the default options for a debugger. - // in the future we might want to enable env vars and (potentially) the exe to allow - // customization of the compiler used? - return false; - } - - private async Task GetViewModelAsync() - { - var targetProjects = ArrayBuilder.GetInstance(); - - // NOTE: we assume the target projects are in the same configuration as this one (can they be different?) - var configuredProject = await _unconfiguredProject.GetSuggestedConfiguredProjectAsync().ConfigureAwait(false); - if (configuredProject is object) - { - // get the output assembly for this project - var projectArgs = await configuredProject.GetCompilationArgumentsAsync().ConfigureAwait(false); - var targetArg = projectArgs.LastOrDefault(a => a.StartsWith("/out:", StringComparison.OrdinalIgnoreCase)); - var target = Path.GetFileName(targetArg); - - var projectService = configuredProject.Services.ProjectService; - foreach (var targetProjectUnconfigured in projectService.LoadedUnconfiguredProjects) - { - var targetProject = await targetProjectUnconfigured.LoadConfiguredProjectAsync(configuredProject.ProjectConfiguration).ConfigureAwait(false); - if (targetProject is object) - { - // check if the args contain the project as an analyzer ref - foreach (var arg in await targetProject.GetCompilationArgumentsAsync().ConfigureAwait(false)) - { - if (arg.StartsWith("/analyzer", StringComparison.OrdinalIgnoreCase) - && arg.EndsWith(target, StringComparison.OrdinalIgnoreCase)) - { - targetProjects.Add(targetProject); - } - } - } - } - } - - return new DebuggerOptionsViewModel(targetProjects.ToImmutableAndFree()); - } - } -} diff --git a/src/VisualStudio.Roslyn.SDK/ComponentDebugger/ProjectUtilities.cs b/src/VisualStudio.Roslyn.SDK/ComponentDebugger/ProjectUtilities.cs deleted file mode 100644 index ad40f94e4..000000000 --- a/src/VisualStudio.Roslyn.SDK/ComponentDebugger/ProjectUtilities.cs +++ /dev/null @@ -1,42 +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.Collections.Immutable; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.VisualStudio.ProjectSystem; - -namespace Roslyn.ComponentDebugger -{ - public static class ProjectUtilities - { - // PROTOTYPE: is there a way to get this other than hardcoding it? - static readonly string[] CommandLineSchemaRuleNames = new[] { "CompilerCommandLineArgs" }; - - public static async Task> GetCompilationArgumentsAsync(this ConfiguredProject project) - { - if (project is null) - { - throw new ArgumentNullException(nameof(project)); - } - - var args = ImmutableArray.Empty; - - var subscriptionService = project.Services.ProjectSubscription; - if (subscriptionService is object) - { - // get the latest snapshot of the command line args rules - var snapshots = await subscriptionService.JointRuleSource.GetLatestVersionAsync(project, CommandLineSchemaRuleNames).ConfigureAwait(false); - var latest = snapshots.Values.FirstOrDefault(); - - // extract the actual command line arguments - args = latest?.Items.Keys.ToImmutableArray() ?? args; - } - - return args; - } - } -} diff --git a/src/VisualStudio.Roslyn.SDK/ComponentDebugger/Roslyn.ComponentDebugger.csproj b/src/VisualStudio.Roslyn.SDK/ComponentDebugger/Roslyn.ComponentDebugger.csproj deleted file mode 100644 index 5a5f34193..000000000 --- a/src/VisualStudio.Roslyn.SDK/ComponentDebugger/Roslyn.ComponentDebugger.csproj +++ /dev/null @@ -1,40 +0,0 @@ - - - - - Library - Roslyn.ComponentDebugger - net472 - enable - NU1603;NU1605 - - - - - - - - - - - - - - - - - - - - - - - - - - - - MSBuild:Compile - - - diff --git a/src/VisualStudio.Roslyn.SDK/Roslyn.SDK/Roslyn.SDK.csproj b/src/VisualStudio.Roslyn.SDK/Roslyn.SDK/Roslyn.SDK.csproj index 370c4ea74..b04a9074b 100644 --- a/src/VisualStudio.Roslyn.SDK/Roslyn.SDK/Roslyn.SDK.csproj +++ b/src/VisualStudio.Roslyn.SDK/Roslyn.SDK/Roslyn.SDK.csproj @@ -120,15 +120,5 @@ true false - - Roslyn.ComponentDebugger - BuiltProjectOutputGroup%3bGetCopyToOutputDirectoryItems%3b - DebugSymbolsProjectOutputGroup%3b - true - false - - - - diff --git a/src/VisualStudio.Roslyn.SDK/Roslyn.SDK/source.extension.vsixmanifest b/src/VisualStudio.Roslyn.SDK/Roslyn.SDK/source.extension.vsixmanifest index a091d5313..8d8661a4e 100644 --- a/src/VisualStudio.Roslyn.SDK/Roslyn.SDK/source.extension.vsixmanifest +++ b/src/VisualStudio.Roslyn.SDK/Roslyn.SDK/source.extension.vsixmanifest @@ -30,7 +30,6 @@ -