From cef8db1190cbd748f3fe399981dfbf23b24f5f07 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 10 Apr 2024 17:56:12 +0000 Subject: [PATCH 01/38] Failed to perform coherency update for one or more dependencies. From d9fba6b257484c46d2fd03398d61c450b93fa510 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 26 Apr 2024 13:08:06 +0000 Subject: [PATCH 02/38] Update dependencies from https://github.com/dotnet/arcade build 20240425.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24225.1 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 07b1f7d437360..363e319d78671 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -99,9 +99,9 @@ - + https://github.com/dotnet/arcade - 188340e12c0a372b1681ad6a5e72c608021efdba + 67d23f4ba1813b315e7e33c71d18b63475f5c5f8 @@ -127,9 +127,9 @@ https://github.com/dotnet/roslyn 5d10d428050c0d6afef30a072c4ae68776621877 - + https://github.com/dotnet/arcade - 188340e12c0a372b1681ad6a5e72c608021efdba + 67d23f4ba1813b315e7e33c71d18b63475f5c5f8 https://github.com/dotnet/roslyn-analyzers diff --git a/global.json b/global.json index 5aa5a50b34485..d47c11496f0ff 100644 --- a/global.json +++ b/global.json @@ -12,7 +12,7 @@ "xcopy-msbuild": "17.8.1-2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24204.3", - "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24204.3" + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24225.1", + "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24225.1" } } From 3b023f7b8c63cb13b5ca00357319ab72df6e8921 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 27 Apr 2024 12:58:53 +0000 Subject: [PATCH 03/38] Update dependencies from https://github.com/dotnet/arcade build 20240425.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24225.1 From 7e2970afeba5e696b8cbf79075ad5f1bd35491ef Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 28 Apr 2024 12:49:28 +0000 Subject: [PATCH 04/38] Update dependencies from https://github.com/dotnet/arcade build 20240425.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24225.1 From d48f0f62e854809419aa2da0e07704bddbb4a283 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 29 Apr 2024 12:49:04 +0000 Subject: [PATCH 05/38] Update dependencies from https://github.com/dotnet/arcade build 20240425.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24225.1 From c5fd8641e6ecc94f51d10e9d49aa2494e8b9ffe8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 30 Apr 2024 13:04:56 +0000 Subject: [PATCH 06/38] Update dependencies from https://github.com/dotnet/arcade build 20240425.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24225.1 From 6660b9278666f4036bbcc0892e13964b6da38187 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 1 May 2024 12:44:46 +0000 Subject: [PATCH 07/38] Update dependencies from https://github.com/dotnet/arcade build 20240425.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24225.1 From 765e1ed4d46fb041015f02289b7ec04ab10f5aa6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 2 May 2024 12:49:33 +0000 Subject: [PATCH 08/38] Update dependencies from https://github.com/dotnet/arcade build 20240425.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24225.1 From 23dcf865be51cc0ef1b3059af02b903fba460ee0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 3 May 2024 13:08:47 +0000 Subject: [PATCH 09/38] Update dependencies from https://github.com/dotnet/arcade build 20240425.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24225.1 From 17652295a0cc273d013695a6a9cbe06cadeb39ce Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 4 May 2024 12:48:03 +0000 Subject: [PATCH 10/38] Update dependencies from https://github.com/dotnet/arcade build 20240425.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24225.1 From 9c9518d825df6ea5c318f363486a0bd4354715c6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 5 May 2024 12:47:42 +0000 Subject: [PATCH 11/38] Update dependencies from https://github.com/dotnet/arcade build 20240425.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24225.1 From 3dda83fe105c0b2454d80f2a55b6b0118da4b105 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 6 May 2024 12:43:43 +0000 Subject: [PATCH 12/38] Update dependencies from https://github.com/dotnet/arcade build 20240425.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24225.1 From 38da6d74c8c15db01ef8b3f71ad24a46afee4bfc Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 7 May 2024 13:05:04 +0000 Subject: [PATCH 13/38] Update dependencies from https://github.com/dotnet/arcade build 20240425.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24225.1 From 795ca34589d0de5e06e26929e59fb890807d9462 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 8 May 2024 12:59:58 +0000 Subject: [PATCH 14/38] Update dependencies from https://github.com/dotnet/arcade build 20240425.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24225.1 From 8db05bc9a926febe9e09b54b9bd842d569aef47f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 9 May 2024 19:16:26 +0000 Subject: [PATCH 15/38] Update dependencies from https://github.com/dotnet/arcade build 20240425.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24225.1 From 13124d9f52197171a39c37f387306f1ffebc9b40 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 10 May 2024 12:45:22 +0000 Subject: [PATCH 16/38] Update dependencies from https://github.com/dotnet/arcade build 20240425.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24225.1 From d4462566985df6e3da9935e23e393414f799e170 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 11 May 2024 12:55:37 +0000 Subject: [PATCH 17/38] Update dependencies from https://github.com/dotnet/arcade build 20240425.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24225.1 From eb20b0fc6602a8c9c157fc6c36eee3823c718f5f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 12 May 2024 12:49:16 +0000 Subject: [PATCH 18/38] Update dependencies from https://github.com/dotnet/arcade build 20240425.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24225.1 From 34e03e08c3cbd61246b47784e8286b44d38ca6eb Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 13 May 2024 12:42:07 +0000 Subject: [PATCH 19/38] Update dependencies from https://github.com/dotnet/arcade build 20240425.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24225.1 From b3660f11f8e6b230b77f6bbd7a642a316778add6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 14 May 2024 12:44:34 +0000 Subject: [PATCH 20/38] Update dependencies from https://github.com/dotnet/arcade build 20240425.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24225.1 From 9160b6395b7e0d927d7c706c94a397d7f3e1cd61 Mon Sep 17 00:00:00 2001 From: Marc Paine Date: Tue, 14 May 2024 10:56:46 -0700 Subject: [PATCH 21/38] Update msbuild version to 17.3.4 (#73283) * Update msbuild version to 17.3.4 * Update the source build version to 17.3.4 * Update to the source build build with the 17.3.4 msbuild version Remove the xliff-tasks coherency as that dependency doesn't exist in arcade * try updating externals to the 8.0 version as well to see if that fixes source build * Add allowed prebuilts for assemblies declared in Version.Details.xml as non-Source-build * Add System.Threading.Tasks.Dataflow product dependency --------- Co-authored-by: Michael Simons --- eng/Directory.Packages.props | 8 ++++---- eng/SourceBuildPrebuiltBaseline.xml | 8 +++++++- eng/Version.Details.xml | 14 +++++++++----- eng/Versions.props | 1 + ...odeAnalysis.Workspaces.MSBuild.BuildHost.csproj | 8 ++++---- 5 files changed, 25 insertions(+), 14 deletions(-) diff --git a/eng/Directory.Packages.props b/eng/Directory.Packages.props index ea4b42a8e1785..63bbd6c066812 100644 --- a/eng/Directory.Packages.props +++ b/eng/Directory.Packages.props @@ -31,9 +31,9 @@ --> - - - + + + @@ -202,7 +202,7 @@ - + diff --git a/eng/SourceBuildPrebuiltBaseline.xml b/eng/SourceBuildPrebuiltBaseline.xml index 592d3954059e8..2f6e57b3eb31a 100644 --- a/eng/SourceBuildPrebuiltBaseline.xml +++ b/eng/SourceBuildPrebuiltBaseline.xml @@ -22,21 +22,27 @@ + + - + + + + + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 41324e1b461bf..e6bf41930e55d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -2,15 +2,15 @@ - + https://github.com/dotnet/source-build-externals - b46b7e6859f4094cd7f3e00dc0471d62f5d8d051 + 2b7510ccda2be01e2a2b48598498dca24fb69c3a - + https://github.com/dotnet/source-build-reference-packages - 8d6e9cf10f64ff8fc02e434b516f6ca87c4b7215 + 2ae84974a931d184c92865610453a65903118796 @@ -84,6 +84,10 @@ https://github.com/dotnet/runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 + + https://github.com/dotnet/runtime + 5535e31a712343a63f5d7d796cd874e563e5ac14 + https://github.com/dotnet/runtime 5535e31a712343a63f5d7d796cd874e563e5ac14 @@ -125,7 +129,7 @@ 73f0850939d96131c28cf6ea6ee5aacb4da0083a - + https://github.com/dotnet/xliff-tasks 73f0850939d96131c28cf6ea6ee5aacb4da0083a diff --git a/eng/Versions.props b/eng/Versions.props index ca2c67bff31aa..45e129c7d68b7 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -34,6 +34,7 @@ 8.0.0 8.0.0 + 8.0.0 8.0.0 8.0.0 3.3.4 diff --git a/src/Workspaces/Core/MSBuild.BuildHost/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.csproj b/src/Workspaces/Core/MSBuild.BuildHost/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.csproj index 063d82e3b829a..bac4691c9b259 100644 --- a/src/Workspaces/Core/MSBuild.BuildHost/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.csproj +++ b/src/Workspaces/Core/MSBuild.BuildHost/Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.csproj @@ -22,11 +22,11 @@ AnyCPU - - - - + + + From 8133b7e0dfe56e63d1d1729aeee712e1fcf9c59d Mon Sep 17 00:00:00 2001 From: David Barbet Date: Mon, 13 May 2024 18:58:22 -0700 Subject: [PATCH 22/38] Report external build errors using the platform's diagnostic brokered service instead of via Roslyn --- .../BuildOnlyDiagnosticsService.cs | 146 --- .../IBuildOnlyDiagnosticsService.cs | 23 - .../Features/CodeFixes/CodeFixService.cs | 9 +- ...harpProjectExternalErrorReporterFactory.cs | 2 +- .../Legacy/AbstractLegacyProject.cs | 4 +- .../VisualStudioWorkspaceImpl.cs | 9 +- .../VisualStudioSuppressionFixService.cs | 52 +- .../ExternalErrorDiagnosticUpdateSource.cs | 964 +++--------------- .../TaskList/ProjectExternalErrorReporter.cs | 34 +- .../CPSProject_IWorkspaceProjectContext.cs | 2 +- .../ExternalDiagnosticUpdateSourceTests.vb | 647 ++++-------- 11 files changed, 361 insertions(+), 1531 deletions(-) delete mode 100644 src/Features/Core/Portable/Diagnostics/BuildOnlyDiagnosticsService.cs delete mode 100644 src/Features/Core/Portable/Diagnostics/IBuildOnlyDiagnosticsService.cs diff --git a/src/Features/Core/Portable/Diagnostics/BuildOnlyDiagnosticsService.cs b/src/Features/Core/Portable/Diagnostics/BuildOnlyDiagnosticsService.cs deleted file mode 100644 index acc6905019187..0000000000000 --- a/src/Features/Core/Portable/Diagnostics/BuildOnlyDiagnosticsService.cs +++ /dev/null @@ -1,146 +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.Composition; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Host.Mef; - -namespace Microsoft.CodeAnalysis.Diagnostics; - -[ExportWorkspaceServiceFactory(typeof(IBuildOnlyDiagnosticsService), ServiceLayer.Default), Shared] -internal sealed class BuildOnlyDiagnosticsServiceFactory : IWorkspaceServiceFactory -{ - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public BuildOnlyDiagnosticsServiceFactory() - { - } - - public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) - => new BuildOnlyDiagnosticsService(workspaceServices.Workspace); - - private sealed class BuildOnlyDiagnosticsService : IBuildOnlyDiagnosticsService - { - private readonly object _gate = new(); - private readonly Dictionary> _documentDiagnostics = []; - private readonly Dictionary> _projectDiagnostics = []; - - public BuildOnlyDiagnosticsService(Workspace workspace) - { - workspace.WorkspaceChanged += OnWorkspaceChanged; - } - - private void OnWorkspaceChanged(object? sender, WorkspaceChangeEventArgs e) - { - switch (e.Kind) - { - case WorkspaceChangeKind.SolutionAdded: - case WorkspaceChangeKind.SolutionCleared: - case WorkspaceChangeKind.SolutionReloaded: - case WorkspaceChangeKind.SolutionRemoved: - ClearAllDiagnostics(); - break; - - case WorkspaceChangeKind.ProjectReloaded: - case WorkspaceChangeKind.ProjectRemoved: - ClearDiagnostics(e.OldSolution.GetProject(e.ProjectId)); - break; - - case WorkspaceChangeKind.DocumentRemoved: - case WorkspaceChangeKind.DocumentReloaded: - case WorkspaceChangeKind.AdditionalDocumentRemoved: - case WorkspaceChangeKind.AdditionalDocumentReloaded: - case WorkspaceChangeKind.AnalyzerConfigDocumentRemoved: - case WorkspaceChangeKind.AnalyzerConfigDocumentReloaded: - ClearDiagnostics(e.DocumentId); - break; - } - } - - public void AddBuildOnlyDiagnostics(Solution solution, ProjectId? projectId, DocumentId? documentId, ImmutableArray diagnostics) - { - lock (_gate) - { - if (documentId != null) - { - _documentDiagnostics[documentId] = diagnostics; - } - else if (projectId != null) - { - _projectDiagnostics[projectId] = diagnostics; - } - } - } - - private void ClearAllDiagnostics() - { - lock (_gate) - { - _documentDiagnostics.Clear(); - _projectDiagnostics.Clear(); - } - } - - private void ClearDiagnostics(DocumentId? documentId) - { - if (documentId == null) - return; - - lock (_gate) - { - _documentDiagnostics.Remove(documentId); - } - } - - private void ClearDiagnostics(Project? project) - { - if (project == null) - return; - - lock (_gate) - { - _projectDiagnostics.Remove(project.Id); - foreach (var documentId in project.DocumentIds) - _documentDiagnostics.Remove(documentId); - } - } - - public void ClearBuildOnlyDiagnostics(Solution solution, ProjectId? projectId, DocumentId? documentId) - { - if (documentId != null) - ClearDiagnostics(documentId); - else - ClearDiagnostics(solution.GetProject(projectId)); - } - - public ImmutableArray GetBuildOnlyDiagnostics(DocumentId documentId) - { - lock (_gate) - { - if (_documentDiagnostics.TryGetValue(documentId, out var diagnostics)) - { - return diagnostics; - } - - return []; - } - } - - public ImmutableArray GetBuildOnlyDiagnostics(ProjectId projectId) - { - lock (_gate) - { - if (_projectDiagnostics.TryGetValue(projectId, out var diagnostics)) - { - return diagnostics; - } - - return []; - } - } - } -} diff --git a/src/Features/Core/Portable/Diagnostics/IBuildOnlyDiagnosticsService.cs b/src/Features/Core/Portable/Diagnostics/IBuildOnlyDiagnosticsService.cs deleted file mode 100644 index 4230d17fb9539..0000000000000 --- a/src/Features/Core/Portable/Diagnostics/IBuildOnlyDiagnosticsService.cs +++ /dev/null @@ -1,23 +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 Microsoft.CodeAnalysis.Host; - -namespace Microsoft.CodeAnalysis.Diagnostics; - -/// -/// Service to keep track of build-only diagnostics reported from explicit Build/Rebuild commands. -/// Note that this service only keeps track of those diagnostics that can never be reported from live analysis. -/// -internal interface IBuildOnlyDiagnosticsService : IWorkspaceService -{ - void AddBuildOnlyDiagnostics(Solution solution, ProjectId? projectId, DocumentId? documentId, ImmutableArray diagnostics); - - void ClearBuildOnlyDiagnostics(Solution solution, ProjectId? projectId, DocumentId? documentId); - - ImmutableArray GetBuildOnlyDiagnostics(DocumentId documentId); - - ImmutableArray GetBuildOnlyDiagnostics(ProjectId projectId); -} diff --git a/src/Features/LanguageServer/Protocol/Features/CodeFixes/CodeFixService.cs b/src/Features/LanguageServer/Protocol/Features/CodeFixes/CodeFixService.cs index f06bae504b101..c67bad14168a8 100644 --- a/src/Features/LanguageServer/Protocol/Features/CodeFixes/CodeFixService.cs +++ b/src/Features/LanguageServer/Protocol/Features/CodeFixes/CodeFixService.cs @@ -116,9 +116,6 @@ public async Task GetMostSevereFixAsync( var copilotDiagnostics = await GetCopilotDiagnosticsAsync(document, range, priorityProvider.Priority, cancellationToken).ConfigureAwait(false); allDiagnostics = allDiagnostics.AddRange(copilotDiagnostics); - var buildOnlyDiagnosticsService = document.Project.Solution.Services.GetRequiredService(); - allDiagnostics = allDiagnostics.AddRange(buildOnlyDiagnosticsService.GetBuildOnlyDiagnostics(document.Id)); - var text = await document.GetValueTextAsync(cancellationToken).ConfigureAwait(false); var spanToDiagnostics = ConvertToMap(text, allDiagnostics); @@ -204,10 +201,7 @@ public async IAsyncEnumerable StreamFixesAsync( var copilotDiagnostics = await GetCopilotDiagnosticsAsync(document, range, priorityProvider.Priority, cancellationToken).ConfigureAwait(false); diagnostics = diagnostics.AddRange(copilotDiagnostics); - var buildOnlyDiagnosticsService = document.Project.Solution.Services.GetRequiredService(); - var buildOnlyDiagnostics = buildOnlyDiagnosticsService.GetBuildOnlyDiagnostics(document.Id); - - if (diagnostics.IsEmpty && buildOnlyDiagnostics.IsEmpty) + if (diagnostics.IsEmpty) yield break; if (!diagnostics.IsEmpty) @@ -231,7 +225,6 @@ public async IAsyncEnumerable StreamFixesAsync( if (document.Project.Solution.WorkspaceKind != WorkspaceKind.Interactive && includeSuppressionFixes) { // For build-only diagnostics, we support configuration/suppression fixes. - diagnostics = diagnostics.AddRange(buildOnlyDiagnostics); var text = await document.GetValueTextAsync(cancellationToken).ConfigureAwait(false); var spanToDiagnostics = ConvertToMap(text, diagnostics); diff --git a/src/Tools/ExternalAccess/FSharp/Internal/VisualStudio/FSharpProjectExternalErrorReporterFactory.cs b/src/Tools/ExternalAccess/FSharp/Internal/VisualStudio/FSharpProjectExternalErrorReporterFactory.cs index eb836e0a42472..cdbc55c0cbee7 100644 --- a/src/Tools/ExternalAccess/FSharp/Internal/VisualStudio/FSharpProjectExternalErrorReporterFactory.cs +++ b/src/Tools/ExternalAccess/FSharp/Internal/VisualStudio/FSharpProjectExternalErrorReporterFactory.cs @@ -19,7 +19,7 @@ internal static class FSharpProjectExternalErrorReporterFactory public static IVsLanguageServiceBuildErrorReporter2 Create(ProjectId projectId, string errorCodePrefix, IServiceProvider serviceProvider) { var workspace = (VisualStudioWorkspaceImpl)serviceProvider.GetMefService(); - return new ProjectExternalErrorReporter(projectId, errorCodePrefix, LanguageNames.FSharp, workspace); + return new ProjectExternalErrorReporter(projectId, projectId.Id, errorCodePrefix, LanguageNames.FSharp, workspace); } } } diff --git a/src/VisualStudio/Core/Def/ProjectSystem/Legacy/AbstractLegacyProject.cs b/src/VisualStudio/Core/Def/ProjectSystem/Legacy/AbstractLegacyProject.cs index 707aae6f45478..f0db6c2a86df8 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/Legacy/AbstractLegacyProject.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/Legacy/AbstractLegacyProject.cs @@ -147,7 +147,9 @@ public AbstractLegacyProject( ConnectHierarchyEvents(); RefreshBinOutputPath(); - _externalErrorReporter = new ProjectExternalErrorReporter(ProjectSystemProject.Id, externalErrorReportingPrefix, language, workspaceImpl); + var projectHierarchyGuid = GetProjectIDGuid(hierarchy); + + _externalErrorReporter = new ProjectExternalErrorReporter(ProjectSystemProject.Id, projectHierarchyGuid, externalErrorReportingPrefix, language, workspaceImpl); _batchScopeCreator = componentModel.GetService(); _batchScopeCreator.StartTrackingProject(ProjectSystemProject, Hierarchy); } diff --git a/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.cs b/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.cs index 51630499d6b7a..d8fe391bae6ff 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.cs @@ -29,6 +29,7 @@ using Microsoft.CodeAnalysis.Telemetry; using Microsoft.CodeAnalysis.Text; using Microsoft.CodeAnalysis.Workspaces.ProjectSystem; +using Microsoft.ServiceHub.Framework; using Microsoft.VisualStudio.ComponentModelHost; using Microsoft.VisualStudio.Composition; using Microsoft.VisualStudio.Editor; @@ -40,6 +41,7 @@ using Microsoft.VisualStudio.LanguageServices.Utilities; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; +using Microsoft.VisualStudio.Shell.ServiceBroker; using Microsoft.VisualStudio.Telemetry; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Projection; @@ -132,12 +134,7 @@ public VisualStudioWorkspaceImpl(ExportProvider exportProvider, IAsyncServicePro _ = Task.Run(() => InitializeUIAffinitizedServicesAsync(asyncServiceProvider)); _lazyExternalErrorDiagnosticUpdateSource = new Lazy(() => - new ExternalErrorDiagnosticUpdateSource( - this, - exportProvider.GetExportedValue(), - exportProvider.GetExportedValue(), - exportProvider.GetExportedValue(), - _threadingContext), + exportProvider.GetExportedValue(), isThreadSafe: true); _workspaceListener = Services.GetRequiredService().GetListener(); diff --git a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs index fe87d2561bea2..540cc7ec671a3 100644 --- a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs +++ b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs @@ -152,56 +152,6 @@ private static Func GetShouldFixInProjectDelegate(IVsHierarchyIte return p => projectHierarchy == null || p.Id == projectIdToMatch; } - private async Task> GetAllBuildDiagnosticsAsync(Func shouldFixInProject, CancellationToken cancellationToken) - { - using var _ = CodeAnalysis.PooledObjects.ArrayBuilder.GetInstance(out var builder); - - var buildDiagnostics = _buildErrorDiagnosticService.GetBuildErrors().Where(d => d.ProjectId != null && d.Severity != DiagnosticSeverity.Hidden); - var solution = _workspace.CurrentSolution; - foreach (var diagnosticsByProject in buildDiagnostics.GroupBy(d => d.ProjectId)) - { - cancellationToken.ThrowIfCancellationRequested(); - - if (diagnosticsByProject.Key == null) - { - // Diagnostics with no projectId cannot be suppressed. - continue; - } - - var project = solution.GetProject(diagnosticsByProject.Key); - if (project != null && shouldFixInProject(project)) - { - var diagnosticsByDocument = diagnosticsByProject.GroupBy(d => d.DocumentId); - foreach (var group in diagnosticsByDocument) - { - var documentId = group.Key; - if (documentId == null) - { - // Project diagnostics, just add all of them. - builder.AddRange(group); - continue; - } - - // For document diagnostics ensure that whatever was reported is placed at a valid location for - // the state the document is currently in. - var document = project.GetDocument(documentId); - if (document != null) - { - var tree = await document.GetRequiredSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); - var text = await tree.GetTextAsync(cancellationToken).ConfigureAwait(false); - foreach (var diagnostic in group) - { - var span = diagnostic.DataLocation.UnmappedFileSpan.GetClampedTextSpan(text); - builder.Add(diagnostic.WithLocations(diagnostic.DataLocation.WithSpan(span, tree), additionalLocations: default)); - } - } - } - } - } - - return builder.ToImmutable(); - } - private static string GetFixTitle(bool isAddSuppression) => isAddSuppression ? ServicesVSResources.Suppress_diagnostics : ServicesVSResources.Remove_suppressions; @@ -219,7 +169,7 @@ void computeDiagnosticsToFix(IUIThreadOperationContext context) // snapshots. Otherwise, get all diagnostics from the diagnostic service. var diagnosticsToFixTask = selectedEntriesOnly ? _suppressionStateService.GetSelectedItemsAsync(isAddSuppression, cancellationToken) - : GetAllBuildDiagnosticsAsync(shouldFixInProject, cancellationToken); + : Task.FromResult>([]); diagnosticsToFix = diagnosticsToFixTask.WaitAndGetResult(cancellationToken).ToImmutableHashSet(); } diff --git a/src/VisualStudio/Core/Def/TaskList/ExternalErrorDiagnosticUpdateSource.cs b/src/VisualStudio/Core/Def/TaskList/ExternalErrorDiagnosticUpdateSource.cs index 7be8c3f9be202..235fbb43411e4 100644 --- a/src/VisualStudio/Core/Def/TaskList/ExternalErrorDiagnosticUpdateSource.cs +++ b/src/VisualStudio/Core/Def/TaskList/ExternalErrorDiagnosticUpdateSource.cs @@ -5,132 +5,103 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; +using System.ComponentModel.Composition; using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Collections; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; -using Microsoft.CodeAnalysis.Internal.Log; -using Microsoft.CodeAnalysis.Notification; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.LanguageServer; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Collections; using Microsoft.CodeAnalysis.Shared.TestHooks; -using Microsoft.CodeAnalysis.SolutionCrawler; +using Microsoft.ServiceHub.Framework; +using Microsoft.VisualStudio.RpcContracts.DiagnosticManagement; +using Microsoft.VisualStudio.RpcContracts.Utilities; +using Microsoft.VisualStudio.Shell.ServiceBroker; using Roslyn.Utilities; +using static Microsoft.ServiceHub.Framework.ServiceBrokerClient; #pragma warning disable CA1200 // Avoid using cref tags with a prefix namespace Microsoft.VisualStudio.LanguageServices.Implementation.TaskList; - -using ProjectErrorMap = ImmutableDictionary>; - /// /// Diagnostic source for warnings and errors reported from explicit build command invocations in Visual Studio. /// VS workspaces calls into us when a build is invoked or completed in Visual Studio. /// calls into us to clear reported diagnostics or to report new diagnostics during the build. /// For each of these callbacks, we create/capture the current and /// schedule updating/processing this state on a serialized in the background. -/// The processing phase de-dupes the diagnostics reported from build and intellisense to ensure that the error list does not contain duplicate diagnostics. -/// It raises events about diagnostic updates, which eventually trigger the "Build + Intellisense" and "Build only" error list diagnostic -/// sources to update the reported diagnostics. /// +[Export(typeof(ExternalErrorDiagnosticUpdateSource))] internal sealed class ExternalErrorDiagnosticUpdateSource : IDisposable { private readonly Workspace _workspace; private readonly IDiagnosticAnalyzerService _diagnosticService; - private readonly IBuildOnlyDiagnosticsService _buildOnlyDiagnosticsService; - private readonly IGlobalOperationNotificationService _notificationService; + private readonly IAsynchronousOperationListener _listener; private readonly CancellationToken _disposalToken; + private readonly IServiceBroker _serviceBroker; /// /// Task queue to serialize all the work for errors reported by build. /// represents the state from build errors, /// which is built up and processed in serialized fashion on this task queue. /// - private readonly TaskQueue _taskQueue; + private readonly AsyncBatchingWorkQueue> _taskQueue; + + /// + /// Holds onto the diagnostic manager service as long as this is alive. + /// This is important as when the manager service is disposed, the VS client will clear diagnostics from it. + /// Serial access is guaranteed by the + /// + private IDiagnosticManagerService? _diagnosticManagerService; // Gate for concurrent access and fields guarded with this gate. private readonly object _gate = new(); private InProgressState? _stateDoNotAccessDirectly; - private readonly CancellationSeries _activeCancellationSeriesDoNotAccessDirectly = new(); - - /// - /// Latest diagnostics reported during current or last build. - /// These are not the de-duped build/live diagnostics, but the actual diagnostics from build. - /// They are directly used by the "Build only" error list setting. - /// - private ImmutableArray _lastBuiltResult = ImmutableArray.Empty; + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public ExternalErrorDiagnosticUpdateSource( VisualStudioWorkspace workspace, IDiagnosticAnalyzerService diagnosticService, - IGlobalOperationNotificationService notificationService, IAsynchronousOperationListenerProvider listenerProvider, + [Import(typeof(SVsFullAccessServiceBroker))] IServiceBroker serviceBroker, IThreadingContext threadingContext) - : this(workspace, diagnosticService, notificationService, listenerProvider.GetListener(FeatureAttribute.ErrorList), threadingContext.DisposalToken) - { - } - - /// - /// internal for testing - /// - internal ExternalErrorDiagnosticUpdateSource( - Workspace workspace, - IDiagnosticAnalyzerService diagnosticService, - IGlobalOperationNotificationService notificationService, - IAsynchronousOperationListener listener, - CancellationToken disposalToken) { - // use queue to serialize work. no lock needed - _taskQueue = new TaskQueue(listener, TaskScheduler.Default); - _disposalToken = disposalToken; - + _disposalToken = threadingContext.DisposalToken; _workspace = workspace; - _workspace.WorkspaceChanged += OnWorkspaceChanged; - _diagnosticService = diagnosticService; - _buildOnlyDiagnosticsService = _workspace.Services.GetRequiredService(); + _listener = listenerProvider.GetListener(FeatureAttribute.ErrorList); + + _serviceBroker = serviceBroker; + _taskQueue = new AsyncBatchingWorkQueue>( + TimeSpan.Zero, + processBatchAsync: ProcessTaskQueueItemsAsync, + _listener, + _disposalToken + ); + } - _notificationService = notificationService; + private async ValueTask ProcessTaskQueueItemsAsync(ImmutableSegmentedList> list, CancellationToken cancellationToken) + { + foreach (var workItem in list) + await workItem(cancellationToken).ConfigureAwait(false); } public DiagnosticAnalyzerInfoCache AnalyzerInfoCache => _diagnosticService.AnalyzerInfoCache; - /// - /// Event generated from the serialized whenever the build progress in Visual Studio changes. - /// Events are guaranteed to be generated in a serial fashion, but may be invoked on any thread. - /// - public event EventHandler? BuildProgressChanged; - - /// - /// Event generated from the serialized whenever build-only diagnostics are reported during a build in Visual Studio. - /// These diagnostics are not supported from intellisense and only get refreshed during actual build. - /// - public event EventHandler>? DiagnosticsUpdated; - - /// - /// Indicates if a build is currently in progress inside Visual Studio. - /// - public bool IsInProgress => GetBuildInProgressState() != null; - public void Dispose() { lock (_gate) { - _activeCancellationSeriesDoNotAccessDirectly.Dispose(); + _diagnosticManagerService?.Dispose(); } } - /// - /// Get the latest diagnostics reported during current or last build. - /// These are not the de-duped build/live diagnostics, but the actual diagnostics from build. - /// They are directly used by the "Build only" error list setting. - /// - public ImmutableArray GetBuildErrors() - => _lastBuiltResult; - /// /// Returns true if the given represents an analyzer diagnostic ID that could be reported /// for the given during the current build in progress. @@ -139,385 +110,160 @@ public ImmutableArray GetBuildErrors() public bool IsSupportedDiagnosticId(ProjectId projectId, string id) => GetBuildInProgressState()?.IsSupportedDiagnosticId(projectId, id) ?? false; - private void OnBuildProgressChanged(InProgressState? state, BuildProgress buildProgress) + public void ClearErrors(ProjectId projectId) { - if (state != null) + // Clear the previous errors associated with the project. + _taskQueue.AddWork(async cancellationToken => { - _lastBuiltResult = state.GetBuildErrors(); - } - - RaiseBuildProgressChanged(buildProgress); + await ClearPreviousAsync(projectId: projectId, cancellationToken).ConfigureAwait(false); + }); } - public void ClearErrors(ProjectId projectId) + internal void OnSolutionBuildStarted() { - // Capture state if it exists - var state = GetBuildInProgressState(); - - // Update the state to clear diagnostics and raise corresponding diagnostic updated events - // on a serialized task queue. - _taskQueue.ScheduleTask(nameof(ClearErrors), async () => - { - if (state == null) - { - // TODO: Is it possible that ClearErrors can be invoked while the build is not in progress? - // We fallback to current solution in the workspace and clear errors for the project. - await ClearErrorsCoreAsync(projectId, _workspace.CurrentSolution, state).ConfigureAwait(false); - } - else - { - // We are going to clear the diagnostics for the current project. - // Additionally, we clear errors for all projects that transitively depend on this project. - // Otherwise, fixing errors in core projects in dependency chain will leave back stale diagnostics in dependent projects. - - // First check if we already cleared the diagnostics for this project when processing a referenced project. - // If so, we don't need to clear diagnostics for it again. - if (state.WereProjectErrorsCleared(projectId)) - { - return; - } - - var solution = state.Solution; - - await ClearErrorsCoreAsync(projectId, solution, state).ConfigureAwait(false); - - var transitiveProjectIds = solution.GetProjectDependencyGraph().GetProjectsThatTransitivelyDependOnThisProject(projectId); - foreach (var projectId in transitiveProjectIds) - { - if (state.WereProjectErrorsCleared(projectId)) - { - continue; - } - - await ClearErrorsCoreAsync(projectId, solution, state).ConfigureAwait(false); - } - } - }, GetApplicableCancellationToken(state)); - - return; + _ = GetOrCreateInProgressState(); - async ValueTask ClearErrorsCoreAsync(ProjectId projectId, Solution solution, InProgressState? state) + _taskQueue.AddWork(async cancellationToken => { - Debug.Assert(state == null || !state.WereProjectErrorsCleared(projectId)); - - // Here, we clear the build and live errors for the project. - // Additionally, we mark projects as having its errors cleared. - // This ensures that we do not attempt to clear the diagnostics again for the same project - // when 'ClearErrors' is invoked for multiple dependent projects. - // Finally, we update build progress state so error list gets refreshed. - - using (var argsBuilder = TemporaryArray.Empty) - { - AddArgsToClearBuildOnlyProjectErrors(ref argsBuilder.AsRef(), solution, projectId); - ProcessAndRaiseDiagnosticsUpdated(argsBuilder.ToImmutableAndClear()); - } - - await SetLiveErrorsForProjectAsync(projectId, ImmutableArray.Empty, GetApplicableCancellationToken(state)).ConfigureAwait(false); - - state?.MarkErrorsCleared(projectId); - - OnBuildProgressChanged(state, BuildProgress.Updated); - } + await ClearPreviousAsync(projectId: null, cancellationToken).ConfigureAwait(false); + }); } - private void OnWorkspaceChanged(object sender, WorkspaceChangeEventArgs e) + internal void OnSolutionBuildCompleted() { - // Clear relevant build-only errors on workspace events such as solution added/removed/reloaded, - // project added/removed/reloaded, etc. - switch (e.Kind) - { - case WorkspaceChangeKind.SolutionAdded: - _taskQueue.ScheduleTask( - "OnSolutionAdded", - () => - { - using var argsBuilder = TemporaryArray.Empty; - foreach (var projectId in e.OldSolution.ProjectIds) - { - AddArgsToClearBuildOnlyProjectErrors(ref argsBuilder.AsRef(), e.OldSolution, projectId); - } - - ProcessAndRaiseDiagnosticsUpdated(argsBuilder.ToImmutableAndClear()); - }, - _disposalToken); - break; - - case WorkspaceChangeKind.SolutionRemoved: - case WorkspaceChangeKind.SolutionCleared: - case WorkspaceChangeKind.SolutionReloaded: - _taskQueue.ScheduleTask( - "OnSolutionChanged", - () => - { - using var argsBuilder = TemporaryArray.Empty; - foreach (var projectId in e.OldSolution.ProjectIds) - { - AddArgsToClearBuildOnlyProjectErrors(ref argsBuilder.AsRef(), e.OldSolution, projectId); - } - - ProcessAndRaiseDiagnosticsUpdated(argsBuilder.ToImmutableAndClear()); - }, - _disposalToken); - break; - - case WorkspaceChangeKind.ProjectRemoved: - case WorkspaceChangeKind.ProjectReloaded: - _taskQueue.ScheduleTask( - "OnProjectChanged", - () => - { - using var argsBuilder = TemporaryArray.Empty; - AddArgsToClearBuildOnlyProjectErrors(ref argsBuilder.AsRef(), e.OldSolution, e.ProjectId); - ProcessAndRaiseDiagnosticsUpdated(argsBuilder.ToImmutableAndClear()); - }, - _disposalToken); - break; - - case WorkspaceChangeKind.DocumentRemoved: - case WorkspaceChangeKind.DocumentReloaded: - case WorkspaceChangeKind.AdditionalDocumentRemoved: - case WorkspaceChangeKind.AdditionalDocumentReloaded: - case WorkspaceChangeKind.AnalyzerConfigDocumentRemoved: - case WorkspaceChangeKind.AnalyzerConfigDocumentReloaded: - _taskQueue.ScheduleTask( - "OnDocumentRemoved", - () => - { - using var argsBuilder = TemporaryArray.Empty; - AddArgsToClearBuildOnlyDocumentErrors(ref argsBuilder.AsRef(), e.OldSolution, e.ProjectId, e.DocumentId); - ProcessAndRaiseDiagnosticsUpdated(argsBuilder.ToImmutableAndClear()); - }, - _disposalToken); - break; - - case WorkspaceChangeKind.DocumentChanged: - case WorkspaceChangeKind.AnalyzerConfigDocumentChanged: - case WorkspaceChangeKind.AdditionalDocumentChanged: - // We clear build-only errors for the document on document edits. - // This is done to address multiple customer reports of stale build-only diagnostics - // after they fix/remove the code flagged from build-only diagnostics, but the diagnostics - // do not get automatically removed/refreshed while typing. - // See https://github.com/dotnet/docs/issues/26708 and https://github.com/dotnet/roslyn/issues/64659 - // for additional details. - _taskQueue.ScheduleTask( - "OnDocumentChanged", - () => - { - using var argsBuilder = TemporaryArray.Empty; - AddArgsToClearBuildOnlyDocumentErrors(ref argsBuilder.AsRef(), e.OldSolution, e.ProjectId, e.DocumentId); - ProcessAndRaiseDiagnosticsUpdated(argsBuilder.ToImmutableAndClear()); - }, - _disposalToken); - break; - - case WorkspaceChangeKind.ProjectAdded: - case WorkspaceChangeKind.DocumentAdded: - case WorkspaceChangeKind.ProjectChanged: - case WorkspaceChangeKind.SolutionChanged: - case WorkspaceChangeKind.AdditionalDocumentAdded: - case WorkspaceChangeKind.AnalyzerConfigDocumentAdded: - break; - - default: - throw ExceptionUtilities.UnexpectedValue(e.Kind); - } + _ = ClearInProgressState(); } - internal void OnSolutionBuildStarted() + public void AddNewErrors(ProjectId projectId, Guid projectHierarchyGuid, ImmutableArray diagnostics) { - // Build just started, create the state and fire build in progress event. - _ = GetOrCreateInProgressState(); - } + Debug.Assert(diagnostics.All(d => d.IsBuildDiagnostic())); - internal void OnSolutionBuildCompleted() - { - // Building is done, so reset the state - // and get local copy of in-progress state. - var inProgressState = ClearInProgressState(); + // Capture state that will be processed in background thread. + var state = GetOrCreateInProgressState(); - // Enqueue build/live sync in the queue. - _taskQueue.ScheduleTask("OnSolutionBuild", async () => + _taskQueue.AddWork(async cancellationToken => { - // nothing to do - if (inProgressState == null) - { - return; - } - - // Mark the status as updated to refresh error list before we invoke 'SyncBuildErrorsAndReportAsync', which can take some time to complete. - OnBuildProgressChanged(inProgressState, BuildProgress.Updated); - - // We are about to update live analyzer data using one from build. - // pause live analyzer - using var operation = _notificationService.Start("BuildDone"); - if (_diagnosticService is DiagnosticAnalyzerService diagnosticService) - await SyncBuildErrorsAndReportOnBuildCompletedAsync(diagnosticService, inProgressState).ConfigureAwait(false); - - // Mark build as complete. - OnBuildProgressChanged(inProgressState, BuildProgress.Done); - }, GetApplicableCancellationToken(inProgressState)); + await ProcessDiagnosticsReportAsync(projectId, projectHierarchyGuid, diagnostics, state, cancellationToken).ConfigureAwait(false); + }); } - /// - /// Core method that de-dupes live and build diagnostics at the completion of build. - /// It raises diagnostic update events for both the Build-only diagnostics and Build + Intellisense diagnostics - /// in the error list. - /// - private ValueTask SyncBuildErrorsAndReportOnBuildCompletedAsync(DiagnosticAnalyzerService diagnosticService, InProgressState inProgressState) + private async Task ClearPreviousAsync(ProjectId? projectId, CancellationToken cancellationToken) { - var solution = inProgressState.Solution; - var cancellationToken = inProgressState.CancellationToken; - var (allLiveErrors, pendingLiveErrorsToSync) = inProgressState.GetLiveErrors(); + var diagnosticManagerService = await GetOrCreateDiagnosticManagerAsync(cancellationToken).ConfigureAwait(false); - // Raise events for build only errors - using var argsBuilder = TemporaryArray.Empty; - var buildErrors = GetBuildErrors().Except(allLiveErrors).GroupBy(k => k.DocumentId); - foreach (var group in buildErrors) + if (projectId is not null) { - cancellationToken.ThrowIfCancellationRequested(); - - if (group.Key == null) - { - foreach (var projectGroup in group.GroupBy(g => g.ProjectId)) - { - Contract.ThrowIfNull(projectGroup.Key); - argsBuilder.Add(CreateArgsToReportBuildErrors(projectGroup.Key, solution, projectGroup.ToImmutableArray())); - } - - continue; - } - - argsBuilder.Add(CreateArgsToReportBuildErrors(group.Key, solution, group.ToImmutableArray())); + await diagnosticManagerService.ClearDiagnosticsAsync(projectId.Id.ToString(), cancellationToken).ConfigureAwait(false); } - - ProcessAndRaiseDiagnosticsUpdated(argsBuilder.ToImmutableAndClear()); - - // Report pending live errors - return diagnosticService.SynchronizeWithBuildAsync(_workspace, pendingLiveErrorsToSync, onBuildCompleted: true, cancellationToken); - } - - private static DiagnosticsUpdatedArgs CreateArgsToReportBuildErrors(T item, Solution solution, ImmutableArray buildErrors) - { - if (item is ProjectId projectId) + else { - return CreateDiagnosticsCreatedArgs(projectId, solution, projectId, documentId: null, buildErrors); + await diagnosticManagerService.ClearAllDiagnosticsAsync(cancellationToken).ConfigureAwait(false); } - - RoslynDebug.Assert(item is DocumentId); - var documentId = (DocumentId)(object)item; - return CreateDiagnosticsCreatedArgs(documentId, solution, documentId.ProjectId, documentId, buildErrors); } - private static void AddArgsToClearBuildOnlyProjectErrors(ref TemporaryArray builder, Solution solution, ProjectId? projectId) + private async ValueTask ProcessDiagnosticsReportAsync(ProjectId projectId, Guid projectHierarchyGuid, ImmutableArray diagnostics, InProgressState state, CancellationToken cancellationToken) { - // Remove all project errors - builder.Add(CreateDiagnosticsRemovedArgs(projectId, solution, projectId, documentId: null)); + var diagnosticManagerService = await GetOrCreateDiagnosticManagerAsync(cancellationToken).ConfigureAwait(false); - var project = solution.GetProject(projectId); - if (project == null) + using var _ = ArrayBuilder.GetInstance(out var collections); + var groupedDiagnostics = diagnostics.GroupBy(d => d.DataLocation.UnmappedFileSpan.Path); + foreach (var group in groupedDiagnostics) { - return; - } + var path = group.Key; + var pathAsUri = ProtocolConversions.CreateAbsoluteUri(path); - // Remove all document errors - foreach (var documentId in project.DocumentIds.Concat(project.AdditionalDocumentIds).Concat(project.AnalyzerConfigDocumentIds)) - { - AddArgsToClearBuildOnlyDocumentErrors(ref builder, solution, projectId, documentId); + var convertedDiagnostics = group.Select(d => CreateDiagnostic(projectId, projectHierarchyGuid, d, state.Solution)).ToImmutableArray(); + if (convertedDiagnostics.Any()) + { + var collection = new DiagnosticCollection(pathAsUri, documentVersionNumber: -1, diagnostics: convertedDiagnostics); + collections.Add(collection); + } } - } - private static void AddArgsToClearBuildOnlyDocumentErrors(ref TemporaryArray builder, Solution solution, ProjectId? projectId, DocumentId? documentId) - => builder.Add(CreateDiagnosticsRemovedArgs(documentId, solution, projectId, documentId)); - - public void AddNewErrors(ProjectId projectId, DiagnosticData diagnostic) - { - Debug.Assert(diagnostic.IsBuildDiagnostic()); - - // Capture state that will be processed in background thread. - var state = GetOrCreateInProgressState(); - - _taskQueue.ScheduleTask("Project New Errors", async () => + if (collections.Any()) { - await ReportPreviousProjectErrorsIfRequiredAsync(projectId, state).ConfigureAwait(false); - state.AddError(projectId, diagnostic); - }, state.CancellationToken); + // Report with projectId so we can clear individual project errors. + await diagnosticManagerService.AppendDiagnosticsAsync(projectId.Id.ToString(), collections.ToImmutable(), cancellationToken).ConfigureAwait(false); + } } - public void AddNewErrors(DocumentId documentId, DiagnosticData diagnostic) + private static Microsoft.VisualStudio.RpcContracts.DiagnosticManagement.Diagnostic? CreateDiagnostic(ProjectId projectId, Guid projectHierarchyGuid, DiagnosticData diagnostic, Solution solution) { - Debug.Assert(diagnostic.IsBuildDiagnostic()); - - // Capture state that will be processed in background thread. - var state = GetOrCreateInProgressState(); - - _taskQueue.ScheduleTask("Document New Errors", async () => - { - await ReportPreviousProjectErrorsIfRequiredAsync(documentId.ProjectId, state).ConfigureAwait(false); - state.AddError(documentId, diagnostic); - }, state.CancellationToken); + var project = GetProjectIdentifier(solution.GetProject(projectId), projectHierarchyGuid); + ImmutableArray projects = project is not null ? [project.Value] : []; + + var range = GetRange(diagnostic); + return new Microsoft.VisualStudio.RpcContracts.DiagnosticManagement.Diagnostic( + message: diagnostic.Message ?? string.Empty, + code: diagnostic.Id, + severity: GetSeverity(diagnostic.Severity), + range: GetRange(diagnostic), + tags: RpcContracts.DiagnosticManagement.DiagnosticTags.BuildError, + relatedInformation: null, + expandedMessage: diagnostic.Description, + // Intentionally the same as diagnosticType, matches what we used to report. + source: diagnostic.Category, + helpLink: diagnostic.HelpLink, + diagnosticType: diagnostic.Category, + projects: projects, + identifier: (diagnostic.Id, diagnostic.DataLocation.UnmappedFileSpan.Path, range, diagnostic.Message).GetHashCode().ToString(), + outputId: null); } - public void AddNewErrors( - ProjectId projectId, HashSet projectErrors, Dictionary> documentErrorMap) + private static RpcContracts.Utilities.ProjectIdentifier? GetProjectIdentifier(Project? project, Guid projectHierarchyGuid) { - Debug.Assert(projectErrors.All(d => d.IsBuildDiagnostic())); - Debug.Assert(documentErrorMap.SelectMany(kvp => kvp.Value).All(d => d.IsBuildDiagnostic())); - - // Capture state that will be processed in background thread - var state = GetOrCreateInProgressState(); - - _taskQueue.ScheduleTask("Project New Errors", async () => + if (project is null) { - await ReportPreviousProjectErrorsIfRequiredAsync(projectId, state).ConfigureAwait(false); - - foreach (var kv in documentErrorMap) - state.AddErrors(kv.Key, kv.Value); + // It is possible (but unlikely) that the solution snapshot we saved at the start of the build + // does not contain the projectId against which the build is reporting diagnostics due to the inherent race in invoking build. + return null; + } - state.AddErrors(projectId, projectErrors); - }, state.CancellationToken); + return new RpcContracts.Utilities.ProjectIdentifier( + name: project.Name, + identifier: projectHierarchyGuid.ToString()); } - /// - /// This method is invoked from all overloads before it adds the new errors to the in progress state. - /// It checks if build reported errors for a different project then the previous callback to report errors. - /// This provides a good checkpoint to de-dupe build and live errors for lastProjectId and - /// raise diagnostic updated events for that project. - /// This ensures that error list keeps getting refreshed while a build is in progress, as opposed to doing all the work - /// and a single refresh when the build completes. - /// - private ValueTask ReportPreviousProjectErrorsIfRequiredAsync(ProjectId projectId, InProgressState state) + private static RpcContracts.DiagnosticManagement.DiagnosticSeverity GetSeverity(CodeAnalysis.DiagnosticSeverity severity) { - if (state.TryGetLastProjectWithReportedErrors() is ProjectId lastProjectId && - lastProjectId != projectId) - { - return SetLiveErrorsForProjectAsync(lastProjectId, state); - } - - return default; + return severity switch + { + CodeAnalysis.DiagnosticSeverity.Hidden => RpcContracts.DiagnosticManagement.DiagnosticSeverity.Hint, + CodeAnalysis.DiagnosticSeverity.Info => RpcContracts.DiagnosticManagement.DiagnosticSeverity.Information, + CodeAnalysis.DiagnosticSeverity.Warning => RpcContracts.DiagnosticManagement.DiagnosticSeverity.Warning, + CodeAnalysis.DiagnosticSeverity.Error => RpcContracts.DiagnosticManagement.DiagnosticSeverity.Error, + _ => throw ExceptionUtilities.UnexpectedValue(severity), + }; } - private async ValueTask SetLiveErrorsForProjectAsync(ProjectId projectId, InProgressState state) + private static RpcContracts.Utilities.Range GetRange(DiagnosticData diagnostic) { - var diagnostics = state.GetLiveErrorsForProject(projectId); - await SetLiveErrorsForProjectAsync(projectId, diagnostics, state.CancellationToken).ConfigureAwait(false); - state.MarkLiveErrorsReported(projectId); + // Caller always created DiagnosticData with unmapped information. + var startPosition = diagnostic.DataLocation.UnmappedFileSpan.StartLinePosition; + var endPosition = diagnostic.DataLocation.UnmappedFileSpan.EndLinePosition; + return new RpcContracts.Utilities.Range(startPosition.Line, startPosition.Character, endPosition.Line, endPosition.Character); } - private ValueTask SetLiveErrorsForProjectAsync(ProjectId projectId, ImmutableArray diagnostics, CancellationToken cancellationToken) + /// + /// Creates or gets the existing + /// It is important that this is created only once as the client will remove our errors + /// when the instance of the brokered service is disposed of. + /// + /// Serial access to this is guaranteed as all calls run inside the + /// + private async Task GetOrCreateDiagnosticManagerAsync(CancellationToken cancellationToken) { - if (_diagnosticService is DiagnosticAnalyzerService diagnosticAnalyzerService) + if (_diagnosticManagerService == null) { - // make those errors live errors - var map = ProjectErrorMap.Empty.Add(projectId, diagnostics); - return diagnosticAnalyzerService.SynchronizeWithBuildAsync(_workspace, map, onBuildCompleted: false, cancellationToken); + _diagnosticManagerService = await _serviceBroker.GetProxyAsync( + VisualStudioServices.VS2019_7.DiagnosticManagerService, + cancellationToken: cancellationToken).ConfigureAwait(false); + Contract.ThrowIfNull(_diagnosticManagerService, $"Unable to acquire {nameof(IDiagnosticManagerService)}"); } - return default; + return _diagnosticManagerService; } - private CancellationToken GetApplicableCancellationToken(InProgressState? state) - => state?.CancellationToken ?? _disposalToken; - private InProgressState? GetBuildInProgressState() { lock (_gate) @@ -546,71 +292,13 @@ private InProgressState GetOrCreateInProgressState() // We take current snapshot of solution when the state is first created. and through out this code, we use this snapshot. // Since we have no idea what actual snapshot of solution the out of proc build has picked up, it doesn't remove the race we can have // between build and diagnostic service, but this at least make us to consistent inside of our code. - _stateDoNotAccessDirectly = new InProgressState(this, _workspace.CurrentSolution, _activeCancellationSeriesDoNotAccessDirectly.CreateNext(_disposalToken)); - OnBuildProgressChanged(_stateDoNotAccessDirectly, BuildProgress.Started); + _stateDoNotAccessDirectly = new InProgressState(this, _workspace.CurrentSolution); } return _stateDoNotAccessDirectly; } } - private static DiagnosticsUpdatedArgs CreateDiagnosticsCreatedArgs(object? id, Solution solution, ProjectId? projectId, DocumentId? documentId, ImmutableArray items) - { - return DiagnosticsUpdatedArgs.DiagnosticsCreated(CreateArgumentKey(id), solution, projectId, documentId, items); - } - - private static DiagnosticsUpdatedArgs CreateDiagnosticsRemovedArgs(object? id, Solution solution, ProjectId? projectId, DocumentId? documentId) - { - return DiagnosticsUpdatedArgs.DiagnosticsRemoved(CreateArgumentKey(id), solution, projectId, documentId); - } - - private void ProcessAndRaiseDiagnosticsUpdated(ImmutableArray argsCollection) - { - if (argsCollection.IsEmpty) - { - return; - } - - foreach (var args in argsCollection) - { - if (args.Kind == DiagnosticsUpdatedKind.DiagnosticsCreated) - { - RoslynDebug.AssertNotNull(args.Solution); - _buildOnlyDiagnosticsService.AddBuildOnlyDiagnostics(args.Solution, args.ProjectId, args.DocumentId, args.Diagnostics); - } - else if (args.Kind == DiagnosticsUpdatedKind.DiagnosticsRemoved) - { - RoslynDebug.AssertNotNull(args.Solution); - _buildOnlyDiagnosticsService.ClearBuildOnlyDiagnostics(args.Solution, args.ProjectId, args.DocumentId); - } - } - - DiagnosticsUpdated?.Invoke(this, argsCollection); - } - - private static ArgumentKey CreateArgumentKey(object? id) => new(id); - - private void RaiseBuildProgressChanged(BuildProgress progress) - => BuildProgressChanged?.Invoke(this, progress); - - public bool SupportGetDiagnostics { get { return false; } } - - internal TestAccessor GetTestAccessor() - => new(this); - - internal enum BuildProgress - { - Started, - Updated, - Done - } - - internal readonly struct TestAccessor(ExternalErrorDiagnosticUpdateSource instance) - { - internal void OnWorkspaceChanged(object sender, WorkspaceChangeEventArgs e) - => instance.OnWorkspaceChanged(sender, e); - } - private sealed class InProgressState { private readonly ExternalErrorDiagnosticUpdateSource _owner; @@ -623,79 +311,21 @@ private sealed class InProgressState /// private readonly Dictionary> _allDiagnosticIdMap = []; - /// - /// Map from project ID to all the possible intellisense analyzer diagnostic IDs that can be reported in the project. - /// A diagnostic is considered to be an intellise analyzer diagnostic if is reported from a non-compilation end action in an analyzer, - /// i.e. we do not require to analyze the entire compilation to compute these diagnostics. - /// Compilation end diagnostics are considered build-only diagnostics. - /// - /// - /// This map may be accessed concurrently, so needs to ensure thread safety by using locks. - /// - private readonly Dictionary> _liveDiagnosticIdMap = []; - - // Fields that are used only from APIs invoked from serialized task queue, hence don't need to be thread safe. - #region Serialized fields - - /// - /// Map from project ID to a dictionary of reported project level diagnostics to an integral counter. - /// Project level diagnostics are diagnostics that have no document location, i.e. reported with . - /// Integral counter value for each diagnostic is used to order the reported diagnostics in error list - /// based on the order in which they were reported during build. - /// - private readonly Dictionary> _projectMap = []; - - /// - /// Map from document ID to a dictionary of reported document level diagnostics to an integral counter. - /// Project level diagnostics are diagnostics that have a valid document location, i.e. reported with a location within a syntax tree. - /// Integral counter value for each diagnostic is used to order the reported diagnostics in error list - /// based on the order in which they were reported during build. - /// - private readonly Dictionary> _documentMap = []; - - /// - /// Set of projects for which we have already cleared the build and intellisense diagnostics in the error list. - /// - private readonly HashSet _projectsWithErrorsCleared = []; - - /// - /// Set of projects for which we have reported all intellisense/live diagnostics. - /// - private readonly HashSet _projectsWithAllLiveErrorsReported = []; - - /// - /// Set of projects which have at least one project or document diagnostic in - /// and/or . - /// - private readonly HashSet _projectsWithErrors = []; - - /// - /// Last project for which build reported an error through one of the methods. - /// - private ProjectId? _lastProjectWithReportedErrors; - - /// - /// Counter to help order the diagnostics in error list based on the order in which they were reported during build. - /// - private int _incrementDoNotAccessDirectly; - - #endregion - - public InProgressState(ExternalErrorDiagnosticUpdateSource owner, Solution solution, CancellationToken cancellationToken) + public InProgressState(ExternalErrorDiagnosticUpdateSource owner, Solution solution) { _owner = owner; Solution = solution; - CancellationToken = cancellationToken; } public Solution Solution { get; } - public CancellationToken CancellationToken { get; } + public bool IsSupportedDiagnosticId(ProjectId projectId, string id) + => GetOrCreateSupportedDiagnosticIds(projectId).Contains(id); private static ImmutableHashSet GetOrCreateDiagnosticIds( ProjectId projectId, Dictionary> diagnosticIdMap, - Func> computeDiagosticIds) + Func> computeDiagnosticIds) { lock (diagnosticIdMap) { @@ -705,7 +335,7 @@ private static ImmutableHashSet GetOrCreateDiagnosticIds( } } - var computedIds = computeDiagosticIds(); + var computedIds = computeDiagnosticIds(); lock (diagnosticIdMap) { @@ -714,9 +344,6 @@ private static ImmutableHashSet GetOrCreateDiagnosticIds( } } - public bool IsSupportedDiagnosticId(ProjectId projectId, string id) - => GetOrCreateSupportedDiagnosticIds(projectId).Contains(id); - private ImmutableHashSet GetOrCreateSupportedDiagnosticIds(ProjectId projectId) { return GetOrCreateDiagnosticIds(projectId, _allDiagnosticIdMap, ComputeSupportedDiagnosticIds); @@ -732,312 +359,11 @@ ImmutableHashSet ComputeSupportedDiagnosticIds() // set ids set var builder = ImmutableHashSet.CreateBuilder(); - var descriptorMap = Solution.SolutionState.Analyzers.GetDiagnosticDescriptorsPerReference(_owner._diagnosticService.AnalyzerInfoCache, project); + var descriptorMap = Solution.SolutionState.Analyzers.GetDiagnosticDescriptorsPerReference(_owner.AnalyzerInfoCache, project); builder.UnionWith(descriptorMap.Values.SelectMany(v => v.Select(d => d.Id))); return builder.ToImmutable(); } } - - public ImmutableArray GetBuildErrors() - { - // return errors in the order that is reported - return ImmutableArray.CreateRange( - _projectMap.Values.SelectMany(d => d).Concat(_documentMap.Values.SelectMany(d => d)).OrderBy(kv => kv.Value).Select(kv => kv.Key)); - } - - public void MarkErrorsCleared(ProjectId projectId) - { - var added = _projectsWithErrorsCleared.Add(projectId); - Debug.Assert(added); - } - - public bool WereProjectErrorsCleared(ProjectId projectId) - => _projectsWithErrorsCleared.Contains(projectId); - - public void MarkLiveErrorsReported(ProjectId projectId) - => _projectsWithAllLiveErrorsReported.Add(projectId); - - public ProjectId? TryGetLastProjectWithReportedErrors() - => _lastProjectWithReportedErrors; - - public (ImmutableArray allLiveErrors, ProjectErrorMap pendingLiveErrorsToSync) GetLiveErrors() - { - var allLiveErrorsBuilder = ImmutableArray.CreateBuilder(); - var pendingLiveErrorsToSyncBuilder = ImmutableDictionary.CreateBuilder>(); - foreach (var projectId in GetProjectsWithErrors()) - { - CancellationToken.ThrowIfCancellationRequested(); - - var errors = GetLiveErrorsForProject(projectId); - allLiveErrorsBuilder.AddRange(errors); - - if (!_projectsWithAllLiveErrorsReported.Contains(projectId)) - { - pendingLiveErrorsToSyncBuilder.Add(projectId, errors); - } - } - - return (allLiveErrorsBuilder.ToImmutable(), pendingLiveErrorsToSyncBuilder.ToImmutable()); - - // Local functions. - IEnumerable GetProjectsWithErrors() - { - // Filter out project that is no longer exist in IDE - // this can happen if user started a "build" and then remove a project from IDE - // before build finishes - return _projectsWithErrors.Where(p => Solution.GetProject(p) != null); - } - } - - public ImmutableArray GetLiveErrorsForProject(ProjectId projectId) - { - var project = Solution.GetProject(projectId); - if (project == null) - { - return ImmutableArray.Empty; - } - - var diagnostics = _projectMap.Where(kv => kv.Key == projectId).SelectMany(kv => kv.Value).Concat( - _documentMap.Where(kv => kv.Key.ProjectId == projectId).SelectMany(kv => kv.Value)); - using var _ = ArrayBuilder.GetInstance(out var builder); - foreach (var (diagnostic, _) in diagnostics) - { - if (IsLive(project, diagnostic)) - { - builder.Add(diagnostic); - } - } - - return builder.ToImmutable(); - } - - public void AddErrors(DocumentId key, HashSet diagnostics) - => AddErrors(_documentMap, key, diagnostics); - - public void AddErrors(ProjectId key, HashSet diagnostics) - => AddErrors(_projectMap, key, diagnostics); - - public void AddError(DocumentId key, DiagnosticData diagnostic) - => AddError(_documentMap, key, diagnostic); - - public void AddError(ProjectId key, DiagnosticData diagnostic) - => AddError(_projectMap, key, diagnostic); - - private bool IsLive(Project project, DiagnosticData diagnosticData) - { - // REVIEW: current design is that we special case compiler analyzer case and we accept only document level - // diagnostic as live. otherwise, we let them be build errors. we changed compiler analyzer accordingly as well - // so that it doesn't report project level diagnostic as live errors. - if (!IsDocumentLevelDiagnostic(diagnosticData) && - diagnosticData.CustomTags.Contains(WellKnownDiagnosticTags.Compiler)) - { - // compiler error but project level error - return false; - } - - // Compiler diagnostics reported on additional documents indicate mapped diagnostics, such as compiler diagnostics - // in razor files which are actually reported on generated source files but mapped to razor files during build. - // These are not reported on additional files during live analysis, and can be considered to be build-only diagnostics. - if (IsAdditionalDocumentDiagnostic(project, diagnosticData) && - diagnosticData.CustomTags.Contains(WellKnownDiagnosticTags.Compiler)) - { - return false; - } - - if (IsSupportedLiveDiagnosticId(project, diagnosticData.Id)) - { - return true; - } - - return false; - - static bool IsDocumentLevelDiagnostic(DiagnosticData diagnosticData) - { - if (diagnosticData.DocumentId != null) - { - return true; - } - - // due to mapped file such as - // - // A.cs having - // #line 2 RandomeFile.txt - // ErrorHere - // #line default - // - // we can't simply say it is not document level diagnostic since - // file path is not part of solution. build output will just tell us - // mapped span not original span, so any code like above will not - // part of solution. - // - // but also we can't simply say it is a document level error because it has file path - // since project level error can have a file path pointing to a file such as dll - // , pdb, embedded files and etc. - // - // unfortunately, there is no 100% correct way to do this. - // so we will use a heuristic that will most likely work for most of common cases. - return - !string.IsNullOrEmpty(diagnosticData.DataLocation.UnmappedFileSpan.Path) && - (diagnosticData.DataLocation.UnmappedFileSpan.StartLinePosition.Line > 0 || - diagnosticData.DataLocation.UnmappedFileSpan.StartLinePosition.Character > 0); - } - - static bool IsAdditionalDocumentDiagnostic(Project project, DiagnosticData diagnosticData) - => diagnosticData.DocumentId != null && project.ContainsAdditionalDocument(diagnosticData.DocumentId); - } - - private bool IsSupportedLiveDiagnosticId(Project project, string id) - => GetOrCreateSupportedLiveDiagnostics(project).Contains(id); - - private ImmutableHashSet GetOrCreateSupportedLiveDiagnostics(Project project) - { - var fullSolutionAnalysis = _owner._diagnosticService.GlobalOptions.IsFullSolutionAnalysisEnabled(project.Language); - if (!project.SupportsCompilation || fullSolutionAnalysis) - { - // Defer to _allDiagnosticIdMap so we avoid placing FSA diagnostics in _liveDiagnosticIdMap - return GetOrCreateSupportedDiagnosticIds(project.Id); - } - - return GetOrCreateDiagnosticIds(project.Id, _liveDiagnosticIdMap, ComputeSupportedLiveDiagnosticIds); - - ImmutableHashSet ComputeSupportedLiveDiagnosticIds() - { - // set ids set - var builder = ImmutableHashSet.CreateBuilder(); - var infoCache = _owner._diagnosticService.AnalyzerInfoCache; - - foreach (var analyzersPerReference in project.Solution.SolutionState.Analyzers.CreateDiagnosticAnalyzersPerReference(project)) - { - foreach (var analyzer in analyzersPerReference.Value) - { - var diagnosticIds = infoCache.GetNonCompilationEndDiagnosticDescriptors(analyzer).Select(d => d.Id); - builder.UnionWith(diagnosticIds); - } - } - - return builder.ToImmutable(); - } - } - - private void AddErrors(Dictionary> map, T key, HashSet diagnostics) - where T : notnull - { - var errors = GetErrorSet(map, key); - foreach (var diagnostic in diagnostics) - { - AddError(errors, diagnostic, key); - } - } - - private void AddError(Dictionary> map, T key, DiagnosticData diagnostic) - where T : notnull - { - var errors = GetErrorSet(map, key); - AddError(errors, diagnostic, key); - } - - private void AddError(Dictionary errors, DiagnosticData diagnostic, T key) - where T : notnull - { - RecordProjectContainsErrors(); - - // add only new errors - if (!errors.TryGetValue(diagnostic, out _)) - { - Logger.Log(FunctionId.ExternalErrorDiagnosticUpdateSource_AddError, d => d.ToString(), diagnostic); - - errors.Add(diagnostic, _incrementDoNotAccessDirectly++); - } - - return; - - void RecordProjectContainsErrors() - { - RoslynDebug.Assert(key is DocumentId or ProjectId); - var projectId = (key is DocumentId documentId) ? documentId.ProjectId : (ProjectId)(object)key; - - // New errors reported for project, need to refresh live errors. - _projectsWithAllLiveErrorsReported.Remove(projectId); - - if (!_projectsWithErrors.Add(projectId)) - { - return; - } - - // this will make build only error list to be updated per project rather than per solution. - // basically this will make errors up to last project to show up in error list - _lastProjectWithReportedErrors = projectId; - _owner.OnBuildProgressChanged(this, BuildProgress.Updated); - } - } - - private static Dictionary GetErrorSet(Dictionary> map, T key) - where T : notnull - => map.GetOrAdd(key, _ => new Dictionary(DiagnosticDataComparer.Instance)); - } - - private sealed class ArgumentKey : BuildToolId.Base - { - public ArgumentKey(object? key) : base(key) - { - } - - public override string BuildTool - { - get { return PredefinedBuildTools.Build; } - } - - public override bool Equals(object? obj) - => obj is ArgumentKey && - base.Equals(obj); - - public override int GetHashCode() - => base.GetHashCode(); - } - - private sealed class DiagnosticDataComparer : IEqualityComparer - { - public static readonly DiagnosticDataComparer Instance = new(); - - public bool Equals(DiagnosticData item1, DiagnosticData item2) - { - if ((item1.DocumentId == null) != (item2.DocumentId == null) || - item1.Id != item2.Id || - item1.ProjectId != item2.ProjectId || - item1.Severity != item2.Severity || - item1.Message != item2.Message || - item1.DataLocation.MappedFileSpan.Span != item2.DataLocation.MappedFileSpan.Span || - item1.DataLocation.UnmappedFileSpan.Span != item2.DataLocation.UnmappedFileSpan.Span) - { - return false; - } - - // TODO: unclear why we are comparing the original paths, and not the normalized paths. This may - // indicate a bug. If it is correct behavior, this should be documented as to why this is the right span - // to be considering. - return (item1.DocumentId != null) - ? item1.DocumentId == item2.DocumentId - : item1.DataLocation.UnmappedFileSpan.Path == item2.DataLocation.UnmappedFileSpan.Path; - } - - public int GetHashCode(DiagnosticData obj) - { - // TODO: unclear on why we're hashing the start of the data location, whereas .Equals above checks the - // full span. - var result = - Hash.Combine(obj.Id, - Hash.Combine(obj.Message, - Hash.Combine(obj.ProjectId, - Hash.Combine(obj.DataLocation.MappedFileSpan.Span.Start.GetHashCode(), - Hash.Combine(obj.DataLocation.UnmappedFileSpan.Span.Start.GetHashCode(), (int)obj.Severity))))); - - // TODO: unclear why we are hashing the original path, and not the normalized path. This may - // indicate a bug. If it is correct behavior, this should be documented as to why this is the right span - // to be considering. - return obj.DocumentId != null - ? Hash.Combine(obj.DocumentId, result) - : Hash.Combine(obj.DataLocation.UnmappedFileSpan.Path, result); - } } } diff --git a/src/VisualStudio/Core/Def/TaskList/ProjectExternalErrorReporter.cs b/src/VisualStudio/Core/Def/TaskList/ProjectExternalErrorReporter.cs index 9dbd38097844c..817044567db71 100644 --- a/src/VisualStudio/Core/Def/TaskList/ProjectExternalErrorReporter.cs +++ b/src/VisualStudio/Core/Def/TaskList/ProjectExternalErrorReporter.cs @@ -15,6 +15,7 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.ErrorReporting; +using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem; @@ -33,26 +34,26 @@ internal sealed class ProjectExternalErrorReporter : IVsReportExternalErrors, IV internal static readonly ImmutableArray CompilerDiagnosticCustomTags = [WellKnownDiagnosticTags.Compiler, WellKnownDiagnosticTags.Telemetry]; private readonly ProjectId _projectId; + + /// + /// Passed to the error reporting service to allow current project error list filters to work. + /// + private readonly Guid _projectHierarchyGuid; private readonly string _errorCodePrefix; private readonly string _language; private readonly VisualStudioWorkspaceImpl _workspace; - [Obsolete("This is a compatibility shim for F#; please do not use it.")] - public ProjectExternalErrorReporter(ProjectId projectId, string errorCodePrefix, IServiceProvider serviceProvider) - : this(projectId, errorCodePrefix, LanguageNames.FSharp, (VisualStudioWorkspaceImpl)serviceProvider.GetMefService()) - { - } - private DiagnosticAnalyzerInfoCache AnalyzerInfoCache => _workspace.ExternalErrorDiagnosticUpdateSource.AnalyzerInfoCache; - public ProjectExternalErrorReporter(ProjectId projectId, string errorCodePrefix, string language, VisualStudioWorkspaceImpl workspace) + public ProjectExternalErrorReporter(ProjectId projectId, Guid projectHierarchyGuid, string errorCodePrefix, string language, VisualStudioWorkspaceImpl workspace) { Debug.Assert(projectId != null); Debug.Assert(errorCodePrefix != null); Debug.Assert(workspace != null); _projectId = projectId; + _projectHierarchyGuid = projectHierarchyGuid; _errorCodePrefix = errorCodePrefix; _language = language; _workspace = workspace; @@ -82,8 +83,7 @@ private bool CanHandle(string errorId) public int AddNewErrors(IVsEnumExternalErrors pErrors) { - var projectErrors = new HashSet(); - var documentErrorsMap = new Dictionary>(); + using var _ = ArrayBuilder.GetInstance(out var allDiagnostics); var errors = new ExternalError[1]; var project = _workspace.CurrentSolution.GetProject(_projectId); @@ -95,13 +95,12 @@ public int AddNewErrors(IVsEnumExternalErrors pErrors) var diagnostic = TryCreateDocumentDiagnosticItem(error); if (diagnostic != null) { - var diagnostics = documentErrorsMap.GetOrAdd(diagnostic.DocumentId, _ => new HashSet()); - diagnostics.Add(diagnostic); + allDiagnostics.Add(diagnostic); continue; } } - projectErrors.Add(GetDiagnosticData( + allDiagnostics.Add(GetDiagnosticData( documentId: null, _projectId, _workspace, @@ -113,7 +112,7 @@ public int AddNewErrors(IVsEnumExternalErrors pErrors) AnalyzerInfoCache)); } - DiagnosticProvider.AddNewErrors(_projectId, projectErrors, documentErrorsMap); + DiagnosticProvider.AddNewErrors(_projectId, _projectHierarchyGuid, allDiagnostics.ToImmutable()); return VSConstants.S_OK; } @@ -252,14 +251,7 @@ public void ReportError2(string bstrErrorMessage, string bstrErrorId, [ComAliasN new LinePosition(iEndLine, iEndColumn)), AnalyzerInfoCache); - if (documentId == null) - { - DiagnosticProvider.AddNewErrors(_projectId, diagnostic); - } - else - { - DiagnosticProvider.AddNewErrors(documentId, diagnostic); - } + DiagnosticProvider.AddNewErrors(_projectId, _projectHierarchyGuid, [diagnostic]); } public int ClearErrors() diff --git a/src/VisualStudio/Core/Impl/ProjectSystem/CPS/CPSProject_IWorkspaceProjectContext.cs b/src/VisualStudio/Core/Impl/ProjectSystem/CPS/CPSProject_IWorkspaceProjectContext.cs index 8828b7ec98de2..0a36ebeb63eb5 100644 --- a/src/VisualStudio/Core/Impl/ProjectSystem/CPS/CPSProject_IWorkspaceProjectContext.cs +++ b/src/VisualStudio/Core/Impl/ProjectSystem/CPS/CPSProject_IWorkspaceProjectContext.cs @@ -81,7 +81,7 @@ public CPSProject(ProjectSystemProject projectSystemProject, VisualStudioWorkspa _ => null }; - return (prefix != null) ? new ProjectExternalErrorReporter(projectSystemProject.Id, prefix, projectSystemProject.Language, visualStudioWorkspace) : null; + return (prefix != null) ? new ProjectExternalErrorReporter(projectSystemProject.Id, projectGuid, prefix, projectSystemProject.Language, visualStudioWorkspace) : null; }); _projectCodeModel = projectCodeModelFactory.CreateProjectCodeModel(projectSystemProject.Id, new CPSCodeModelInstanceFactory(this)); diff --git a/src/VisualStudio/Core/Test/Diagnostics/ExternalDiagnosticUpdateSourceTests.vb b/src/VisualStudio/Core/Test/Diagnostics/ExternalDiagnosticUpdateSourceTests.vb index 60681166d0967..18f5ba636ac94 100644 --- a/src/VisualStudio/Core/Test/Diagnostics/ExternalDiagnosticUpdateSourceTests.vb +++ b/src/VisualStudio/Core/Test/Diagnostics/ExternalDiagnosticUpdateSourceTests.vb @@ -3,78 +3,46 @@ ' See the LICENSE file in the project root for more information. Imports System.Collections.Immutable +Imports System.ComponentModel.Composition +Imports System.IO.Pipelines Imports System.Threading Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.CodeActions Imports Microsoft.CodeAnalysis.CommonDiagnosticAnalyzers Imports Microsoft.CodeAnalysis.Diagnostics +Imports Microsoft.CodeAnalysis.Editor.[Shared].Utilities Imports Microsoft.CodeAnalysis.Editor.UnitTests -Imports Microsoft.CodeAnalysis.Editor.UnitTests.Diagnostics -Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces -Imports Microsoft.CodeAnalysis.Notification +Imports Microsoft.CodeAnalysis.Host.Mef Imports Microsoft.CodeAnalysis.Options -Imports Microsoft.CodeAnalysis.PooledObjects Imports Microsoft.CodeAnalysis.Shared.TestHooks -Imports Microsoft.CodeAnalysis.SolutionCrawler Imports Microsoft.CodeAnalysis.Test.Utilities Imports Microsoft.CodeAnalysis.Text +Imports Microsoft.ServiceHub.Framework +Imports Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel Imports Microsoft.VisualStudio.LanguageServices.Implementation.TaskList +Imports Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.Mocks +Imports Microsoft.VisualStudio.RpcContracts.DiagnosticManagement +Imports Microsoft.VisualStudio.Shell.ServiceBroker Imports Roslyn.Test.Utilities Imports Roslyn.Utilities Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics <[UseExportProvider]> Public Class ExternalDiagnosticUpdateSourceTests - Private Shared ReadOnly s_compositionWithMockDiagnosticUpdateSourceRegistrationService As TestComposition = EditorTestCompositions.EditorFeatures - - - Public Sub TestExternalDiagnostics_SupportGetDiagnostics() - Using workspace = EditorTestWorkspace.CreateCSharp(String.Empty) - Dim waiter = New AsynchronousOperationListener() - Dim service = New TestDiagnosticAnalyzerService(workspace.GlobalOptions) - Using source = New ExternalErrorDiagnosticUpdateSource( - workspace, service, workspace.GetService(Of IGlobalOperationNotificationService), waiter, CancellationToken.None) - End Using - End Using - End Sub - - - Public Async Function TestExternalDiagnostics_RaiseEvents() As Task - Using workspace = EditorTestWorkspace.CreateCSharp(String.Empty) - Dim globalOptions = workspace.GetService(Of IGlobalOptionService) - Dim waiter = New AsynchronousOperationListener() - Dim service = New TestDiagnosticAnalyzerService(workspace.GlobalOptions) - Using source = New ExternalErrorDiagnosticUpdateSource( - workspace, service, workspace.GetService(Of IGlobalOperationNotificationService), waiter, CancellationToken.None) - - Dim project = workspace.CurrentSolution.Projects.First() - Dim diagnostic = GetDiagnosticData(project.Id) - - Dim expected = 1 - AddHandler source.DiagnosticsUpdated, Sub(o, argsCollection) - Dim args = argsCollection.Single() - Dim diagnostics = args.Diagnostics - Assert.Equal(expected, diagnostics.Length) - If expected = 1 Then - Assert.Equal(diagnostics(0), diagnostic) - End If - End Sub - - source.AddNewErrors(project.DocumentIds.First(), diagnostic) - source.OnSolutionBuildCompleted() - Await waiter.ExpeditedWaitAsync() - - expected = 0 - source.ClearErrors(project.Id) - Await waiter.ExpeditedWaitAsync() - End Using - End Using - End Function - - - Public Sub TestExternalDiagnostics_SupportedId() - Using workspace = EditorTestWorkspace.CreateCSharp(String.Empty) - Dim waiter = New AsynchronousOperationListener() + Private Shared ReadOnly s_composition As TestComposition = VisualStudioTestCompositions.LanguageServices.AddParts( + GetType(TestServiceBroker), + GetType(MockServiceProvider), + GetType(StubVsServiceExporter(Of )), + GetType(StubVsServiceExporter(Of ,)), + GetType(MockVisualStudioWorkspace), + GetType(ProjectCodeModelFactory)) + + Private Shared ReadOnly s_projectGuid As Guid = Guid.NewGuid() + + + Public Async Function TestExternalDiagnostics_SupportedId() As Task + Using workspace = EditorTestWorkspace.CreateCSharp(String.Empty, composition:=s_composition) + Dim waiter = workspace.GetService(Of AsynchronousOperationListenerProvider)().GetWaiter(FeatureAttribute.ErrorList) Dim analyzer = New AnalyzerForErrorLogTest() Dim analyzerReference = New TestAnalyzerReferenceByLanguage( @@ -82,359 +50,177 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics workspace.TryApplyChanges(workspace.CurrentSolution.WithAnalyzerReferences({analyzerReference})) + Dim threadingContext = workspace.ExportProvider.GetExport(Of IThreadingContext).Value + Dim service = New TestDiagnosticAnalyzerService(workspace.GlobalOptions) - Using source = New ExternalErrorDiagnosticUpdateSource( - workspace, service, workspace.GetService(Of IGlobalOperationNotificationService), waiter, CancellationToken.None) + Dim vsWorkspace = workspace.ExportProvider.GetExportedValue(Of MockVisualStudioWorkspace)() + vsWorkspace.SetWorkspace(workspace) + Using source = workspace.ExportProvider.GetExportedValue(Of ExternalErrorDiagnosticUpdateSource)() Dim project = workspace.CurrentSolution.Projects.First() source.OnSolutionBuildStarted() + Await waiter.ExpeditedWaitAsync() Assert.True(source.IsSupportedDiagnosticId(project.Id, "ID1")) Assert.False(source.IsSupportedDiagnosticId(project.Id, "CA1002")) End Using End Using - End Sub + End Function - - Public Sub TestExternalDiagnostics_SupportedDiagnosticId_Concurrent() - Using workspace = EditorTestWorkspace.CreateCSharp(String.Empty) - Dim waiter = New AsynchronousOperationListener() + + Public Async Function TestExternalDiagnostics_SupportedDiagnosticId_Concurrent() As Task + Using workspace = EditorTestWorkspace.CreateCSharp(String.Empty, composition:=s_composition) + Dim waiter = workspace.GetService(Of AsynchronousOperationListenerProvider)().GetWaiter(FeatureAttribute.ErrorList) Dim service = New TestDiagnosticAnalyzerService(workspace.GlobalOptions) - Using source = New ExternalErrorDiagnosticUpdateSource( - workspace, service, workspace.GetService(Of IGlobalOperationNotificationService), waiter, CancellationToken.None) + Dim vsWorkspace = workspace.ExportProvider.GetExportedValue(Of MockVisualStudioWorkspace)() + vsWorkspace.SetWorkspace(workspace) + Using source = workspace.ExportProvider.GetExportedValue(Of ExternalErrorDiagnosticUpdateSource)() Dim project = workspace.CurrentSolution.Projects.First() source.OnSolutionBuildStarted() + Await waiter.ExpeditedWaitAsync() Parallel.For(0, 100, Sub(i As Integer) source.IsSupportedDiagnosticId(project.Id, "CS1002")) End Using End Using - End Sub - - - Public Async Function TestExternalDiagnostics_DuplicatedError() As Task - Using workspace = EditorTestWorkspace.CreateCSharp(String.Empty) - Dim globalOptions = workspace.GetService(Of IGlobalOptionService) - Dim waiter = New AsynchronousOperationListener() - - Dim project = workspace.CurrentSolution.Projects.First() - Dim diagnostic = GetDiagnosticData(project.Id) + End Function - Dim service = New TestDiagnosticAnalyzerService(globalOptions, ImmutableArray.Create(diagnostic)) - Using source = New ExternalErrorDiagnosticUpdateSource( - workspace, service, workspace.GetService(Of IGlobalOperationNotificationService), waiter, CancellationToken.None) + + Public Sub TestExternalDiagnostics_SupportedIdFalseIfBuildNotStarted() + Using workspace = EditorTestWorkspace.CreateCSharp(String.Empty, composition:=s_composition) + Dim waiter = workspace.GetService(Of AsynchronousOperationListenerProvider)().GetWaiter(FeatureAttribute.ErrorList) + Dim analyzer = New AnalyzerForErrorLogTest() - Dim map = New Dictionary(Of DocumentId, HashSet(Of DiagnosticData))() - map.Add(project.DocumentIds.First(), New HashSet(Of DiagnosticData)( - SpecializedCollections.SingletonEnumerable(GetDiagnosticData(project.Id)))) + Dim analyzerReference = New TestAnalyzerReferenceByLanguage( + ImmutableDictionary(Of String, ImmutableArray(Of DiagnosticAnalyzer)).Empty.Add(LanguageNames.CSharp, ImmutableArray.Create(Of DiagnosticAnalyzer)(analyzer))) - source.AddNewErrors(project.Id, New HashSet(Of DiagnosticData)(SpecializedCollections.SingletonEnumerable(diagnostic)), map) + workspace.TryApplyChanges(workspace.CurrentSolution.WithAnalyzerReferences({analyzerReference})) - AddHandler source.DiagnosticsUpdated, Sub(o, argsCollection) - Dim args = argsCollection.Single() - Dim diagnostics = args.Diagnostics - Assert.Equal(1, diagnostics.Length) - End Sub + Dim threadingContext = workspace.ExportProvider.GetExport(Of IThreadingContext).Value - source.OnSolutionBuildCompleted() + Dim service = New TestDiagnosticAnalyzerService(workspace.GlobalOptions) + Dim vsWorkspace = workspace.ExportProvider.GetExportedValue(Of MockVisualStudioWorkspace)() + vsWorkspace.SetWorkspace(workspace) + Using source = workspace.ExportProvider.GetExportedValue(Of ExternalErrorDiagnosticUpdateSource)() - Await waiter.ExpeditedWaitAsync() + Dim project = workspace.CurrentSolution.Projects.First() - Dim buildOnlyDiagnosticService = workspace.Services.GetRequiredService(Of IBuildOnlyDiagnosticsService) - Assert.Empty(buildOnlyDiagnosticService.GetBuildOnlyDiagnostics(project.DocumentIds.First())) - Assert.Empty(buildOnlyDiagnosticService.GetBuildOnlyDiagnostics(project.Id)) + Assert.False(source.IsSupportedDiagnosticId(project.Id, "ID1")) + Assert.False(source.IsSupportedDiagnosticId(project.Id, "CA1002")) End Using End Using - End Function + End Sub - - Public Async Function TestBuildStartEvent() As Task - Using workspace = EditorTestWorkspace.CreateCSharp(String.Empty) - Dim waiter = New AsynchronousOperationListener() + + Public Async Function TestExternalDiagnosticsReported() As Task + Using workspace = EditorTestWorkspace.CreateCSharp(String.Empty, composition:=s_composition) + Dim waiter = workspace.GetService(Of AsynchronousOperationListenerProvider)().GetWaiter(FeatureAttribute.ErrorList) Dim project = workspace.CurrentSolution.Projects.First() Dim diagnostic = GetDiagnosticData(project.Id) Dim service = New TestDiagnosticAnalyzerService(workspace.GlobalOptions) - Using source = New ExternalErrorDiagnosticUpdateSource( - workspace, service, workspace.GetService(Of IGlobalOperationNotificationService), waiter, CancellationToken.None) - - AddHandler source.BuildProgressChanged, Sub(o, progress) - If progress = ExternalErrorDiagnosticUpdateSource.BuildProgress.Done Then - Assert.Equal(2, source.GetBuildErrors().Length) - End If - End Sub + Dim threadingContext = workspace.ExportProvider.GetExportedValue(Of IThreadingContext) + Dim testServiceBroker = workspace.ExportProvider.GetExportedValue(Of TestServiceBroker) + Dim vsWorkspace = workspace.ExportProvider.GetExportedValue(Of MockVisualStudioWorkspace)() + vsWorkspace.SetWorkspace(workspace) + Using source = workspace.ExportProvider.GetExportedValue(Of ExternalErrorDiagnosticUpdateSource)() - Dim map = New Dictionary(Of DocumentId, HashSet(Of DiagnosticData))() - map.Add(project.DocumentIds.First(), New HashSet(Of DiagnosticData)( - SpecializedCollections.SingletonEnumerable(GetDiagnosticData(project.Id)))) - - source.AddNewErrors(project.Id, New HashSet(Of DiagnosticData)(SpecializedCollections.SingletonEnumerable(diagnostic)), map) + source.OnSolutionBuildStarted() Await waiter.ExpeditedWaitAsync() + Assert.True(testServiceBroker.DiagnosticManagerService.AllDiagnosticsCleared) + + Dim diagnostics = {diagnostic, GetDiagnosticData(project.Id)}.ToImmutableArray() + source.AddNewErrors(project.Id, s_projectGuid, diagnostics) source.OnSolutionBuildCompleted() Await waiter.ExpeditedWaitAsync() + + Assert.Equal(2, testServiceBroker.DiagnosticManagerService.AllDiagnostics.Count) End Using End Using End Function - - Public Sub TestExternalBuildErrorCustomTags() - Assert.Equal(1, ProjectExternalErrorReporter.CustomTags.Count) - Assert.Equal(WellKnownDiagnosticTags.Telemetry, ProjectExternalErrorReporter.CustomTags(0)) - End Sub - - - Public Sub TestExternalBuildErrorProperties() + + Public Async Function TestOnlySupportsBuildErrors() As Task Assert.Equal(1, DiagnosticData.PropertiesForBuildDiagnostic.Count) Dim value As String = Nothing Assert.True(DiagnosticData.PropertiesForBuildDiagnostic.TryGetValue(WellKnownDiagnosticPropertyNames.Origin, value)) Assert.Equal(WellKnownDiagnosticTags.Build, value) - Using workspace = EditorTestWorkspace.CreateCSharp(String.Empty) + Using workspace = EditorTestWorkspace.CreateCSharp(String.Empty, composition:=s_composition) + Dim waiter = workspace.GetService(Of AsynchronousOperationListenerProvider)().GetWaiter(FeatureAttribute.ErrorList) + Dim project = workspace.CurrentSolution.Projects.First() + Dim service = New TestDiagnosticAnalyzerService(workspace.GlobalOptions) - Dim waiter = New AsynchronousOperationListener() - Using source = New ExternalErrorDiagnosticUpdateSource( - workspace, service, workspace.GetService(Of IGlobalOperationNotificationService), waiter, CancellationToken.None) + Dim threadingContext = workspace.ExportProvider.GetExportedValue(Of IThreadingContext) + Dim testServiceBroker = workspace.ExportProvider.GetExportedValue(Of TestServiceBroker) + Dim vsWorkspace = workspace.ExportProvider.GetExportedValue(Of MockVisualStudioWorkspace)() + vsWorkspace.SetWorkspace(workspace) + Using source = workspace.ExportProvider.GetExportedValue(Of ExternalErrorDiagnosticUpdateSource)() - Dim diagnostic = New DiagnosticData( - "id", - category:="Test", - message:="Test Message", - severity:=DiagnosticSeverity.Error, - defaultSeverity:=DiagnosticSeverity.Error, - isEnabledByDefault:=True, - warningLevel:=0, - projectId:=project.Id, - location:=New DiagnosticDataLocation(New FileLinePositionSpan("", Nothing)), - customTags:=ImmutableArray(Of String).Empty, - properties:=DiagnosticData.PropertiesForBuildDiagnostic, - language:=LanguageNames.VisualBasic) - Assert.True(diagnostic.IsBuildDiagnostic()) - source.AddNewErrors(project.Id, diagnostic) + source.OnSolutionBuildStarted() + Await waiter.ExpeditedWaitAsync() + Assert.True(testServiceBroker.DiagnosticManagerService.AllDiagnosticsCleared) - diagnostic = New DiagnosticData( + Dim diagnostic = New DiagnosticData( "id", category:="Test", message:="Test Message", - severity:=DiagnosticSeverity.Error, - defaultSeverity:=DiagnosticSeverity.Error, + severity:=Microsoft.CodeAnalysis.DiagnosticSeverity.Error, + defaultSeverity:=Microsoft.CodeAnalysis.DiagnosticSeverity.Error, isEnabledByDefault:=True, warningLevel:=0, projectId:=project.Id, - location:=New DiagnosticDataLocation(New FileLinePositionSpan("", Nothing)), + location:=New DiagnosticDataLocation(New FileLinePositionSpan("C:\DocumentDiagnostic", Nothing)), customTags:=ImmutableArray(Of String).Empty, properties:=ImmutableDictionary(Of String, String).Empty, language:=LanguageNames.VisualBasic) Assert.False(diagnostic.IsBuildDiagnostic()) #If DEBUG Then - Assert.Throws(Of InvalidOperationException)(Sub() source.AddNewErrors(project.Id, diagnostic)) + Assert.Throws(Of InvalidOperationException)(Sub() source.AddNewErrors(project.Id, s_projectGuid, {diagnostic}.ToImmutableArray())) #End If End Using End Using - End Sub + End Function - + Public Async Function TestExternalDiagnostics_AddDuplicatedErrors() As Task - Using workspace = EditorTestWorkspace.CreateCSharp(String.Empty) + Using workspace = EditorTestWorkspace.CreateCSharp(String.Empty, composition:=s_composition) Dim globalOptions = workspace.GetService(Of IGlobalOptionService) - Dim waiter = New AsynchronousOperationListener() + Dim waiter = workspace.GetService(Of AsynchronousOperationListenerProvider)().GetWaiter(FeatureAttribute.ErrorList) Dim project = workspace.CurrentSolution.Projects.First() Dim diagnostic = GetDiagnosticData(project.Id) Dim service = New TestDiagnosticAnalyzerService(globalOptions) - Using source = New ExternalErrorDiagnosticUpdateSource( - workspace, service, workspace.GetService(Of IGlobalOperationNotificationService), waiter, CancellationToken.None) - - ' we shouldn't crash here - source.AddNewErrors(project.Id, diagnostic) - source.AddNewErrors(project.Id, diagnostic) - - AddHandler source.DiagnosticsUpdated, Sub(o, argsCollection) - Dim args = argsCollection.Single() - Dim diagnostics = args.Diagnostics - Assert.Equal(1, diagnostics.Length) - End Sub - - source.OnSolutionBuildCompleted() - - Await waiter.ExpeditedWaitAsync() - End Using - End Using - End Function - - - - Public Async Function TestExternalDiagnostics_CompilationEndAnalyzer(hasCompilationEndTag As Boolean) As Task - Using workspace = TestWorkspace.CreateCSharp(String.Empty, composition:=s_compositionWithMockDiagnosticUpdateSourceRegistrationService) - Dim globalOptions = workspace.GetService(Of IGlobalOptionService) - Dim analyzer = New CompilationEndAnalyzer(hasCompilationEndTag) - Dim compiler = DiagnosticExtensions.GetCompilerDiagnosticAnalyzer(LanguageNames.CSharp) - - Dim analyzerReference = New AnalyzerImageReference(New DiagnosticAnalyzer() {compiler, analyzer}.ToImmutableArray()) - workspace.TryApplyChanges(workspace.CurrentSolution.WithAnalyzerReferences({analyzerReference})) - - Dim waiter = New AsynchronousOperationListener() - - Dim project = workspace.CurrentSolution.Projects.First() - - Dim service = Assert.IsType(Of DiagnosticAnalyzerService)(workspace.GetService(Of IDiagnosticAnalyzerService)()) - Dim registration = service.CreateIncrementalAnalyzer(workspace) - - Using source = New ExternalErrorDiagnosticUpdateSource( - workspace, service, workspace.GetService(Of IGlobalOperationNotificationService), waiter, CancellationToken.None) - - Dim diagnostic = GetDiagnosticData(project.Id, id:=analyzer.SupportedDiagnostics(0).Id) - source.AddNewErrors(project.Id, diagnostic) - - Dim buildDiagnosticCallbackSeen = False - AddHandler source.DiagnosticsUpdated, Sub(o, argsCollection) - Dim args = argsCollection.Single() - buildDiagnosticCallbackSeen = True - - Dim diagnostics = args.Diagnostics - Assert.Equal(1, diagnostics.Length) - Assert.Equal(diagnostics(0).Properties(WellKnownDiagnosticPropertyNames.Origin), WellKnownDiagnosticTags.Build) - End Sub - - source.OnSolutionBuildCompleted() - - Await waiter.ExpeditedWaitAsync() - - Assert.Equal(hasCompilationEndTag, buildDiagnosticCallbackSeen) - - Dim buildOnlyDiagnosticService = workspace.Services.GetRequiredService(Of IBuildOnlyDiagnosticsService) - Dim buildOnlyDiagnostics = buildOnlyDiagnosticService.GetBuildOnlyDiagnostics(project.Id) - If (hasCompilationEndTag) Then - Assert.Equal(1, buildOnlyDiagnostics.Length) - Assert.Equal(buildOnlyDiagnostics(0).Properties(WellKnownDiagnosticPropertyNames.Origin), WellKnownDiagnosticTags.Build) - Else - Assert.Empty(buildOnlyDiagnostics) - End If - - End Using - End Using - End Function - - - Public Async Function TestExternalDiagnostics_CompilationAnalyzer() As Task - Using workspace = TestWorkspace.CreateCSharp(String.Empty, composition:=s_compositionWithMockDiagnosticUpdateSourceRegistrationService) - Dim globalOptions = workspace.GetService(Of IGlobalOptionService) - Dim analyzer = New CompilationAnalyzer() - Dim compiler = DiagnosticExtensions.GetCompilerDiagnosticAnalyzer(LanguageNames.CSharp) - - Dim analyzerReference = New AnalyzerImageReference(New DiagnosticAnalyzer() {compiler, analyzer}.ToImmutableArray()) - workspace.TryApplyChanges(workspace.CurrentSolution.WithAnalyzerReferences({analyzerReference})) - - Dim waiter = New AsynchronousOperationListener() - - Dim project = workspace.CurrentSolution.Projects.First() - - Dim service = Assert.IsType(Of DiagnosticAnalyzerService)(workspace.GetService(Of IDiagnosticAnalyzerService)()) - Dim registration = service.CreateIncrementalAnalyzer(workspace) - - Using source = New ExternalErrorDiagnosticUpdateSource( - workspace, service, workspace.GetService(Of IGlobalOperationNotificationService), waiter, CancellationToken.None) - - Dim diagnostic = GetDiagnosticData(project.Id, id:=analyzer.SupportedDiagnostics(0).Id) - source.AddNewErrors(project.Id, diagnostic) - - AddHandler source.DiagnosticsUpdated, Sub(o, argsCollection) - Dim args = argsCollection.Single() - Dim diagnostics = args.Diagnostics - - Assert.Equal(1, diagnostics.Length) - Assert.Equal(diagnostics(0).Properties(WellKnownDiagnosticPropertyNames.Origin), WellKnownDiagnosticTags.Build) - End Sub - - source.OnSolutionBuildCompleted() + Dim threadingContext = workspace.ExportProvider.GetExportedValue(Of IThreadingContext) + Dim testServiceBroker = workspace.ExportProvider.GetExportedValue(Of TestServiceBroker) + Dim vsWorkspace = workspace.ExportProvider.GetExportedValue(Of MockVisualStudioWorkspace)() + vsWorkspace.SetWorkspace(workspace) + Using source = workspace.ExportProvider.GetExportedValue(Of ExternalErrorDiagnosticUpdateSource)() + source.OnSolutionBuildStarted() Await waiter.ExpeditedWaitAsync() - End Using - End Using - End Function - - - Public Async Function TestExternalDiagnostics_CompilationAnalyzerWithFSAOn() As Task - Using workspace = TestWorkspace.CreateCSharp(String.Empty, composition:=s_compositionWithMockDiagnosticUpdateSourceRegistrationService) - ' turn on FSA - workspace.GlobalOptions.SetGlobalOption(SolutionCrawlerOptionsStorage.BackgroundAnalysisScopeOption, LanguageNames.CSharp, BackgroundAnalysisScope.FullSolution) - - Dim analyzer = New CompilationAnalyzer() - Dim compiler = DiagnosticExtensions.GetCompilerDiagnosticAnalyzer(LanguageNames.CSharp) - - Dim analyzerReference = New AnalyzerImageReference(New DiagnosticAnalyzer() {compiler, analyzer}.ToImmutableArray()) - workspace.TryApplyChanges(workspace.CurrentSolution.WithAnalyzerReferences({analyzerReference})) - - Dim waiter = New AsynchronousOperationListener() - Dim project = workspace.CurrentSolution.Projects.First() - - Dim service = Assert.IsType(Of DiagnosticAnalyzerService)(workspace.GetService(Of IDiagnosticAnalyzerService)()) - Dim registration = service.CreateIncrementalAnalyzer(workspace) - - Using source = New ExternalErrorDiagnosticUpdateSource( - workspace, service, workspace.GetService(Of IGlobalOperationNotificationService), waiter, CancellationToken.None) - - Dim diagnostic = GetDiagnosticData(project.Id, id:=analyzer.SupportedDiagnostics(0).Id) - source.AddNewErrors(project.Id, diagnostic) + Assert.True(testServiceBroker.DiagnosticManagerService.AllDiagnosticsCleared) - Dim called = False - AddHandler source.DiagnosticsUpdated, Sub(o, a) - called = True - End Sub + ' we shouldn't crash here + source.AddNewErrors(project.Id, s_projectGuid, {diagnostic}.ToImmutableArray()) + source.AddNewErrors(project.Id, s_projectGuid, {diagnostic}.ToImmutableArray()) source.OnSolutionBuildCompleted() - - Await waiter.ExpeditedWaitAsync() - - ' error is considered live error, so event shouldn't be raised - Assert.False(called) - End Using - End Using - End Function - - - Public Async Function TestBuildProgressUpdated() As Task - Using workspace = EditorTestWorkspace.CreateCSharp(String.Empty) - Dim waiter = New AsynchronousOperationListener() - - workspace.AddTestProject(New EditorTestHostProject(workspace, language:=LanguageNames.CSharp)) - - Dim projectId1 = workspace.CurrentSolution.ProjectIds(0) - Dim projectId2 = workspace.CurrentSolution.ProjectIds(1) - - Dim service = New TestDiagnosticAnalyzerService(workspace.GlobalOptions) - Using source = New ExternalErrorDiagnosticUpdateSource( - workspace, service, workspace.GetService(Of IGlobalOperationNotificationService), waiter, CancellationToken.None) - - source.AddNewErrors(projectId1, GetDiagnosticData(projectId1)) - Await waiter.ExpeditedWaitAsync() - - Dim numberOfUpdateCalls = 0 - AddHandler source.BuildProgressChanged, Sub(o, progress) - If progress = ExternalErrorDiagnosticUpdateSource.BuildProgress.Updated Then - numberOfUpdateCalls += 1 - Assert.Equal(numberOfUpdateCalls, source.GetBuildErrors().Length) - ElseIf progress = ExternalErrorDiagnosticUpdateSource.BuildProgress.Done Then - Assert.Equal(2, source.GetBuildErrors().Length) - End If - End Sub - - source.AddNewErrors(projectId2, GetDiagnosticData(projectId2)) Await waiter.ExpeditedWaitAsync() - source.OnSolutionBuildCompleted() - Await waiter.ExpeditedWaitAsync() + Assert.Equal(2, testServiceBroker.DiagnosticManagerService.AllDiagnostics.Count) End Using End Using End Function - + Public Async Function TestCompilerDiagnosticWithoutDocumentId() As Task - Using workspace = TestWorkspace.CreateCSharp(String.Empty, composition:=s_compositionWithMockDiagnosticUpdateSourceRegistrationService) + Using workspace = EditorTestWorkspace.CreateCSharp(String.Empty, composition:=s_composition) Dim globalOptions = workspace.GetService(Of IGlobalOptionService) Dim analyzer = New CompilationAnalyzer() Dim compiler = DiagnosticExtensions.GetCompilerDiagnosticAnalyzer(LanguageNames.CSharp) @@ -449,153 +235,33 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Dim service = Assert.IsType(Of DiagnosticAnalyzerService)(workspace.GetService(Of IDiagnosticAnalyzerService)()) Dim registration = service.CreateIncrementalAnalyzer(workspace) - Using source = New ExternalErrorDiagnosticUpdateSource( - workspace, service, workspace.GetService(Of IGlobalOperationNotificationService), waiter, CancellationToken.None) + Dim threadingContext = workspace.ExportProvider.GetExportedValue(Of IThreadingContext) + Dim testServiceBroker = workspace.ExportProvider.GetExportedValue(Of TestServiceBroker) + Dim vsWorkspace = workspace.ExportProvider.GetExportedValue(Of MockVisualStudioWorkspace)() + vsWorkspace.SetWorkspace(workspace) + Using source = workspace.ExportProvider.GetExportedValue(Of ExternalErrorDiagnosticUpdateSource)() Dim diagnostic = New DiagnosticData( id:="CS1002", category:="Test", message:="Test Message", - severity:=DiagnosticSeverity.Error, - defaultSeverity:=DiagnosticSeverity.Error, + severity:=Microsoft.CodeAnalysis.DiagnosticSeverity.Error, + defaultSeverity:=Microsoft.CodeAnalysis.DiagnosticSeverity.Error, isEnabledByDefault:=True, warningLevel:=0, customTags:=ImmutableArray(Of String).Empty, properties:=DiagnosticData.PropertiesForBuildDiagnostic, project.Id, - location:=New DiagnosticDataLocation(New FileLinePositionSpan("Test.txt", New LinePosition(4, 4), New LinePosition(4, 4)), documentId:=Nothing), + location:=New DiagnosticDataLocation(New FileLinePositionSpan("C:\ProjectDiagnostic", New LinePosition(4, 4), New LinePosition(4, 4)), documentId:=Nothing), language:=project.Language) - AddHandler service.DiagnosticsUpdated, Sub(o, argsCollection) - Dim args = argsCollection.Single() - Dim diagnostics = args.Diagnostics - - Assert.Single(diagnostics) - Assert.Equal(diagnostics(0).Id, diagnostic.Id) - End Sub - - source.AddNewErrors(project.Id, diagnostic) - Await waiter.ExpeditedWaitAsync() - + source.AddNewErrors(project.Id, s_projectGuid, {diagnostic}.ToImmutableArray()) source.OnSolutionBuildCompleted() Await waiter.ExpeditedWaitAsync() - - Dim diagnosticServiceWaiter = TryCast(listenerProvider.GetListener(FeatureAttribute.DiagnosticService), AsynchronousOperationListener) - Await diagnosticServiceWaiter.ExpeditedWaitAsync() End Using End Using End Function - - Public Async Function TestExternalDiagnostics_BuildOnlyClearedOnDocumentChanged() As Task - Using workspace = TestWorkspace.CreateCSharp("class C { }", composition:=s_compositionWithMockDiagnosticUpdateSourceRegistrationService) - Dim globalOptions = workspace.GetService(Of IGlobalOptionService) - Dim analyzer = New CompilationEndAnalyzer(hasCompilationEndTag:=True) - Dim compiler = DiagnosticExtensions.GetCompilerDiagnosticAnalyzer(LanguageNames.CSharp) - - Dim analyzerReference = New AnalyzerImageReference(New DiagnosticAnalyzer() {compiler, analyzer}.ToImmutableArray()) - workspace.TryApplyChanges(workspace.CurrentSolution.WithAnalyzerReferences({analyzerReference})) - - Dim listenerProvider = workspace.ExportProvider.GetExportedValue(Of IAsynchronousOperationListenerProvider)() - Dim waiter = TryCast(listenerProvider.GetListener(FeatureAttribute.ErrorList), AsynchronousOperationListener) - - Dim project = workspace.CurrentSolution.Projects.First() - Dim document = project.Documents.Single() - - Dim service = Assert.IsType(Of DiagnosticAnalyzerService)(workspace.GetService(Of IDiagnosticAnalyzerService)()) - Dim registration = service.CreateIncrementalAnalyzer(workspace) - Using source = New ExternalErrorDiagnosticUpdateSource( - workspace, service, workspace.GetService(Of IGlobalOperationNotificationService), waiter, CancellationToken.None) - - Dim diagnostic = New DiagnosticData( - id:=analyzer.Descriptor.Id, - category:=analyzer.Descriptor.Category, - message:=analyzer.Descriptor.MessageFormat.ToString(), - severity:=analyzer.Descriptor.DefaultSeverity, - defaultSeverity:=analyzer.Descriptor.DefaultSeverity, - isEnabledByDefault:=analyzer.Descriptor.IsEnabledByDefault, - warningLevel:=0, - customTags:=analyzer.Descriptor.CustomTags.AsImmutable(), - properties:=DiagnosticData.PropertiesForBuildDiagnostic, - project.Id, - location:=New DiagnosticDataLocation( - New FileLinePositionSpan(document.FilePath, New LinePositionSpan()), document.Id), - language:=project.Language) - - Dim actualDiagnostic As DiagnosticData = Nothing - Dim diagnosticAdded = False - Dim diagnosticRemoved = False - AddHandler source.DiagnosticsUpdated, Sub(o, argsCollection) - Dim args = argsCollection.Single() - Assert.Equal(document.Id, args.DocumentId) - Dim diagnostics = args.Diagnostics - If args.Kind = DiagnosticsUpdatedKind.DiagnosticsCreated Then - actualDiagnostic = Assert.Single(diagnostics) - diagnosticAdded = True - Else - Assert.Equal(DiagnosticsUpdatedKind.DiagnosticsRemoved, args.Kind) - Assert.Empty(diagnostics) - actualDiagnostic = Nothing - diagnosticRemoved = True - End If - End Sub - - source.AddNewErrors(document.Id, diagnostic) - Await waiter.ExpeditedWaitAsync() - - source.OnSolutionBuildCompleted() - Await waiter.ExpeditedWaitAsync() - - Dim diagnosticServiceWaiter = TryCast(listenerProvider.GetListener(FeatureAttribute.DiagnosticService), AsynchronousOperationListener) - Await diagnosticServiceWaiter.ExpeditedWaitAsync() - - Assert.True(diagnosticAdded) - Assert.NotNull(actualDiagnostic) - Assert.Equal(actualDiagnostic, diagnostic) - - Dim buildOnlyDiagnosticService = workspace.Services.GetRequiredService(Of IBuildOnlyDiagnosticsService) - Dim buildOnlyDiagnostic = Assert.Single(buildOnlyDiagnosticService.GetBuildOnlyDiagnostics(document.Id)) - Assert.Equal(buildOnlyDiagnostic, diagnostic) - - ' Verify build-only diagnostics cleared after document changed event - document = document.WithText(SourceText.From("class C2 { }")) - source.GetTestAccessor().OnWorkspaceChanged(workspace, New WorkspaceChangeEventArgs(WorkspaceChangeKind.DocumentChanged, - oldSolution:=workspace.CurrentSolution, newSolution:=document.Project.Solution, project.Id, document.Id)) - Await waiter.ExpeditedWaitAsync() - - Assert.True(diagnosticRemoved) - Assert.Null(actualDiagnostic) - Assert.Empty(buildOnlyDiagnosticService.GetBuildOnlyDiagnostics(document.Id)) - End Using - End Using - End Function - - Private Class CompilationEndAnalyzer - Inherits DiagnosticAnalyzer - - Public ReadOnly Descriptor As DiagnosticDescriptor - - Public Sub New(hasCompilationEndTag As Boolean) - Dim additionalCustomTags = If(hasCompilationEndTag, {WellKnownDiagnosticTags.CompilationEnd}, Array.Empty(Of String)) - Descriptor = DescriptorFactory.CreateSimpleDescriptor("CompilationEndAnalyzer", additionalCustomTags) - End Sub - Public Overrides ReadOnly Property SupportedDiagnostics As ImmutableArray(Of DiagnosticDescriptor) - Get - Return ImmutableArray.Create(Descriptor) - End Get - End Property - - Public Overrides Sub Initialize(context As AnalysisContext) - context.RegisterCompilationStartAction( - Sub(startContext) - startContext.RegisterCompilationEndAction( - Sub(endContext) - ' do nothing - End Sub) - End Sub) - End Sub - End Class - Private Class CompilationAnalyzer Inherits DiagnosticAnalyzer @@ -618,12 +284,12 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics id, category:="Test", message:="Test Message", - severity:=DiagnosticSeverity.Error, - defaultSeverity:=DiagnosticSeverity.Error, + severity:=Microsoft.CodeAnalysis.DiagnosticSeverity.Error, + defaultSeverity:=Microsoft.CodeAnalysis.DiagnosticSeverity.Error, isEnabledByDefault:=True, warningLevel:=0, projectId:=projectId, - location:=New DiagnosticDataLocation(New FileLinePositionSpan("", Nothing)), + location:=New DiagnosticDataLocation(New FileLinePositionSpan("C:\DocumentDiagnostic", Nothing)), customTags:=ImmutableArray(Of String).Empty, properties:=DiagnosticData.PropertiesForBuildDiagnostic, language:=LanguageNames.VisualBasic) @@ -678,5 +344,78 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics Return Task.FromResult((ImmutableArray(Of DiagnosticData).Empty, False)) End Function End Class + + + + + Private Class TestServiceBroker + Implements IServiceBroker + + Friend DiagnosticManagerService As DiagnosticManagerService = New DiagnosticManagerService() + + + + Public Sub New() + End Sub + + Public Event AvailabilityChanged As EventHandler(Of BrokeredServicesChangedEventArgs) Implements IServiceBroker.AvailabilityChanged + + Public Function GetProxyAsync(Of T As Class)(serviceDescriptor As ServiceRpcDescriptor, Optional options As ServiceActivationOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of T) Implements IServiceBroker.GetProxyAsync + If (GetType(T) Is GetType(IDiagnosticManagerService)) Then + Return New ValueTask(Of T)(Task.FromResult(CType(CType(DiagnosticManagerService, Object), T))) + End If + + Throw New InvalidOperationException() + End Function + + Public Function GetPipeAsync(serviceMoniker As ServiceMoniker, Optional options As ServiceActivationOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of IDuplexPipe) Implements IServiceBroker.GetPipeAsync + Throw New NotImplementedException() + End Function + End Class + + Private Class DiagnosticManagerService + Implements IDiagnosticManagerService + + Friend DiagnosticsCleared As Boolean = False + Friend AllDiagnosticsCleared As Boolean = False + Friend AllDiagnostics As List(Of RpcContracts.DiagnosticManagement.Diagnostic) = New List(Of RpcContracts.DiagnosticManagement.Diagnostic)() + + Public Sub Dispose() Implements IDisposable.Dispose + End Sub + + Public Function SetDiagnosticsAsync(generatorId As String, diagnostics As IReadOnlyList(Of DiagnosticCollection), cancellationToken As CancellationToken) As Task Implements IDiagnosticManagerService.SetDiagnosticsAsync + Throw New NotImplementedException() + End Function + + Public Function AppendDiagnosticsAsync(generatorId As String, diagnostics As IReadOnlyList(Of DiagnosticCollection), cancellationToken As CancellationToken) As Task Implements IDiagnosticManagerService.AppendDiagnosticsAsync + For Each collection In diagnostics + For Each diagnostic In collection.Diagnostics + AllDiagnostics.Add(diagnostic) + Next + Next + Return Task.CompletedTask + End Function + + Public Function ClearDiagnosticsAsync(generatorId As String, cancellationToken As CancellationToken) As Task Implements IDiagnosticManagerService.ClearDiagnosticsAsync + If (DiagnosticsCleared) Then + Throw New InvalidOperationException() + End If + DiagnosticsCleared = True + Return Task.CompletedTask + End Function + + Public Function ClearAllDiagnosticsAsync(cancellationToken As CancellationToken) As Task Implements IDiagnosticManagerService.ClearAllDiagnosticsAsync + If (AllDiagnosticsCleared) Then + Throw New InvalidOperationException() + End If + AllDiagnosticsCleared = True + Return Task.CompletedTask + End Function + + Public Function AddBuildOnlyDiagnosticCodesAsync(diagnosticCodes As IReadOnlyList(Of String), cancellationToken As CancellationToken) As Task Implements IDiagnosticManagerService.AddBuildOnlyDiagnosticCodesAsync + Throw New NotImplementedException() + End Function + End Class + End Class End Namespace From b6d09b18107bdf001c8fd4a94d4db21c0c840f67 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 15 May 2024 12:42:31 +0000 Subject: [PATCH 23/38] Update dependencies from https://github.com/dotnet/arcade build 20240425.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24225.1 From 343a47d8456ac851cdb61f233c021686b2504af4 Mon Sep 17 00:00:00 2001 From: David Barbet Date: Wed, 15 May 2024 11:00:45 -0700 Subject: [PATCH 24/38] Review feedback --- ...harpProjectExternalErrorReporterFactory.cs | 25 ------------------- .../VisualStudioSuppressionFixService.cs | 6 ++--- .../ExternalErrorDiagnosticUpdateSource.cs | 13 +++++++++- .../TaskList/ProjectExternalErrorReporter.cs | 2 +- 4 files changed, 16 insertions(+), 30 deletions(-) delete mode 100644 src/Tools/ExternalAccess/FSharp/Internal/VisualStudio/FSharpProjectExternalErrorReporterFactory.cs diff --git a/src/Tools/ExternalAccess/FSharp/Internal/VisualStudio/FSharpProjectExternalErrorReporterFactory.cs b/src/Tools/ExternalAccess/FSharp/Internal/VisualStudio/FSharpProjectExternalErrorReporterFactory.cs deleted file mode 100644 index cdbc55c0cbee7..0000000000000 --- a/src/Tools/ExternalAccess/FSharp/Internal/VisualStudio/FSharpProjectExternalErrorReporterFactory.cs +++ /dev/null @@ -1,25 +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 Microsoft.VisualStudio.Shell.Interop; -using Microsoft.VisualStudio.LanguageServices; -using Microsoft.VisualStudio.LanguageServices.Implementation.TaskList; -using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem; -using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.Extensions; -using Microsoft.VisualStudio.Shell; - -namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Internal.VisualStudio -{ - internal static class FSharpProjectExternalErrorReporterFactory - { - public static IVsLanguageServiceBuildErrorReporter2 Create(ProjectId projectId, string errorCodePrefix, IServiceProvider serviceProvider) - { - var workspace = (VisualStudioWorkspaceImpl)serviceProvider.GetMefService(); - return new ProjectExternalErrorReporter(projectId, projectId.Id, errorCodePrefix, LanguageNames.FSharp, workspace); - } - } -} diff --git a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs index 540cc7ec671a3..1b6544298f885 100644 --- a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs +++ b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs @@ -106,7 +106,7 @@ public bool AddSuppressions(IVsHierarchy? projectHierarchy) // Apply suppressions fix in global suppressions file for non-compiler diagnostics and // in source only for compiler diagnostics. - var diagnosticsToFix = GetDiagnosticsToFix(shouldFixInProject, selectedEntriesOnly: false, isAddSuppression: true); + var diagnosticsToFix = GetDiagnosticsToFix(selectedEntriesOnly: false, isAddSuppression: true); if (!ApplySuppressionFix(diagnosticsToFix, shouldFixInProject, filterStaleDiagnostics: false, isAddSuppression: true, isSuppressionInSource: false, onlyCompilerDiagnostics: false, showPreviewChangesDialog: false)) { return false; @@ -158,7 +158,7 @@ private static string GetFixTitle(bool isAddSuppression) private static string GetWaitDialogMessage(bool isAddSuppression) => isAddSuppression ? ServicesVSResources.Computing_suppressions_fix : ServicesVSResources.Computing_remove_suppressions_fix; - private IEnumerable? GetDiagnosticsToFix(Func shouldFixInProject, bool selectedEntriesOnly, bool isAddSuppression) + private IEnumerable? GetDiagnosticsToFix(bool selectedEntriesOnly, bool isAddSuppression) { var diagnosticsToFix = ImmutableHashSet.Empty; void computeDiagnosticsToFix(IUIThreadOperationContext context) @@ -189,7 +189,7 @@ void computeDiagnosticsToFix(IUIThreadOperationContext context) private bool ApplySuppressionFix(Func shouldFixInProject, bool selectedEntriesOnly, bool isAddSuppression, bool isSuppressionInSource, bool onlyCompilerDiagnostics, bool showPreviewChangesDialog) { - var diagnosticsToFix = GetDiagnosticsToFix(shouldFixInProject, selectedEntriesOnly, isAddSuppression); + var diagnosticsToFix = GetDiagnosticsToFix(selectedEntriesOnly, isAddSuppression); return ApplySuppressionFix(diagnosticsToFix, shouldFixInProject, selectedEntriesOnly, isAddSuppression, isSuppressionInSource, onlyCompilerDiagnostics, showPreviewChangesDialog); } diff --git a/src/VisualStudio/Core/Def/TaskList/ExternalErrorDiagnosticUpdateSource.cs b/src/VisualStudio/Core/Def/TaskList/ExternalErrorDiagnosticUpdateSource.cs index 235fbb43411e4..ac958352fb298 100644 --- a/src/VisualStudio/Core/Def/TaskList/ExternalErrorDiagnosticUpdateSource.cs +++ b/src/VisualStudio/Core/Def/TaskList/ExternalErrorDiagnosticUpdateSource.cs @@ -98,6 +98,7 @@ public void Dispose() { lock (_gate) { + // Only called when the MEF catalog is disposed on shutdown. _diagnosticManagerService?.Dispose(); } } @@ -119,6 +120,9 @@ public void ClearErrors(ProjectId projectId) }); } + /// + /// Called serially in response to the sln build UI context. + /// internal void OnSolutionBuildStarted() { _ = GetOrCreateInProgressState(); @@ -129,6 +133,9 @@ internal void OnSolutionBuildStarted() }); } + /// + /// Called serially in response to the sln build UI context completing. + /// internal void OnSolutionBuildCompleted() { _ = ClearInProgressState(); @@ -166,6 +173,9 @@ private async ValueTask ProcessDiagnosticsReportAsync(ProjectId projectId, Guid var diagnosticManagerService = await GetOrCreateDiagnosticManagerAsync(cancellationToken).ConfigureAwait(false); using var _ = ArrayBuilder.GetInstance(out var collections); + // The client API asks us to pass in diagnostics grouped by the file they are in. + // Note - linked file diagnostics will be 'duplicated' for each project - the document collection + // will contain a separate diagnostic for each project the file is linked to (with the corresponding project field set). var groupedDiagnostics = diagnostics.GroupBy(d => d.DataLocation.UnmappedFileSpan.Path); foreach (var group in groupedDiagnostics) { @@ -193,6 +203,7 @@ private async ValueTask ProcessDiagnosticsReportAsync(ProjectId projectId, Guid ImmutableArray projects = project is not null ? [project.Value] : []; var range = GetRange(diagnostic); + var description = string.IsNullOrEmpty(diagnostic.Description) ? null : diagnostic.Description; return new Microsoft.VisualStudio.RpcContracts.DiagnosticManagement.Diagnostic( message: diagnostic.Message ?? string.Empty, code: diagnostic.Id, @@ -200,7 +211,7 @@ private async ValueTask ProcessDiagnosticsReportAsync(ProjectId projectId, Guid range: GetRange(diagnostic), tags: RpcContracts.DiagnosticManagement.DiagnosticTags.BuildError, relatedInformation: null, - expandedMessage: diagnostic.Description, + expandedMessage: description, // Intentionally the same as diagnosticType, matches what we used to report. source: diagnostic.Category, helpLink: diagnostic.HelpLink, diff --git a/src/VisualStudio/Core/Def/TaskList/ProjectExternalErrorReporter.cs b/src/VisualStudio/Core/Def/TaskList/ProjectExternalErrorReporter.cs index 817044567db71..1fddb277a2ac2 100644 --- a/src/VisualStudio/Core/Def/TaskList/ProjectExternalErrorReporter.cs +++ b/src/VisualStudio/Core/Def/TaskList/ProjectExternalErrorReporter.cs @@ -112,7 +112,7 @@ public int AddNewErrors(IVsEnumExternalErrors pErrors) AnalyzerInfoCache)); } - DiagnosticProvider.AddNewErrors(_projectId, _projectHierarchyGuid, allDiagnostics.ToImmutable()); + DiagnosticProvider.AddNewErrors(_projectId, _projectHierarchyGuid, allDiagnostics.ToImmutableAndClear()); return VSConstants.S_OK; } From 8989cee232c20715059c89b56f2e64a2843c3056 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 16 May 2024 13:15:11 +0000 Subject: [PATCH 25/38] Update dependencies from https://github.com/dotnet/arcade build 20240514.1 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24264.1 --- eng/Version.Details.xml | 8 +-- .../job/source-index-stage1.yml | 49 +++++++++++++------ .../templates/job/source-index-stage1.yml | 44 ++++++++++++----- global.json | 4 +- 4 files changed, 70 insertions(+), 35 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 363e319d78671..0130b84444f20 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -99,9 +99,9 @@ - + https://github.com/dotnet/arcade - 67d23f4ba1813b315e7e33c71d18b63475f5c5f8 + 1814df258a66473d388b8884ac95bd1c8a2585a9 @@ -127,9 +127,9 @@ https://github.com/dotnet/roslyn 5d10d428050c0d6afef30a072c4ae68776621877 - + https://github.com/dotnet/arcade - 67d23f4ba1813b315e7e33c71d18b63475f5c5f8 + 1814df258a66473d388b8884ac95bd1c8a2585a9 https://github.com/dotnet/roslyn-analyzers diff --git a/eng/common/templates-official/job/source-index-stage1.yml b/eng/common/templates-official/job/source-index-stage1.yml index f0513aee5b0da..43ee0c202fc79 100644 --- a/eng/common/templates-official/job/source-index-stage1.yml +++ b/eng/common/templates-official/job/source-index-stage1.yml @@ -1,6 +1,7 @@ parameters: runAsPublic: false - sourceIndexPackageVersion: 1.0.1-20230228.2 + sourceIndexUploadPackageVersion: 2.0.0-20240502.12 + sourceIndexProcessBinlogPackageVersion: 1.0.1-20240129.2 sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" preSteps: [] @@ -14,15 +15,15 @@ jobs: dependsOn: ${{ parameters.dependsOn }} condition: ${{ parameters.condition }} variables: - - name: SourceIndexPackageVersion - value: ${{ parameters.sourceIndexPackageVersion }} + - name: SourceIndexUploadPackageVersion + value: ${{ parameters.sourceIndexUploadPackageVersion }} + - name: SourceIndexProcessBinlogPackageVersion + value: ${{ parameters.sourceIndexProcessBinlogPackageVersion }} - name: SourceIndexPackageSource value: ${{ parameters.sourceIndexPackageSource }} - name: BinlogPath value: ${{ parameters.binlogPath }} - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - group: source-dot-net stage1 variables - - template: /eng/common/templates-official/variables/pool-providers.yml + - template: /eng/common/templates/variables/pool-providers.yml ${{ if ne(parameters.pool, '') }}: pool: ${{ parameters.pool }} @@ -33,24 +34,23 @@ jobs: demands: ImageOverride -equals windows.vs2019.amd64.open ${{ if eq(variables['System.TeamProject'], 'internal') }}: name: $(DncEngInternalBuildPool) - image: windows.vs2022.amd64 - os: windows + demands: ImageOverride -equals windows.vs2019.amd64 steps: - ${{ each preStep in parameters.preSteps }}: - ${{ preStep }} - task: UseDotNet@2 - displayName: Use .NET Core SDK 6 + displayName: Use .NET 8 SDK inputs: packageType: sdk - version: 6.0.x + version: 8.0.x installationPath: $(Agent.TempDirectory)/dotnet workingDirectory: $(Agent.TempDirectory) - script: | - $(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools - $(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools + $(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version $(sourceIndexProcessBinlogPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools + $(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version $(sourceIndexUploadPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools displayName: Download Tools # Set working directory to temp directory so 'dotnet' doesn't try to use global.json and use the repo's sdk. workingDirectory: $(Agent.TempDirectory) @@ -62,7 +62,24 @@ jobs: displayName: Process Binlog into indexable sln - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - script: $(Agent.TempDirectory)/.source-index/tools/UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) - displayName: Upload stage1 artifacts to source index - env: - BLOB_CONTAINER_URL: $(source-dot-net-stage1-blob-container-url) + - task: AzureCLI@2 + displayName: Get stage 1 auth token + inputs: + azureSubscription: 'SourceDotNet Stage1 Publish' + addSpnToEnvironment: true + scriptType: 'ps' + scriptLocation: 'inlineScript' + inlineScript: | + echo "##vso[task.setvariable variable=ARM_CLIENT_ID]$env:servicePrincipalId" + echo "##vso[task.setvariable variable=ARM_ID_TOKEN]$env:idToken" + echo "##vso[task.setvariable variable=ARM_TENANT_ID]$env:tenantId" + + - script: | + echo "Client ID: $(ARM_CLIENT_ID)" + echo "ID Token: $(ARM_ID_TOKEN)" + echo "Tenant ID: $(ARM_TENANT_ID)" + az login --service-principal -u $(ARM_CLIENT_ID) --tenant $(ARM_TENANT_ID) --allow-no-subscriptions --federated-token $(ARM_ID_TOKEN) + displayName: "Login to Azure" + + - script: $(Agent.TempDirectory)/.source-index/tools/UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) -s netsourceindexstage1 -b stage1 + displayName: Upload stage1 artifacts to source index \ No newline at end of file diff --git a/eng/common/templates/job/source-index-stage1.yml b/eng/common/templates/job/source-index-stage1.yml index b98202aa02d82..43ee0c202fc79 100644 --- a/eng/common/templates/job/source-index-stage1.yml +++ b/eng/common/templates/job/source-index-stage1.yml @@ -1,6 +1,7 @@ parameters: runAsPublic: false - sourceIndexPackageVersion: 1.0.1-20230228.2 + sourceIndexUploadPackageVersion: 2.0.0-20240502.12 + sourceIndexProcessBinlogPackageVersion: 1.0.1-20240129.2 sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" preSteps: [] @@ -14,14 +15,14 @@ jobs: dependsOn: ${{ parameters.dependsOn }} condition: ${{ parameters.condition }} variables: - - name: SourceIndexPackageVersion - value: ${{ parameters.sourceIndexPackageVersion }} + - name: SourceIndexUploadPackageVersion + value: ${{ parameters.sourceIndexUploadPackageVersion }} + - name: SourceIndexProcessBinlogPackageVersion + value: ${{ parameters.sourceIndexProcessBinlogPackageVersion }} - name: SourceIndexPackageSource value: ${{ parameters.sourceIndexPackageSource }} - name: BinlogPath value: ${{ parameters.binlogPath }} - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - group: source-dot-net stage1 variables - template: /eng/common/templates/variables/pool-providers.yml ${{ if ne(parameters.pool, '') }}: @@ -40,16 +41,16 @@ jobs: - ${{ preStep }} - task: UseDotNet@2 - displayName: Use .NET Core SDK 6 + displayName: Use .NET 8 SDK inputs: packageType: sdk - version: 6.0.x + version: 8.0.x installationPath: $(Agent.TempDirectory)/dotnet workingDirectory: $(Agent.TempDirectory) - script: | - $(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools - $(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools + $(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version $(sourceIndexProcessBinlogPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools + $(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version $(sourceIndexUploadPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools displayName: Download Tools # Set working directory to temp directory so 'dotnet' doesn't try to use global.json and use the repo's sdk. workingDirectory: $(Agent.TempDirectory) @@ -61,7 +62,24 @@ jobs: displayName: Process Binlog into indexable sln - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - script: $(Agent.TempDirectory)/.source-index/tools/UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) - displayName: Upload stage1 artifacts to source index - env: - BLOB_CONTAINER_URL: $(source-dot-net-stage1-blob-container-url) + - task: AzureCLI@2 + displayName: Get stage 1 auth token + inputs: + azureSubscription: 'SourceDotNet Stage1 Publish' + addSpnToEnvironment: true + scriptType: 'ps' + scriptLocation: 'inlineScript' + inlineScript: | + echo "##vso[task.setvariable variable=ARM_CLIENT_ID]$env:servicePrincipalId" + echo "##vso[task.setvariable variable=ARM_ID_TOKEN]$env:idToken" + echo "##vso[task.setvariable variable=ARM_TENANT_ID]$env:tenantId" + + - script: | + echo "Client ID: $(ARM_CLIENT_ID)" + echo "ID Token: $(ARM_ID_TOKEN)" + echo "Tenant ID: $(ARM_TENANT_ID)" + az login --service-principal -u $(ARM_CLIENT_ID) --tenant $(ARM_TENANT_ID) --allow-no-subscriptions --federated-token $(ARM_ID_TOKEN) + displayName: "Login to Azure" + + - script: $(Agent.TempDirectory)/.source-index/tools/UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) -s netsourceindexstage1 -b stage1 + displayName: Upload stage1 artifacts to source index \ No newline at end of file diff --git a/global.json b/global.json index d47c11496f0ff..24c57d871f42d 100644 --- a/global.json +++ b/global.json @@ -12,7 +12,7 @@ "xcopy-msbuild": "17.8.1-2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24225.1", - "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24225.1" + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24264.1", + "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24264.1" } } From 41debdd1f58bd8ad72eae2330ec452b2d0ac7ea7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 16 May 2024 13:24:42 +0000 Subject: [PATCH 26/38] Update dependencies from https://github.com/dotnet/arcade build 20240514.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24225.1 -> To Version 8.0.0-beta.24264.1 --- eng/Version.Details.xml | 12 ++--- .../job/source-index-stage1.yml | 49 +++++++++++++------ .../templates/job/source-index-stage1.yml | 44 ++++++++++++----- global.json | 4 +- 4 files changed, 72 insertions(+), 37 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e6bf41930e55d..4bdcddc742c66 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -114,14 +114,14 @@ - + https://github.com/dotnet/arcade - 67d23f4ba1813b315e7e33c71d18b63475f5c5f8 + 1814df258a66473d388b8884ac95bd1c8a2585a9 - + https://github.com/dotnet/arcade - 67d23f4ba1813b315e7e33c71d18b63475f5c5f8 + 1814df258a66473d388b8884ac95bd1c8a2585a9 @@ -148,9 +148,9 @@ https://github.com/dotnet/roslyn 5d10d428050c0d6afef30a072c4ae68776621877 - + https://github.com/dotnet/arcade - 67d23f4ba1813b315e7e33c71d18b63475f5c5f8 + 1814df258a66473d388b8884ac95bd1c8a2585a9 https://github.com/dotnet/roslyn-analyzers diff --git a/eng/common/templates-official/job/source-index-stage1.yml b/eng/common/templates-official/job/source-index-stage1.yml index f0513aee5b0da..43ee0c202fc79 100644 --- a/eng/common/templates-official/job/source-index-stage1.yml +++ b/eng/common/templates-official/job/source-index-stage1.yml @@ -1,6 +1,7 @@ parameters: runAsPublic: false - sourceIndexPackageVersion: 1.0.1-20230228.2 + sourceIndexUploadPackageVersion: 2.0.0-20240502.12 + sourceIndexProcessBinlogPackageVersion: 1.0.1-20240129.2 sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" preSteps: [] @@ -14,15 +15,15 @@ jobs: dependsOn: ${{ parameters.dependsOn }} condition: ${{ parameters.condition }} variables: - - name: SourceIndexPackageVersion - value: ${{ parameters.sourceIndexPackageVersion }} + - name: SourceIndexUploadPackageVersion + value: ${{ parameters.sourceIndexUploadPackageVersion }} + - name: SourceIndexProcessBinlogPackageVersion + value: ${{ parameters.sourceIndexProcessBinlogPackageVersion }} - name: SourceIndexPackageSource value: ${{ parameters.sourceIndexPackageSource }} - name: BinlogPath value: ${{ parameters.binlogPath }} - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - group: source-dot-net stage1 variables - - template: /eng/common/templates-official/variables/pool-providers.yml + - template: /eng/common/templates/variables/pool-providers.yml ${{ if ne(parameters.pool, '') }}: pool: ${{ parameters.pool }} @@ -33,24 +34,23 @@ jobs: demands: ImageOverride -equals windows.vs2019.amd64.open ${{ if eq(variables['System.TeamProject'], 'internal') }}: name: $(DncEngInternalBuildPool) - image: windows.vs2022.amd64 - os: windows + demands: ImageOverride -equals windows.vs2019.amd64 steps: - ${{ each preStep in parameters.preSteps }}: - ${{ preStep }} - task: UseDotNet@2 - displayName: Use .NET Core SDK 6 + displayName: Use .NET 8 SDK inputs: packageType: sdk - version: 6.0.x + version: 8.0.x installationPath: $(Agent.TempDirectory)/dotnet workingDirectory: $(Agent.TempDirectory) - script: | - $(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools - $(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools + $(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version $(sourceIndexProcessBinlogPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools + $(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version $(sourceIndexUploadPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools displayName: Download Tools # Set working directory to temp directory so 'dotnet' doesn't try to use global.json and use the repo's sdk. workingDirectory: $(Agent.TempDirectory) @@ -62,7 +62,24 @@ jobs: displayName: Process Binlog into indexable sln - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - script: $(Agent.TempDirectory)/.source-index/tools/UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) - displayName: Upload stage1 artifacts to source index - env: - BLOB_CONTAINER_URL: $(source-dot-net-stage1-blob-container-url) + - task: AzureCLI@2 + displayName: Get stage 1 auth token + inputs: + azureSubscription: 'SourceDotNet Stage1 Publish' + addSpnToEnvironment: true + scriptType: 'ps' + scriptLocation: 'inlineScript' + inlineScript: | + echo "##vso[task.setvariable variable=ARM_CLIENT_ID]$env:servicePrincipalId" + echo "##vso[task.setvariable variable=ARM_ID_TOKEN]$env:idToken" + echo "##vso[task.setvariable variable=ARM_TENANT_ID]$env:tenantId" + + - script: | + echo "Client ID: $(ARM_CLIENT_ID)" + echo "ID Token: $(ARM_ID_TOKEN)" + echo "Tenant ID: $(ARM_TENANT_ID)" + az login --service-principal -u $(ARM_CLIENT_ID) --tenant $(ARM_TENANT_ID) --allow-no-subscriptions --federated-token $(ARM_ID_TOKEN) + displayName: "Login to Azure" + + - script: $(Agent.TempDirectory)/.source-index/tools/UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) -s netsourceindexstage1 -b stage1 + displayName: Upload stage1 artifacts to source index \ No newline at end of file diff --git a/eng/common/templates/job/source-index-stage1.yml b/eng/common/templates/job/source-index-stage1.yml index b98202aa02d82..43ee0c202fc79 100644 --- a/eng/common/templates/job/source-index-stage1.yml +++ b/eng/common/templates/job/source-index-stage1.yml @@ -1,6 +1,7 @@ parameters: runAsPublic: false - sourceIndexPackageVersion: 1.0.1-20230228.2 + sourceIndexUploadPackageVersion: 2.0.0-20240502.12 + sourceIndexProcessBinlogPackageVersion: 1.0.1-20240129.2 sourceIndexPackageSource: https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json sourceIndexBuildCommand: powershell -NoLogo -NoProfile -ExecutionPolicy Bypass -Command "eng/common/build.ps1 -restore -build -binarylog -ci" preSteps: [] @@ -14,14 +15,14 @@ jobs: dependsOn: ${{ parameters.dependsOn }} condition: ${{ parameters.condition }} variables: - - name: SourceIndexPackageVersion - value: ${{ parameters.sourceIndexPackageVersion }} + - name: SourceIndexUploadPackageVersion + value: ${{ parameters.sourceIndexUploadPackageVersion }} + - name: SourceIndexProcessBinlogPackageVersion + value: ${{ parameters.sourceIndexProcessBinlogPackageVersion }} - name: SourceIndexPackageSource value: ${{ parameters.sourceIndexPackageSource }} - name: BinlogPath value: ${{ parameters.binlogPath }} - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - group: source-dot-net stage1 variables - template: /eng/common/templates/variables/pool-providers.yml ${{ if ne(parameters.pool, '') }}: @@ -40,16 +41,16 @@ jobs: - ${{ preStep }} - task: UseDotNet@2 - displayName: Use .NET Core SDK 6 + displayName: Use .NET 8 SDK inputs: packageType: sdk - version: 6.0.x + version: 8.0.x installationPath: $(Agent.TempDirectory)/dotnet workingDirectory: $(Agent.TempDirectory) - script: | - $(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools - $(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version $(SourceIndexPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools + $(Agent.TempDirectory)/dotnet/dotnet tool install BinLogToSln --version $(sourceIndexProcessBinlogPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools + $(Agent.TempDirectory)/dotnet/dotnet tool install UploadIndexStage1 --version $(sourceIndexUploadPackageVersion) --add-source $(SourceIndexPackageSource) --tool-path $(Agent.TempDirectory)/.source-index/tools displayName: Download Tools # Set working directory to temp directory so 'dotnet' doesn't try to use global.json and use the repo's sdk. workingDirectory: $(Agent.TempDirectory) @@ -61,7 +62,24 @@ jobs: displayName: Process Binlog into indexable sln - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: - - script: $(Agent.TempDirectory)/.source-index/tools/UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) - displayName: Upload stage1 artifacts to source index - env: - BLOB_CONTAINER_URL: $(source-dot-net-stage1-blob-container-url) + - task: AzureCLI@2 + displayName: Get stage 1 auth token + inputs: + azureSubscription: 'SourceDotNet Stage1 Publish' + addSpnToEnvironment: true + scriptType: 'ps' + scriptLocation: 'inlineScript' + inlineScript: | + echo "##vso[task.setvariable variable=ARM_CLIENT_ID]$env:servicePrincipalId" + echo "##vso[task.setvariable variable=ARM_ID_TOKEN]$env:idToken" + echo "##vso[task.setvariable variable=ARM_TENANT_ID]$env:tenantId" + + - script: | + echo "Client ID: $(ARM_CLIENT_ID)" + echo "ID Token: $(ARM_ID_TOKEN)" + echo "Tenant ID: $(ARM_TENANT_ID)" + az login --service-principal -u $(ARM_CLIENT_ID) --tenant $(ARM_TENANT_ID) --allow-no-subscriptions --federated-token $(ARM_ID_TOKEN) + displayName: "Login to Azure" + + - script: $(Agent.TempDirectory)/.source-index/tools/UploadIndexStage1 -i .source-index/stage1output -n $(Build.Repository.Name) -s netsourceindexstage1 -b stage1 + displayName: Upload stage1 artifacts to source index \ No newline at end of file diff --git a/global.json b/global.json index dd2c371a82896..cdd18a7bfa7b2 100644 --- a/global.json +++ b/global.json @@ -12,8 +12,8 @@ "xcopy-msbuild": "17.8.1-2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24225.1", - "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24225.1", + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24264.1", + "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24264.1", "Microsoft.Build.Traversal": "3.4.0" } } From c072f8fb777e7b69e313d83c9afe125b8166d04a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 17 May 2024 13:21:58 +0000 Subject: [PATCH 27/38] Update dependencies from https://github.com/dotnet/arcade build 20240516.3 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24266.3 --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0130b84444f20..a255cd157959c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -99,9 +99,9 @@ - + https://github.com/dotnet/arcade - 1814df258a66473d388b8884ac95bd1c8a2585a9 + e6f70c7dd528f05cd28cec2a179d58c22e91d9ac @@ -127,9 +127,9 @@ https://github.com/dotnet/roslyn 5d10d428050c0d6afef30a072c4ae68776621877 - + https://github.com/dotnet/arcade - 1814df258a66473d388b8884ac95bd1c8a2585a9 + e6f70c7dd528f05cd28cec2a179d58c22e91d9ac https://github.com/dotnet/roslyn-analyzers diff --git a/global.json b/global.json index 24c57d871f42d..3adaa7171dae4 100644 --- a/global.json +++ b/global.json @@ -12,7 +12,7 @@ "xcopy-msbuild": "17.8.1-2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24264.1", - "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24264.1" + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24266.3", + "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24266.3" } } From a81c908eb3617300c4e6ec5a87fd40d75213a77b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 17 May 2024 13:30:49 +0000 Subject: [PATCH 28/38] Update dependencies from https://github.com/dotnet/arcade build 20240516.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24225.1 -> To Version 8.0.0-beta.24266.3 --- eng/Version.Details.xml | 12 ++++++------ global.json | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4bdcddc742c66..0278c6013fc25 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -114,14 +114,14 @@ - + https://github.com/dotnet/arcade - 1814df258a66473d388b8884ac95bd1c8a2585a9 + e6f70c7dd528f05cd28cec2a179d58c22e91d9ac - + https://github.com/dotnet/arcade - 1814df258a66473d388b8884ac95bd1c8a2585a9 + e6f70c7dd528f05cd28cec2a179d58c22e91d9ac @@ -148,9 +148,9 @@ https://github.com/dotnet/roslyn 5d10d428050c0d6afef30a072c4ae68776621877 - + https://github.com/dotnet/arcade - 1814df258a66473d388b8884ac95bd1c8a2585a9 + e6f70c7dd528f05cd28cec2a179d58c22e91d9ac https://github.com/dotnet/roslyn-analyzers diff --git a/global.json b/global.json index cdd18a7bfa7b2..c423e6914cebf 100644 --- a/global.json +++ b/global.json @@ -12,8 +12,8 @@ "xcopy-msbuild": "17.8.1-2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24264.1", - "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24264.1", + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24266.3", + "Microsoft.DotNet.Helix.Sdk": "8.0.0-beta.24266.3", "Microsoft.Build.Traversal": "3.4.0" } } From 9b0d56da8fe58c5200e06d386b1c95a60c95290a Mon Sep 17 00:00:00 2001 From: Marc Paine Date: Fri, 17 May 2024 11:54:44 -0700 Subject: [PATCH 29/38] Add a pinned pkcs entry (#73515) * Add a pinned pkcs entry * Try 7.0.2 which is reportedly already in SBRP --- eng/Directory.Packages.props | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/Directory.Packages.props b/eng/Directory.Packages.props index 63bbd6c066812..d3d5dd96f0b71 100644 --- a/eng/Directory.Packages.props +++ b/eng/Directory.Packages.props @@ -307,6 +307,7 @@ + From d62554968115a477c7d66b51d99c07c529f6824f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 18 May 2024 12:53:53 +0000 Subject: [PATCH 30/38] Update dependencies from https://github.com/dotnet/arcade build 20240516.3 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24266.3 From 8a38d85b932e6fbedf32a77a66065db4774d60ce Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 18 May 2024 13:00:14 +0000 Subject: [PATCH 31/38] Update dependencies from https://github.com/dotnet/arcade build 20240516.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24225.1 -> To Version 8.0.0-beta.24266.3 From 768d9d0d0a577cdc1ce76520b87fcb08ec3f2195 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 19 May 2024 12:53:02 +0000 Subject: [PATCH 32/38] Update dependencies from https://github.com/dotnet/arcade build 20240516.3 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24266.3 From 98f550beb361f59e97402d9d738147642f4b94f3 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 19 May 2024 12:59:49 +0000 Subject: [PATCH 33/38] Update dependencies from https://github.com/dotnet/arcade build 20240516.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24225.1 -> To Version 8.0.0-beta.24266.3 From c665a05000c728d1df9cbd657ef781aa4a5b6bc7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 20 May 2024 04:45:00 +0000 Subject: [PATCH 34/38] Update dependencies from https://github.com/dotnet/arcade build 20240516.3 Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24204.3 -> To Version 8.0.0-beta.24266.3 From 54be760ac0d12ffc70fc52d8a95dab1130252b90 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 20 May 2024 04:53:18 +0000 Subject: [PATCH 35/38] Update dependencies from https://github.com/dotnet/arcade build 20240516.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk From Version 8.0.0-beta.24225.1 -> To Version 8.0.0-beta.24266.3 From e8f775c1d8a73dee7ad02408712d714251e708ea Mon Sep 17 00:00:00 2001 From: Jan Jones Date: Mon, 20 May 2024 19:11:36 +0200 Subject: [PATCH 36/38] [17.10] Disable nullable comparison optimization for decimals (#73572) --- .../LocalRewriter_BinaryOperator.cs | 26 +- .../CodeGenOptimizedNullableOperators.cs | 1634 ++++++++++++++++- .../Emit/CodeGen/CodeGenStructsAndEnum.cs | 49 +- 3 files changed, 1683 insertions(+), 26 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_BinaryOperator.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_BinaryOperator.cs index 8a57e0daae122..46d37fdd2d589 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_BinaryOperator.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_BinaryOperator.cs @@ -4,6 +4,7 @@ using System.Collections.Immutable; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Symbols; using Microsoft.CodeAnalysis.PooledObjects; using Roslyn.Utilities; @@ -998,7 +999,7 @@ private BoundExpression LowerLiftedBuiltInComparisonOperator( // Optimization: If one side is non-default constant, checking HasValue is not needed. if (kind.Operator() is BinaryOperatorKind.Equal or BinaryOperatorKind.NotEqual) { - if (xNonNull?.ConstantValueOpt is { IsDefaultValue: false }) + if (canNotBeEqualToDefaultValue(xNonNull?.ConstantValueOpt)) { Debug.Assert(yNonNull is null, "Handled by trivial optimization above; otherwise we should use yNonNull here."); return MakeBinaryOperator( @@ -1011,7 +1012,7 @@ private BoundExpression LowerLiftedBuiltInComparisonOperator( constrainedToTypeOpt: null); } - if (yNonNull?.ConstantValueOpt is { IsDefaultValue: false }) + if (canNotBeEqualToDefaultValue(yNonNull?.ConstantValueOpt)) { Debug.Assert(xNonNull is null, "Handled by trivial optimization above; otherwise we should use xNonNull here."); return MakeBinaryOperator( @@ -1098,6 +1099,27 @@ private BoundExpression LowerLiftedBuiltInComparisonOperator( sideEffects: ImmutableArray.Create(tempAssignmentX, tempAssignmentY), value: binaryExpression, type: boolType); + + static bool canNotBeEqualToDefaultValue( + [NotNullWhen(returnValue: true)] ConstantValue? constantValue) + { + // This is an explicit list so new constant values are not accidentally supported without consideration. + // Decimal is not in the list because it is possible to have a non-default decimal constant + // which is equal to the default decimal (0.0m == default(decimal)). + return constantValue is + { + IsDefaultValue: false, + Discriminator: ConstantValueTypeDiscriminator.Boolean + or ConstantValueTypeDiscriminator.Double + or ConstantValueTypeDiscriminator.Int32 + or ConstantValueTypeDiscriminator.Int64 + or ConstantValueTypeDiscriminator.NInt + or ConstantValueTypeDiscriminator.NUInt + or ConstantValueTypeDiscriminator.Single + or ConstantValueTypeDiscriminator.UInt32 + or ConstantValueTypeDiscriminator.UInt64 + }; + } } private BoundExpression LowerLiftedUserDefinedComparisonOperator( diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenOptimizedNullableOperators.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenOptimizedNullableOperators.cs index 53e966a5b90ad..dff16da5b01e6 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenOptimizedNullableOperators.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenOptimizedNullableOperators.cs @@ -3391,10 +3391,59 @@ .locals init (int? V_0, verifier.VerifyIL("C.M", il); } + [Theory, CombinatorialData, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_Double_E0([CombinatorialValues("0d", "0.0")] string rhs) + { + var source = $$""" + C.Run(0d); + C.Run(0.0); + C.Run(1.0); + C.Run(1.2); + C.Run(null); + + class C + { + public static void Run(double? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(double? x) => x == {{rhs}}; + } + """; + var output = "11000"; + var il = """ + { + // Code size 31 (0x1f) + .maxstack 2 + .locals init (double? V_0, + double V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldc.r8 0 + IL_000b: stloc.1 + IL_000c: ldloca.s V_0 + IL_000e: call "double double?.GetValueOrDefault()" + IL_0013: ldloc.1 + IL_0014: ceq + IL_0016: ldloca.s V_0 + IL_0018: call "bool double?.HasValue.get" + IL_001d: and + IL_001e: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] public void NullableConstant_Double_G1() { var source = """ + C.Run(0d); C.Run(0.0); C.Run(1.0); C.Run(1.2); @@ -3409,7 +3458,7 @@ public static void Run(double? x) static bool M(double? x) => x > 1.0; } """; - var output = "0010"; + var output = "00010"; var il = """ { // Code size 31 (0x1f) @@ -3442,6 +3491,7 @@ .locals init (double? V_0, public void NullableConstant_Double_LE1() { var source = """ + C.Run(0d); C.Run(0.0); C.Run(1.0); C.Run(1.2); @@ -3456,7 +3506,7 @@ public static void Run(double? x) static bool M(double? x) => x <= 1.0; } """; - var output = "1100"; + var output = "11100"; var il = """ { // Code size 34 (0x22) @@ -3486,5 +3536,1585 @@ .locals init (double? V_0, verifier.VerifyDiagnostics(); verifier.VerifyIL("C.M", il); } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_Decimal_E0() + { + var source = """ + C.Run(0m); + C.Run(0.0m); + C.Run(1m); + C.Run(2m); + C.Run(null); + C.Run(default(decimal)); + C.Run(decimal.Zero); + + class C + { + public static void Run(decimal? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(decimal? x) => x == 0m; + } + """; + var output = "1100011"; + var il = """ + { + // Code size 32 (0x20) + .maxstack 2 + .locals init (decimal? V_0, + decimal V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloca.s V_1 + IL_0004: initobj "decimal" + IL_000a: ldloca.s V_0 + IL_000c: call "decimal decimal?.GetValueOrDefault()" + IL_0011: ldloc.1 + IL_0012: call "bool decimal.op_Equality(decimal, decimal)" + IL_0017: ldloca.s V_0 + IL_0019: call "bool decimal?.HasValue.get" + IL_001e: and + IL_001f: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + [WorkItem("https://github.com/dotnet/roslyn/issues/73510")] + public void NullableConstant_Decimal_E00() + { + var source = """ + C.Run(0m); + C.Run(0.0m); + C.Run(1m); + C.Run(2m); + C.Run(null); + C.Run(default(decimal)); + C.Run(decimal.Zero); + + class C + { + public static void Run(decimal? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(decimal? x) => x == 0.0m; + } + """; + var output = "1100011"; + var il = """ + { + // Code size 36 (0x24) + .maxstack 6 + .locals init (decimal? V_0, + decimal V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloca.s V_1 + IL_0004: ldc.i4.0 + IL_0005: ldc.i4.0 + IL_0006: ldc.i4.0 + IL_0007: ldc.i4.0 + IL_0008: ldc.i4.1 + IL_0009: call "decimal..ctor(int, int, int, bool, byte)" + IL_000e: ldloca.s V_0 + IL_0010: call "decimal decimal?.GetValueOrDefault()" + IL_0015: ldloc.1 + IL_0016: call "bool decimal.op_Equality(decimal, decimal)" + IL_001b: ldloca.s V_0 + IL_001d: call "bool decimal?.HasValue.get" + IL_0022: and + IL_0023: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + [WorkItem("https://github.com/dotnet/roslyn/issues/73510")] + public void NullableConstant_Decimal_00E() + { + var source = """ + C.Run(0m); + C.Run(0.0m); + C.Run(1m); + C.Run(2m); + C.Run(null); + C.Run(default(decimal)); + C.Run(decimal.Zero); + + class C + { + public static void Run(decimal? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(decimal? x) => 0.0m == x; + } + """; + var output = "1100011"; + var il = """ + { + // Code size 33 (0x21) + .maxstack 5 + .locals init (decimal? V_0) + IL_0000: ldc.i4.0 + IL_0001: ldc.i4.0 + IL_0002: ldc.i4.0 + IL_0003: ldc.i4.0 + IL_0004: ldc.i4.1 + IL_0005: newobj "decimal..ctor(int, int, int, bool, byte)" + IL_000a: ldarg.0 + IL_000b: stloc.0 + IL_000c: ldloca.s V_0 + IL_000e: call "decimal decimal?.GetValueOrDefault()" + IL_0013: call "bool decimal.op_Equality(decimal, decimal)" + IL_0018: ldloca.s V_0 + IL_001a: call "bool decimal?.HasValue.get" + IL_001f: and + IL_0020: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + [WorkItem("https://github.com/dotnet/roslyn/issues/73510")] + public void NullableConstant_Decimal_E000() + { + var source = """ + C.Run(0m); + C.Run(0.0m); + C.Run(1m); + C.Run(2m); + C.Run(null); + C.Run(default(decimal)); + C.Run(decimal.Zero); + + class C + { + public static void Run(decimal? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(decimal? x) => x == 0.00m; + } + """; + var output = "1100011"; + var il = """ + { + // Code size 36 (0x24) + .maxstack 6 + .locals init (decimal? V_0, + decimal V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloca.s V_1 + IL_0004: ldc.i4.0 + IL_0005: ldc.i4.0 + IL_0006: ldc.i4.0 + IL_0007: ldc.i4.0 + IL_0008: ldc.i4.2 + IL_0009: call "decimal..ctor(int, int, int, bool, byte)" + IL_000e: ldloca.s V_0 + IL_0010: call "decimal decimal?.GetValueOrDefault()" + IL_0015: ldloc.1 + IL_0016: call "bool decimal.op_Equality(decimal, decimal)" + IL_001b: ldloca.s V_0 + IL_001d: call "bool decimal?.HasValue.get" + IL_0022: and + IL_0023: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + [WorkItem("https://github.com/dotnet/roslyn/issues/73510")] + public void NullableConstant_Decimal_000E() + { + var source = """ + C.Run(0m); + C.Run(0.0m); + C.Run(1m); + C.Run(2m); + C.Run(null); + C.Run(default(decimal)); + C.Run(decimal.Zero); + + class C + { + public static void Run(decimal? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(decimal? x) => 0.00m == x; + } + """; + var output = "1100011"; + var il = """ + { + // Code size 33 (0x21) + .maxstack 5 + .locals init (decimal? V_0) + IL_0000: ldc.i4.0 + IL_0001: ldc.i4.0 + IL_0002: ldc.i4.0 + IL_0003: ldc.i4.0 + IL_0004: ldc.i4.2 + IL_0005: newobj "decimal..ctor(int, int, int, bool, byte)" + IL_000a: ldarg.0 + IL_000b: stloc.0 + IL_000c: ldloca.s V_0 + IL_000e: call "decimal decimal?.GetValueOrDefault()" + IL_0013: call "bool decimal.op_Equality(decimal, decimal)" + IL_0018: ldloca.s V_0 + IL_001a: call "bool decimal?.HasValue.get" + IL_001f: and + IL_0020: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_Decimal_NE00() + { + var source = """ + C.Run(0m); + C.Run(0.0m); + C.Run(1m); + C.Run(2m); + C.Run(null); + C.Run(default(decimal)); + C.Run(decimal.Zero); + + class C + { + public static void Run(decimal? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(decimal? x) => x != 0.0m; + } + """; + var output = "0011100"; + var il = """ + { + // Code size 39 (0x27) + .maxstack 6 + .locals init (decimal? V_0, + decimal V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloca.s V_1 + IL_0004: ldc.i4.0 + IL_0005: ldc.i4.0 + IL_0006: ldc.i4.0 + IL_0007: ldc.i4.0 + IL_0008: ldc.i4.1 + IL_0009: call "decimal..ctor(int, int, int, bool, byte)" + IL_000e: ldloca.s V_0 + IL_0010: call "decimal decimal?.GetValueOrDefault()" + IL_0015: ldloc.1 + IL_0016: call "bool decimal.op_Equality(decimal, decimal)" + IL_001b: ldloca.s V_0 + IL_001d: call "bool decimal?.HasValue.get" + IL_0022: and + IL_0023: ldc.i4.0 + IL_0024: ceq + IL_0026: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_Decimal_00NE() + { + var source = """ + C.Run(0m); + C.Run(0.0m); + C.Run(1m); + C.Run(2m); + C.Run(null); + C.Run(default(decimal)); + C.Run(decimal.Zero); + + class C + { + public static void Run(decimal? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(decimal? x) => 0.0m != x; + } + """; + var output = "0011100"; + var il = """ + { + // Code size 36 (0x24) + .maxstack 5 + .locals init (decimal? V_0) + IL_0000: ldc.i4.0 + IL_0001: ldc.i4.0 + IL_0002: ldc.i4.0 + IL_0003: ldc.i4.0 + IL_0004: ldc.i4.1 + IL_0005: newobj "decimal..ctor(int, int, int, bool, byte)" + IL_000a: ldarg.0 + IL_000b: stloc.0 + IL_000c: ldloca.s V_0 + IL_000e: call "decimal decimal?.GetValueOrDefault()" + IL_0013: call "bool decimal.op_Equality(decimal, decimal)" + IL_0018: ldloca.s V_0 + IL_001a: call "bool decimal?.HasValue.get" + IL_001f: and + IL_0020: ldc.i4.0 + IL_0021: ceq + IL_0023: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_Decimal_GE0() + { + var source = """ + C.Run(0m); + C.Run(0.0m); + C.Run(1m); + C.Run(2m); + C.Run(null); + C.Run(default(decimal)); + C.Run(decimal.Zero); + + class C + { + public static void Run(decimal? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(decimal? x) => x >= 0m; + } + """; + var output = "1111011"; + var il = """ + { + // Code size 32 (0x20) + .maxstack 2 + .locals init (decimal? V_0, + decimal V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloca.s V_1 + IL_0004: initobj "decimal" + IL_000a: ldloca.s V_0 + IL_000c: call "decimal decimal?.GetValueOrDefault()" + IL_0011: ldloc.1 + IL_0012: call "bool decimal.op_GreaterThanOrEqual(decimal, decimal)" + IL_0017: ldloca.s V_0 + IL_0019: call "bool decimal?.HasValue.get" + IL_001e: and + IL_001f: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_Decimal_GE00() + { + var source = """ + C.Run(0m); + C.Run(0.0m); + C.Run(1m); + C.Run(2m); + C.Run(null); + C.Run(default(decimal)); + C.Run(decimal.Zero); + + class C + { + public static void Run(decimal? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(decimal? x) => x >= 0.0m; + } + """; + var output = "1111011"; + var il = """ + { + // Code size 36 (0x24) + .maxstack 6 + .locals init (decimal? V_0, + decimal V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloca.s V_1 + IL_0004: ldc.i4.0 + IL_0005: ldc.i4.0 + IL_0006: ldc.i4.0 + IL_0007: ldc.i4.0 + IL_0008: ldc.i4.1 + IL_0009: call "decimal..ctor(int, int, int, bool, byte)" + IL_000e: ldloca.s V_0 + IL_0010: call "decimal decimal?.GetValueOrDefault()" + IL_0015: ldloc.1 + IL_0016: call "bool decimal.op_GreaterThanOrEqual(decimal, decimal)" + IL_001b: ldloca.s V_0 + IL_001d: call "bool decimal?.HasValue.get" + IL_0022: and + IL_0023: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_Byte_E0() + { + var source = """ + C.Run(0); + C.Run(1); + C.Run(2); + C.Run(null); + + class C + { + public static void Run(byte? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(byte? x) => x == (byte)0; + } + """; + var output = "1000"; + var il = """ + { + // Code size 56 (0x38) + .maxstack 2 + .locals init (int? V_0, + int V_1, + byte? V_2, + int? V_3) + IL_0000: ldarg.0 + IL_0001: stloc.2 + IL_0002: ldloca.s V_2 + IL_0004: call "bool byte?.HasValue.get" + IL_0009: brtrue.s IL_0016 + IL_000b: ldloca.s V_3 + IL_000d: initobj "int?" + IL_0013: ldloc.3 + IL_0014: br.s IL_0022 + IL_0016: ldloca.s V_2 + IL_0018: call "byte byte?.GetValueOrDefault()" + IL_001d: newobj "int?..ctor(int)" + IL_0022: stloc.0 + IL_0023: ldc.i4.0 + IL_0024: stloc.1 + IL_0025: ldloca.s V_0 + IL_0027: call "int int?.GetValueOrDefault()" + IL_002c: ldloc.1 + IL_002d: ceq + IL_002f: ldloca.s V_0 + IL_0031: call "bool int?.HasValue.get" + IL_0036: and + IL_0037: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_Byte_E1() + { + var source = """ + C.Run(0); + C.Run(1); + C.Run(2); + C.Run(null); + + class C + { + public static void Run(byte? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(byte? x) => x == 1; + } + """; + var output = "0100"; + var il = """ + { + // Code size 46 (0x2e) + .maxstack 2 + .locals init (byte? V_0, + int? V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloca.s V_0 + IL_0004: call "bool byte?.HasValue.get" + IL_0009: brtrue.s IL_0016 + IL_000b: ldloca.s V_1 + IL_000d: initobj "int?" + IL_0013: ldloc.1 + IL_0014: br.s IL_0022 + IL_0016: ldloca.s V_0 + IL_0018: call "byte byte?.GetValueOrDefault()" + IL_001d: newobj "int?..ctor(int)" + IL_0022: stloc.1 + IL_0023: ldloca.s V_1 + IL_0025: call "int int?.GetValueOrDefault()" + IL_002a: ldc.i4.1 + IL_002b: ceq + IL_002d: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_Char_E0() + { + var source = """ + C.Run('\0'); + C.Run(default(char)); + C.Run('A'); + C.Run('\x1'); + C.Run(null); + + class C + { + public static void Run(char? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(char? x) => x == '\0'; + } + """; + var output = "11000"; + var il = """ + { + // Code size 56 (0x38) + .maxstack 2 + .locals init (int? V_0, + int V_1, + char? V_2, + int? V_3) + IL_0000: ldarg.0 + IL_0001: stloc.2 + IL_0002: ldloca.s V_2 + IL_0004: call "bool char?.HasValue.get" + IL_0009: brtrue.s IL_0016 + IL_000b: ldloca.s V_3 + IL_000d: initobj "int?" + IL_0013: ldloc.3 + IL_0014: br.s IL_0022 + IL_0016: ldloca.s V_2 + IL_0018: call "char char?.GetValueOrDefault()" + IL_001d: newobj "int?..ctor(int)" + IL_0022: stloc.0 + IL_0023: ldc.i4.0 + IL_0024: stloc.1 + IL_0025: ldloca.s V_0 + IL_0027: call "int int?.GetValueOrDefault()" + IL_002c: ldloc.1 + IL_002d: ceq + IL_002f: ldloca.s V_0 + IL_0031: call "bool int?.HasValue.get" + IL_0036: and + IL_0037: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_Char_E1() + { + var source = """ + C.Run('\0'); + C.Run(default(char)); + C.Run('A'); + C.Run('\x1'); + C.Run(null); + + class C + { + public static void Run(char? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(char? x) => x == '\x1'; + } + """; + var output = "00010"; + var il = """ + { + // Code size 56 (0x38) + .maxstack 2 + .locals init (int? V_0, + int V_1, + char? V_2, + int? V_3) + IL_0000: ldarg.0 + IL_0001: stloc.2 + IL_0002: ldloca.s V_2 + IL_0004: call "bool char?.HasValue.get" + IL_0009: brtrue.s IL_0016 + IL_000b: ldloca.s V_3 + IL_000d: initobj "int?" + IL_0013: ldloc.3 + IL_0014: br.s IL_0022 + IL_0016: ldloca.s V_2 + IL_0018: call "char char?.GetValueOrDefault()" + IL_001d: newobj "int?..ctor(int)" + IL_0022: stloc.0 + IL_0023: ldc.i4.1 + IL_0024: stloc.1 + IL_0025: ldloca.s V_0 + IL_0027: call "int int?.GetValueOrDefault()" + IL_002c: ldloc.1 + IL_002d: ceq + IL_002f: ldloca.s V_0 + IL_0031: call "bool int?.HasValue.get" + IL_0036: and + IL_0037: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_UInt_E0() + { + var source = """ + C.Run(0); + C.Run(1); + C.Run(2); + C.Run(null); + + class C + { + public static void Run(uint? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(uint? x) => x == 0U; + } + """; + var output = "1000"; + var il = """ + { + // Code size 23 (0x17) + .maxstack 2 + .locals init (uint? V_0, + uint V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.0 + IL_0003: stloc.1 + IL_0004: ldloca.s V_0 + IL_0006: call "uint uint?.GetValueOrDefault()" + IL_000b: ldloc.1 + IL_000c: ceq + IL_000e: ldloca.s V_0 + IL_0010: call "bool uint?.HasValue.get" + IL_0015: and + IL_0016: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_UInt_E1() + { + var source = """ + C.Run(0); + C.Run(1); + C.Run(2); + C.Run(null); + + class C + { + public static void Run(uint? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(uint? x) => x == 1U; + } + """; + var output = "0100"; + var il = """ + { + // Code size 11 (0xb) + .maxstack 2 + IL_0000: ldarga.s V_0 + IL_0002: call "uint uint?.GetValueOrDefault()" + IL_0007: ldc.i4.1 + IL_0008: ceq + IL_000a: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_Short_E0() + { + var source = """ + C.Run(0); + C.Run(1); + C.Run(2); + C.Run(null); + + class C + { + public static void Run(short? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(short? x) => x == (short)0; + } + """; + var output = "1000"; + var il = """ + { + // Code size 56 (0x38) + .maxstack 2 + .locals init (int? V_0, + int V_1, + short? V_2, + int? V_3) + IL_0000: ldarg.0 + IL_0001: stloc.2 + IL_0002: ldloca.s V_2 + IL_0004: call "bool short?.HasValue.get" + IL_0009: brtrue.s IL_0016 + IL_000b: ldloca.s V_3 + IL_000d: initobj "int?" + IL_0013: ldloc.3 + IL_0014: br.s IL_0022 + IL_0016: ldloca.s V_2 + IL_0018: call "short short?.GetValueOrDefault()" + IL_001d: newobj "int?..ctor(int)" + IL_0022: stloc.0 + IL_0023: ldc.i4.0 + IL_0024: stloc.1 + IL_0025: ldloca.s V_0 + IL_0027: call "int int?.GetValueOrDefault()" + IL_002c: ldloc.1 + IL_002d: ceq + IL_002f: ldloca.s V_0 + IL_0031: call "bool int?.HasValue.get" + IL_0036: and + IL_0037: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_Short_E1() + { + var source = """ + C.Run(0); + C.Run(1); + C.Run(2); + C.Run(null); + + class C + { + public static void Run(short? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(short? x) => x == 1; + } + """; + var output = "0100"; + var il = """ + { + // Code size 46 (0x2e) + .maxstack 2 + .locals init (short? V_0, + int? V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloca.s V_0 + IL_0004: call "bool short?.HasValue.get" + IL_0009: brtrue.s IL_0016 + IL_000b: ldloca.s V_1 + IL_000d: initobj "int?" + IL_0013: ldloc.1 + IL_0014: br.s IL_0022 + IL_0016: ldloca.s V_0 + IL_0018: call "short short?.GetValueOrDefault()" + IL_001d: newobj "int?..ctor(int)" + IL_0022: stloc.1 + IL_0023: ldloca.s V_1 + IL_0025: call "int int?.GetValueOrDefault()" + IL_002a: ldc.i4.1 + IL_002b: ceq + IL_002d: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_UShort_E0() + { + var source = """ + C.Run(0); + C.Run(1); + C.Run(2); + C.Run(null); + + class C + { + public static void Run(ushort? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(ushort? x) => x == (ushort)0; + } + """; + var output = "1000"; + var il = """ + { + // Code size 56 (0x38) + .maxstack 2 + .locals init (int? V_0, + int V_1, + ushort? V_2, + int? V_3) + IL_0000: ldarg.0 + IL_0001: stloc.2 + IL_0002: ldloca.s V_2 + IL_0004: call "bool ushort?.HasValue.get" + IL_0009: brtrue.s IL_0016 + IL_000b: ldloca.s V_3 + IL_000d: initobj "int?" + IL_0013: ldloc.3 + IL_0014: br.s IL_0022 + IL_0016: ldloca.s V_2 + IL_0018: call "ushort ushort?.GetValueOrDefault()" + IL_001d: newobj "int?..ctor(int)" + IL_0022: stloc.0 + IL_0023: ldc.i4.0 + IL_0024: stloc.1 + IL_0025: ldloca.s V_0 + IL_0027: call "int int?.GetValueOrDefault()" + IL_002c: ldloc.1 + IL_002d: ceq + IL_002f: ldloca.s V_0 + IL_0031: call "bool int?.HasValue.get" + IL_0036: and + IL_0037: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_UShort_E1() + { + var source = """ + C.Run(0); + C.Run(1); + C.Run(2); + C.Run(null); + + class C + { + public static void Run(ushort? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(ushort? x) => x == 1; + } + """; + var output = "0100"; + var il = """ + { + // Code size 46 (0x2e) + .maxstack 2 + .locals init (ushort? V_0, + int? V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloca.s V_0 + IL_0004: call "bool ushort?.HasValue.get" + IL_0009: brtrue.s IL_0016 + IL_000b: ldloca.s V_1 + IL_000d: initobj "int?" + IL_0013: ldloc.1 + IL_0014: br.s IL_0022 + IL_0016: ldloca.s V_0 + IL_0018: call "ushort ushort?.GetValueOrDefault()" + IL_001d: newobj "int?..ctor(int)" + IL_0022: stloc.1 + IL_0023: ldloca.s V_1 + IL_0025: call "int int?.GetValueOrDefault()" + IL_002a: ldc.i4.1 + IL_002b: ceq + IL_002d: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_Long_E0() + { + var source = """ + C.Run(0); + C.Run(1); + C.Run(2); + C.Run(null); + + class C + { + public static void Run(long? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(long? x) => x == 0L; + } + """; + var output = "1000"; + var il = """ + { + // Code size 24 (0x18) + .maxstack 2 + .locals init (long? V_0, + long V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.0 + IL_0003: conv.i8 + IL_0004: stloc.1 + IL_0005: ldloca.s V_0 + IL_0007: call "long long?.GetValueOrDefault()" + IL_000c: ldloc.1 + IL_000d: ceq + IL_000f: ldloca.s V_0 + IL_0011: call "bool long?.HasValue.get" + IL_0016: and + IL_0017: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_Long_E1() + { + var source = """ + C.Run(0); + C.Run(1); + C.Run(2); + C.Run(null); + + class C + { + public static void Run(long? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(long? x) => x == 1L; + } + """; + var output = "0100"; + var il = """ + { + // Code size 12 (0xc) + .maxstack 2 + IL_0000: ldarga.s V_0 + IL_0002: call "long long?.GetValueOrDefault()" + IL_0007: ldc.i4.1 + IL_0008: conv.i8 + IL_0009: ceq + IL_000b: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_ULong_E0() + { + var source = """ + C.Run(0); + C.Run(1); + C.Run(2); + C.Run(null); + + class C + { + public static void Run(ulong? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(ulong? x) => x == 0UL; + } + """; + var output = "1000"; + var il = """ + { + // Code size 24 (0x18) + .maxstack 2 + .locals init (ulong? V_0, + ulong V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.0 + IL_0003: conv.i8 + IL_0004: stloc.1 + IL_0005: ldloca.s V_0 + IL_0007: call "ulong ulong?.GetValueOrDefault()" + IL_000c: ldloc.1 + IL_000d: ceq + IL_000f: ldloca.s V_0 + IL_0011: call "bool ulong?.HasValue.get" + IL_0016: and + IL_0017: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_ULong_E1() + { + var source = """ + C.Run(0); + C.Run(1); + C.Run(2); + C.Run(null); + + class C + { + public static void Run(ulong? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(ulong? x) => x == 1UL; + } + """; + var output = "0100"; + var il = """ + { + // Code size 12 (0xc) + .maxstack 2 + IL_0000: ldarga.s V_0 + IL_0002: call "ulong ulong?.GetValueOrDefault()" + IL_0007: ldc.i4.1 + IL_0008: conv.i8 + IL_0009: ceq + IL_000b: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_NInt_E0() + { + var source = """ + C.Run(0); + C.Run(1); + C.Run(2); + C.Run(null); + + class C + { + public static void Run(nint? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(nint? x) => x == (nint)0; + } + """; + var output = "1000"; + var il = """ + { + // Code size 24 (0x18) + .maxstack 2 + .locals init (nint? V_0, + System.IntPtr V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.0 + IL_0003: conv.i + IL_0004: stloc.1 + IL_0005: ldloca.s V_0 + IL_0007: call "nint nint?.GetValueOrDefault()" + IL_000c: ldloc.1 + IL_000d: ceq + IL_000f: ldloca.s V_0 + IL_0011: call "bool nint?.HasValue.get" + IL_0016: and + IL_0017: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_NInt_E1() + { + var source = """ + C.Run(0); + C.Run(1); + C.Run(2); + C.Run(null); + + class C + { + public static void Run(nint? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(nint? x) => x == (nint)1; + } + """; + var output = "0100"; + var il = """ + { + // Code size 12 (0xc) + .maxstack 2 + IL_0000: ldarga.s V_0 + IL_0002: call "nint nint?.GetValueOrDefault()" + IL_0007: ldc.i4.1 + IL_0008: conv.i + IL_0009: ceq + IL_000b: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_NUInt_E0() + { + var source = """ + C.Run(0); + C.Run(1); + C.Run(2); + C.Run(null); + + class C + { + public static void Run(nuint? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(nuint? x) => x == (nuint)0; + } + """; + var output = "1000"; + var il = """ + { + // Code size 24 (0x18) + .maxstack 2 + .locals init (nuint? V_0, + System.UIntPtr V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldc.i4.0 + IL_0003: conv.i + IL_0004: stloc.1 + IL_0005: ldloca.s V_0 + IL_0007: call "nuint nuint?.GetValueOrDefault()" + IL_000c: ldloc.1 + IL_000d: ceq + IL_000f: ldloca.s V_0 + IL_0011: call "bool nuint?.HasValue.get" + IL_0016: and + IL_0017: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_NUInt_E1() + { + var source = """ + C.Run(0); + C.Run(1); + C.Run(2); + C.Run(null); + + class C + { + public static void Run(nuint? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(nuint? x) => x == (nuint)1; + } + """; + var output = "0100"; + var il = """ + { + // Code size 12 (0xc) + .maxstack 2 + IL_0000: ldarga.s V_0 + IL_0002: call "nuint nuint?.GetValueOrDefault()" + IL_0007: ldc.i4.1 + IL_0008: conv.i + IL_0009: ceq + IL_000b: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_SByte_E0() + { + var source = """ + C.Run(0); + C.Run(1); + C.Run(2); + C.Run(null); + + class C + { + public static void Run(sbyte? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(sbyte? x) => x == (sbyte)0; + } + """; + var output = "1000"; + var il = """ + { + // Code size 56 (0x38) + .maxstack 2 + .locals init (int? V_0, + int V_1, + sbyte? V_2, + int? V_3) + IL_0000: ldarg.0 + IL_0001: stloc.2 + IL_0002: ldloca.s V_2 + IL_0004: call "bool sbyte?.HasValue.get" + IL_0009: brtrue.s IL_0016 + IL_000b: ldloca.s V_3 + IL_000d: initobj "int?" + IL_0013: ldloc.3 + IL_0014: br.s IL_0022 + IL_0016: ldloca.s V_2 + IL_0018: call "sbyte sbyte?.GetValueOrDefault()" + IL_001d: newobj "int?..ctor(int)" + IL_0022: stloc.0 + IL_0023: ldc.i4.0 + IL_0024: stloc.1 + IL_0025: ldloca.s V_0 + IL_0027: call "int int?.GetValueOrDefault()" + IL_002c: ldloc.1 + IL_002d: ceq + IL_002f: ldloca.s V_0 + IL_0031: call "bool int?.HasValue.get" + IL_0036: and + IL_0037: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_SByte_E1() + { + var source = """ + C.Run(0); + C.Run(1); + C.Run(2); + C.Run(null); + + class C + { + public static void Run(sbyte? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(sbyte? x) => x == 1; + } + """; + var output = "0100"; + var il = """ + { + // Code size 46 (0x2e) + .maxstack 2 + .locals init (sbyte? V_0, + int? V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldloca.s V_0 + IL_0004: call "bool sbyte?.HasValue.get" + IL_0009: brtrue.s IL_0016 + IL_000b: ldloca.s V_1 + IL_000d: initobj "int?" + IL_0013: ldloc.1 + IL_0014: br.s IL_0022 + IL_0016: ldloca.s V_0 + IL_0018: call "sbyte sbyte?.GetValueOrDefault()" + IL_001d: newobj "int?..ctor(int)" + IL_0022: stloc.1 + IL_0023: ldloca.s V_1 + IL_0025: call "int int?.GetValueOrDefault()" + IL_002a: ldc.i4.1 + IL_002b: ceq + IL_002d: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_Single_E0() + { + var source = """ + C.Run(0f); + C.Run(0.0f); + C.Run(default(float)); + C.Run(1f); + C.Run(2f); + C.Run(null); + + class C + { + public static void Run(float? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(float? x) => x == 0f; + } + """; + var output = "111000"; + var il = """ + { + // Code size 27 (0x1b) + .maxstack 2 + .locals init (float? V_0, + float V_1) + IL_0000: ldarg.0 + IL_0001: stloc.0 + IL_0002: ldc.r4 0 + IL_0007: stloc.1 + IL_0008: ldloca.s V_0 + IL_000a: call "float float?.GetValueOrDefault()" + IL_000f: ldloc.1 + IL_0010: ceq + IL_0012: ldloca.s V_0 + IL_0014: call "bool float?.HasValue.get" + IL_0019: and + IL_001a: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } + + [Fact, WorkItem("https://github.com/dotnet/roslyn/issues/52629")] + public void NullableConstant_Single_E1() + { + var source = """ + C.Run(0f); + C.Run(0.0f); + C.Run(default(float)); + C.Run(1f); + C.Run(2f); + C.Run(null); + + class C + { + public static void Run(float? x) + { + System.Console.Write(M(x) ? 1 : 0); + } + static bool M(float? x) => x == 1f; + } + """; + var output = "000100"; + var il = """ + { + // Code size 15 (0xf) + .maxstack 2 + IL_0000: ldarga.s V_0 + IL_0002: call "float float?.GetValueOrDefault()" + IL_0007: ldc.r4 1 + IL_000c: ceq + IL_000e: ret + } + """; + var verifier = CompileAndVerify(source, options: TestOptions.ReleaseExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + verifier = CompileAndVerify(source, options: TestOptions.DebugExe, expectedOutput: output); + verifier.VerifyDiagnostics(); + verifier.VerifyIL("C.M", il); + } } } diff --git a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenStructsAndEnum.cs b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenStructsAndEnum.cs index 63e3e41ef313a..41f0fcafaf00d 100644 --- a/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenStructsAndEnum.cs +++ b/src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenStructsAndEnum.cs @@ -2288,7 +2288,7 @@ public static void Eval(object obj1, object obj2) compilation.VerifyIL("NullableTest.EqualEqual", @" { - // Code size 101 (0x65) + // Code size 112 (0x70) .maxstack 2 .locals init (decimal? V_0) IL_0000: ldc.i4.0 @@ -2297,27 +2297,32 @@ .locals init (decimal? V_0) IL_0007: box ""bool"" IL_000c: call ""void Test.Eval(object, object)"" IL_0011: ldsfld ""decimal decimal.One"" - IL_0016: ldsflda ""decimal? NullableTest.NULL"" - IL_001b: call ""decimal decimal?.GetValueOrDefault()"" - IL_0020: call ""bool decimal.op_Equality(decimal, decimal)"" - IL_0025: box ""bool"" - IL_002a: ldc.i4.0 - IL_002b: box ""bool"" - IL_0030: call ""void Test.Eval(object, object)"" - IL_0035: ldsfld ""decimal decimal.Zero"" - IL_003a: ldsfld ""decimal? NullableTest.NULL"" - IL_003f: stloc.0 - IL_0040: ldloca.s V_0 - IL_0042: call ""decimal decimal?.GetValueOrDefault()"" - IL_0047: call ""bool decimal.op_Equality(decimal, decimal)"" - IL_004c: ldloca.s V_0 - IL_004e: call ""bool decimal?.HasValue.get"" - IL_0053: and - IL_0054: box ""bool"" - IL_0059: ldc.i4.0 - IL_005a: box ""bool"" - IL_005f: call ""void Test.Eval(object, object)"" - IL_0064: ret + IL_0016: ldsfld ""decimal? NullableTest.NULL"" + IL_001b: stloc.0 + IL_001c: ldloca.s V_0 + IL_001e: call ""decimal decimal?.GetValueOrDefault()"" + IL_0023: call ""bool decimal.op_Equality(decimal, decimal)"" + IL_0028: ldloca.s V_0 + IL_002a: call ""bool decimal?.HasValue.get"" + IL_002f: and + IL_0030: box ""bool"" + IL_0035: ldc.i4.0 + IL_0036: box ""bool"" + IL_003b: call ""void Test.Eval(object, object)"" + IL_0040: ldsfld ""decimal decimal.Zero"" + IL_0045: ldsfld ""decimal? NullableTest.NULL"" + IL_004a: stloc.0 + IL_004b: ldloca.s V_0 + IL_004d: call ""decimal decimal?.GetValueOrDefault()"" + IL_0052: call ""bool decimal.op_Equality(decimal, decimal)"" + IL_0057: ldloca.s V_0 + IL_0059: call ""bool decimal?.HasValue.get"" + IL_005e: and + IL_005f: box ""bool"" + IL_0064: ldc.i4.0 + IL_0065: box ""bool"" + IL_006a: call ""void Test.Eval(object, object)"" + IL_006f: ret } "); } From 2b7d172669b2f7e55803b55f317cfcc2d4279d76 Mon Sep 17 00:00:00 2001 From: Fred Silberberg Date: Thu, 23 May 2024 11:44:22 -0700 Subject: [PATCH 37/38] Shipping tasks (#73617) * Update nuget versions to release where possible. * Mark APIs as shipped * Suppress new warnings * Update unit tests to set required VSTelemetry environment variable * Remove unneeded workaround --------- Co-authored-by: David Barbet --- eng/Directory.Packages.props | 54 +++++++-------- eng/targets/VisualStudio.targets | 20 ------ .../CSharp/Portable/PublicAPI.Shipped.txt | 20 ++++++ .../CSharp/Portable/PublicAPI.Unshipped.txt | 21 +----- .../Core/Portable/PublicAPI.Shipped.txt | 59 +++++++++++++++-- .../Core/Portable/PublicAPI.Unshipped.txt | 60 +---------------- .../Test/Semantic/HasValidFonts.vb | 2 + .../AbstractInProcLanguageClient.cs | 3 + .../AbstractLanguageClientMiddleLayer.cs | 7 +- .../Core/Portable/PublicAPI.Shipped.txt | 5 ++ .../Core/Portable/PublicAPI.Unshipped.txt | 6 +- .../TelemetryReporterTests.cs | 3 + src/Scripting/Core/PublicAPI.Shipped.txt | 1 + src/Scripting/Core/PublicAPI.Unshipped.txt | 2 +- .../Core/Def/Progression/GraphBuilder.cs | 3 + .../VisualStudioWorkspaceImpl.cs | 3 + .../VisualStudioSymbolSearchService.cs | 3 + .../Client/RemoteLanguageServiceWorkspace.cs | 3 + .../Core/Portable/PublicAPI.Shipped.txt | 66 +++++++++++++++++-- .../Core/Portable/PublicAPI.Unshipped.txt | 65 +----------------- 20 files changed, 195 insertions(+), 211 deletions(-) diff --git a/eng/Directory.Packages.props b/eng/Directory.Packages.props index d3d5dd96f0b71..f7e75c2011586 100644 --- a/eng/Directory.Packages.props +++ b/eng/Directory.Packages.props @@ -7,7 +7,7 @@ 0.1.187-beta 4.8.0-3.final - 17.9.80-preview + 17.10.191 6.0.0-rtm.21518.12 6.0.0-rtm.21518.12 7.0.0-alpha.1.22060.1 @@ -21,7 +21,7 @@ 8.0.0 2.4.1 2.1.0 - 17.10.22-preview-1 + 17.10.2083 - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - + - - - - - - - - - - diff --git a/src/Compilers/CSharp/Portable/PublicAPI.Shipped.txt b/src/Compilers/CSharp/Portable/PublicAPI.Shipped.txt index 998774f92cfde..c55b2750c7445 100644 --- a/src/Compilers/CSharp/Portable/PublicAPI.Shipped.txt +++ b/src/Compilers/CSharp/Portable/PublicAPI.Shipped.txt @@ -1,4 +1,6 @@ #nullable enable +[RSEXPERIMENTAL001]Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetSemanticModel(Microsoft.CodeAnalysis.SyntaxTree! syntaxTree, Microsoft.CodeAnalysis.SemanticModelOptions options) -> Microsoft.CodeAnalysis.SemanticModel! +[RSEXPERIMENTAL002]static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetInterceptorMethod(this Microsoft.CodeAnalysis.SemanticModel? semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.InvocationExpressionSyntax! node, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.IMethodSymbol? ~Microsoft.CodeAnalysis.CSharp.Syntax.AnonymousMethodExpressionSyntax.Update(Microsoft.CodeAnalysis.SyntaxToken asyncKeyword, Microsoft.CodeAnalysis.SyntaxToken delegateKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax parameterList, Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode body) -> Microsoft.CodeAnalysis.CSharp.Syntax.AnonymousMethodExpressionSyntax ~Microsoft.CodeAnalysis.CSharp.Syntax.AnonymousMethodExpressionSyntax.Update(Microsoft.CodeAnalysis.SyntaxToken asyncKeyword, Microsoft.CodeAnalysis.SyntaxToken delegateKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterListSyntax parameterList, Microsoft.CodeAnalysis.CSharp.Syntax.BlockSyntax block, Microsoft.CodeAnalysis.CSharp.Syntax.ExpressionSyntax expressionBody) -> Microsoft.CodeAnalysis.CSharp.Syntax.AnonymousMethodExpressionSyntax ~Microsoft.CodeAnalysis.CSharp.Syntax.AnonymousMethodExpressionSyntax.WithAsyncKeyword(Microsoft.CodeAnalysis.SyntaxToken asyncKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.AnonymousMethodExpressionSyntax @@ -93,6 +95,7 @@ Microsoft.CodeAnalysis.CSharp.Conversion.Equals(Microsoft.CodeAnalysis.CSharp.Co Microsoft.CodeAnalysis.CSharp.Conversion.Exists.get -> bool Microsoft.CodeAnalysis.CSharp.Conversion.IsAnonymousFunction.get -> bool Microsoft.CodeAnalysis.CSharp.Conversion.IsBoxing.get -> bool +Microsoft.CodeAnalysis.CSharp.Conversion.IsCollectionExpression.get -> bool Microsoft.CodeAnalysis.CSharp.Conversion.IsConditionalExpression.get -> bool Microsoft.CodeAnalysis.CSharp.Conversion.IsConstantExpression.get -> bool Microsoft.CodeAnalysis.CSharp.Conversion.IsDefaultLiteral.get -> bool @@ -260,6 +263,7 @@ Microsoft.CodeAnalysis.CSharp.LanguageVersion Microsoft.CodeAnalysis.CSharp.LanguageVersion.CSharp1 = 1 -> Microsoft.CodeAnalysis.CSharp.LanguageVersion Microsoft.CodeAnalysis.CSharp.LanguageVersion.CSharp10 = 1000 -> Microsoft.CodeAnalysis.CSharp.LanguageVersion Microsoft.CodeAnalysis.CSharp.LanguageVersion.CSharp11 = 1100 -> Microsoft.CodeAnalysis.CSharp.LanguageVersion +Microsoft.CodeAnalysis.CSharp.LanguageVersion.CSharp12 = 1200 -> Microsoft.CodeAnalysis.CSharp.LanguageVersion Microsoft.CodeAnalysis.CSharp.LanguageVersion.CSharp2 = 2 -> Microsoft.CodeAnalysis.CSharp.LanguageVersion Microsoft.CodeAnalysis.CSharp.LanguageVersion.CSharp3 = 3 -> Microsoft.CodeAnalysis.CSharp.LanguageVersion Microsoft.CodeAnalysis.CSharp.LanguageVersion.CSharp4 = 4 -> Microsoft.CodeAnalysis.CSharp.LanguageVersion @@ -885,10 +889,13 @@ Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterListSyntax.WithCloseParenToken Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterListSyntax.WithOpenParenToken(Microsoft.CodeAnalysis.SyntaxToken openParenToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterListSyntax! Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterListSyntax.WithParameters(Microsoft.CodeAnalysis.SeparatedSyntaxList parameters) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterListSyntax! Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax +Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax.ReadOnlyKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax.RefKindKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax.RefOrOutKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax.Type.get -> Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax! Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax.Update(Microsoft.CodeAnalysis.SyntaxToken refKindKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax! type) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax! +Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax.Update(Microsoft.CodeAnalysis.SyntaxToken refKindKeyword, Microsoft.CodeAnalysis.SyntaxToken readOnlyKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax! type) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax! +Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax.WithReadOnlyKeyword(Microsoft.CodeAnalysis.SyntaxToken readOnlyKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax! Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax.WithRefKindKeyword(Microsoft.CodeAnalysis.SyntaxToken refKindKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax! Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax.WithRefOrOutKeyword(Microsoft.CodeAnalysis.SyntaxToken refOrOutKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax! Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax.WithType(Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax! type) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax! @@ -3413,6 +3420,15 @@ Microsoft.CodeAnalysis.CSharp.SyntaxKind.XmlTextLiteralToken = 8513 -> Microsoft Microsoft.CodeAnalysis.CSharp.SyntaxKind.YieldBreakStatement = 8807 -> Microsoft.CodeAnalysis.CSharp.SyntaxKind Microsoft.CodeAnalysis.CSharp.SyntaxKind.YieldKeyword = 8405 -> Microsoft.CodeAnalysis.CSharp.SyntaxKind Microsoft.CodeAnalysis.CSharp.SyntaxKind.YieldReturnStatement = 8806 -> Microsoft.CodeAnalysis.CSharp.SyntaxKind +Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser +Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser.Dispose() -> void +Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser.ParseNextToken() -> Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser.Result +Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser.ResetTo(Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser.Result result) -> void +Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser.Result +Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser.Result.ContextualKind.get -> Microsoft.CodeAnalysis.CSharp.SyntaxKind +Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser.Result.Result() -> void +Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser.Result.Token.get -> Microsoft.CodeAnalysis.SyntaxToken +Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser.SkipForwardTo(int position) -> void Microsoft.CodeAnalysis.CSharp.TypedConstantExtensions Microsoft.CodeAnalysis.CSharpExtensions override abstract Microsoft.CodeAnalysis.CSharp.Syntax.BaseFieldDeclarationSyntax.AttributeLists.get -> Microsoft.CodeAnalysis.SyntaxList @@ -4541,6 +4557,7 @@ static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetDeclaredSymbol(this Mic static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetDeclaredSymbol(this Microsoft.CodeAnalysis.SemanticModel? semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.IndexerDeclarationSyntax! declarationSyntax, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.IPropertySymbol? static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetDeclaredSymbol(this Microsoft.CodeAnalysis.SemanticModel? semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.JoinIntoClauseSyntax! node, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.IRangeVariableSymbol? static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetDeclaredSymbol(this Microsoft.CodeAnalysis.SemanticModel? semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.LabeledStatementSyntax! declarationSyntax, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.ILabelSymbol? +static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetDeclaredSymbol(this Microsoft.CodeAnalysis.SemanticModel? semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax! node, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.IMethodSymbol? static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetDeclaredSymbol(this Microsoft.CodeAnalysis.SemanticModel? semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.MemberDeclarationSyntax! declarationSyntax, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.ISymbol? static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetDeclaredSymbol(this Microsoft.CodeAnalysis.SemanticModel? semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.NamespaceDeclarationSyntax! declarationSyntax, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.INamespaceSymbol? static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetDeclaredSymbol(this Microsoft.CodeAnalysis.SemanticModel? semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.ParameterSyntax! declarationSyntax, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.IParameterSymbol? @@ -4556,6 +4573,7 @@ static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetDeclaredSymbol(this Mic static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetDeclaredSymbol(this Microsoft.CodeAnalysis.SemanticModel? semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.VariableDeclaratorSyntax! declarationSyntax, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.ISymbol? static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetDeconstructionInfo(this Microsoft.CodeAnalysis.SemanticModel? semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.AssignmentExpressionSyntax! assignment) -> Microsoft.CodeAnalysis.CSharp.DeconstructionInfo static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetDeconstructionInfo(this Microsoft.CodeAnalysis.SemanticModel? semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.ForEachVariableStatementSyntax! foreach) -> Microsoft.CodeAnalysis.CSharp.DeconstructionInfo +static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetElementConversion(this Microsoft.CodeAnalysis.Operations.ISpreadOperation! spread) -> Microsoft.CodeAnalysis.CSharp.Conversion static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetFirstDirective(this Microsoft.CodeAnalysis.SyntaxNode! node, System.Func? predicate = null) -> Microsoft.CodeAnalysis.CSharp.Syntax.DirectiveTriviaSyntax? static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetForEachStatementInfo(this Microsoft.CodeAnalysis.SemanticModel? semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.CommonForEachStatementSyntax! forEachStatement) -> Microsoft.CodeAnalysis.CSharp.ForEachStatementInfo static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetForEachStatementInfo(this Microsoft.CodeAnalysis.SemanticModel? semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.ForEachStatementSyntax! forEachStatement) -> Microsoft.CodeAnalysis.CSharp.ForEachStatementInfo @@ -4806,10 +4824,12 @@ static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ConversionOperatorMemberCref( static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ConversionOperatorMemberCref(Microsoft.CodeAnalysis.SyntaxToken implicitOrExplicitKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax! type, Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterListSyntax? parameters) -> Microsoft.CodeAnalysis.CSharp.Syntax.ConversionOperatorMemberCrefSyntax! static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ConversionOperatorMemberCref(Microsoft.CodeAnalysis.SyntaxToken implicitOrExplicitKeyword, Microsoft.CodeAnalysis.SyntaxToken operatorKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax! type, Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterListSyntax? parameters) -> Microsoft.CodeAnalysis.CSharp.Syntax.ConversionOperatorMemberCrefSyntax! static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.ConversionOperatorMemberCref(Microsoft.CodeAnalysis.SyntaxToken implicitOrExplicitKeyword, Microsoft.CodeAnalysis.SyntaxToken operatorKeyword, Microsoft.CodeAnalysis.SyntaxToken checkedKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax! type, Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterListSyntax? parameters) -> Microsoft.CodeAnalysis.CSharp.Syntax.ConversionOperatorMemberCrefSyntax! +static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.CreateTokenParser(Microsoft.CodeAnalysis.Text.SourceText! sourceText, Microsoft.CodeAnalysis.CSharp.CSharpParseOptions? options = null) -> Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser! static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.CrefBracketedParameterList(Microsoft.CodeAnalysis.SeparatedSyntaxList parameters = default(Microsoft.CodeAnalysis.SeparatedSyntaxList)) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefBracketedParameterListSyntax! static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.CrefBracketedParameterList(Microsoft.CodeAnalysis.SyntaxToken openBracketToken, Microsoft.CodeAnalysis.SeparatedSyntaxList parameters, Microsoft.CodeAnalysis.SyntaxToken closeBracketToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefBracketedParameterListSyntax! static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.CrefParameter(Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax! type) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax! static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.CrefParameter(Microsoft.CodeAnalysis.SyntaxToken refKindKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax! type) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax! +static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.CrefParameter(Microsoft.CodeAnalysis.SyntaxToken refKindKeyword, Microsoft.CodeAnalysis.SyntaxToken readOnlyKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax! type) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax! static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.CrefParameterList(Microsoft.CodeAnalysis.SeparatedSyntaxList parameters = default(Microsoft.CodeAnalysis.SeparatedSyntaxList)) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterListSyntax! static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.CrefParameterList(Microsoft.CodeAnalysis.SyntaxToken openParenToken, Microsoft.CodeAnalysis.SeparatedSyntaxList parameters, Microsoft.CodeAnalysis.SyntaxToken closeParenToken) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterListSyntax! static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.DeclarationExpression(Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax! type, Microsoft.CodeAnalysis.CSharp.Syntax.VariableDesignationSyntax! designation) -> Microsoft.CodeAnalysis.CSharp.Syntax.DeclarationExpressionSyntax! diff --git a/src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt b/src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt index a7eede3cf18d3..8b137891791fe 100644 --- a/src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt +++ b/src/Compilers/CSharp/Portable/PublicAPI.Unshipped.txt @@ -1,20 +1 @@ -Microsoft.CodeAnalysis.CSharp.LanguageVersion.CSharp12 = 1200 -> Microsoft.CodeAnalysis.CSharp.LanguageVersion -Microsoft.CodeAnalysis.CSharp.Conversion.IsCollectionExpression.get -> bool -Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax.ReadOnlyKeyword.get -> Microsoft.CodeAnalysis.SyntaxToken -Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax.Update(Microsoft.CodeAnalysis.SyntaxToken refKindKeyword, Microsoft.CodeAnalysis.SyntaxToken readOnlyKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax! type) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax! -Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax.WithReadOnlyKeyword(Microsoft.CodeAnalysis.SyntaxToken readOnlyKeyword) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax! -Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser -Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser.Dispose() -> void -Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser.ParseNextToken() -> Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser.Result -Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser.ResetTo(Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser.Result result) -> void -Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser.Result -Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser.Result.ContextualKind.get -> Microsoft.CodeAnalysis.CSharp.SyntaxKind -Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser.Result.Result() -> void -Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser.Result.Token.get -> Microsoft.CodeAnalysis.SyntaxToken -Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser.SkipForwardTo(int position) -> void -static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetDeclaredSymbol(this Microsoft.CodeAnalysis.SemanticModel? semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.LocalFunctionStatementSyntax! node, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.IMethodSymbol? -static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetElementConversion(this Microsoft.CodeAnalysis.Operations.ISpreadOperation! spread) -> Microsoft.CodeAnalysis.CSharp.Conversion -static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.CreateTokenParser(Microsoft.CodeAnalysis.Text.SourceText! sourceText, Microsoft.CodeAnalysis.CSharp.CSharpParseOptions? options = null) -> Microsoft.CodeAnalysis.CSharp.SyntaxTokenParser! -static Microsoft.CodeAnalysis.CSharp.SyntaxFactory.CrefParameter(Microsoft.CodeAnalysis.SyntaxToken refKindKeyword, Microsoft.CodeAnalysis.SyntaxToken readOnlyKeyword, Microsoft.CodeAnalysis.CSharp.Syntax.TypeSyntax! type) -> Microsoft.CodeAnalysis.CSharp.Syntax.CrefParameterSyntax! -[RSEXPERIMENTAL001]Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetSemanticModel(Microsoft.CodeAnalysis.SyntaxTree! syntaxTree, Microsoft.CodeAnalysis.SemanticModelOptions options) -> Microsoft.CodeAnalysis.SemanticModel! -[RSEXPERIMENTAL002]static Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetInterceptorMethod(this Microsoft.CodeAnalysis.SemanticModel? semanticModel, Microsoft.CodeAnalysis.CSharp.Syntax.InvocationExpressionSyntax! node, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.IMethodSymbol? + diff --git a/src/Compilers/Core/Portable/PublicAPI.Shipped.txt b/src/Compilers/Core/Portable/PublicAPI.Shipped.txt index 496cc20f14b21..45ef4235bb695 100644 --- a/src/Compilers/Core/Portable/PublicAPI.Shipped.txt +++ b/src/Compilers/Core/Portable/PublicAPI.Shipped.txt @@ -1,4 +1,9 @@ #nullable enable +[RSEXPERIMENTAL001]Microsoft.CodeAnalysis.Compilation.GetSemanticModel(Microsoft.CodeAnalysis.SyntaxTree! syntaxTree, Microsoft.CodeAnalysis.SemanticModelOptions options) -> Microsoft.CodeAnalysis.SemanticModel! +[RSEXPERIMENTAL001]Microsoft.CodeAnalysis.SemanticModelOptions +[RSEXPERIMENTAL001]Microsoft.CodeAnalysis.SemanticModelOptions.DisableNullableAnalysis = 2 -> Microsoft.CodeAnalysis.SemanticModelOptions +[RSEXPERIMENTAL001]Microsoft.CodeAnalysis.SemanticModelOptions.IgnoreAccessibility = 1 -> Microsoft.CodeAnalysis.SemanticModelOptions +[RSEXPERIMENTAL001]Microsoft.CodeAnalysis.SemanticModelOptions.None = 0 -> Microsoft.CodeAnalysis.SemanticModelOptions ~Microsoft.CodeAnalysis.IAnalyzerAssemblyLoader.AddDependencyLocation(string fullPath) -> void ~Microsoft.CodeAnalysis.IAnalyzerAssemblyLoader.LoadFromPath(string fullPath) -> System.Reflection.Assembly ~Microsoft.CodeAnalysis.ISymbol.ContainingAssembly.get -> Microsoft.CodeAnalysis.IAssemblySymbol @@ -150,6 +155,7 @@ abstract Microsoft.CodeAnalysis.SemanticModel.LookupLabelsCore(int position, str abstract Microsoft.CodeAnalysis.SemanticModel.LookupNamespacesAndTypesCore(int position, Microsoft.CodeAnalysis.INamespaceOrTypeSymbol? container, string? name) -> System.Collections.Immutable.ImmutableArray abstract Microsoft.CodeAnalysis.SemanticModel.LookupStaticMembersCore(int position, Microsoft.CodeAnalysis.INamespaceOrTypeSymbol? container, string? name) -> System.Collections.Immutable.ImmutableArray abstract Microsoft.CodeAnalysis.SemanticModel.LookupSymbolsCore(int position, Microsoft.CodeAnalysis.INamespaceOrTypeSymbol? container, string? name, bool includeReducedExtensionMethods) -> System.Collections.Immutable.ImmutableArray +abstract Microsoft.CodeAnalysis.SemanticModel.NullableAnalysisIsDisabled.get -> bool abstract Microsoft.CodeAnalysis.SemanticModel.OriginalPositionForSpeculation.get -> int abstract Microsoft.CodeAnalysis.SemanticModel.ParentModelCore.get -> Microsoft.CodeAnalysis.SemanticModel? abstract Microsoft.CodeAnalysis.SemanticModel.RootCore.get -> Microsoft.CodeAnalysis.SyntaxNode! @@ -211,6 +217,7 @@ const Microsoft.CodeAnalysis.WellKnownDiagnosticTags.Build = "Build" -> string! const Microsoft.CodeAnalysis.WellKnownDiagnosticTags.CompilationEnd = "CompilationEnd" -> string! const Microsoft.CodeAnalysis.WellKnownDiagnosticTags.Compiler = "Compiler" -> string! const Microsoft.CodeAnalysis.WellKnownDiagnosticTags.CustomObsolete = "CustomObsolete" -> string! +const Microsoft.CodeAnalysis.WellKnownDiagnosticTags.CustomSeverityConfigurable = "CustomSeverityConfigurable" -> string! const Microsoft.CodeAnalysis.WellKnownDiagnosticTags.EditAndContinue = "EditAndContinue" -> string! const Microsoft.CodeAnalysis.WellKnownDiagnosticTags.NotConfigurable = "NotConfigurable" -> string! const Microsoft.CodeAnalysis.WellKnownDiagnosticTags.Telemetry = "Telemetry" -> string! @@ -750,9 +757,10 @@ Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.Analyzers.get -> Sys Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.CancellationToken.get -> System.Threading.CancellationToken Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.Compilation.get -> Microsoft.CodeAnalysis.Compilation! Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.CompilationWithAnalyzers(Microsoft.CodeAnalysis.Compilation! compilation, System.Collections.Immutable.ImmutableArray analyzers, Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions? options, System.Threading.CancellationToken cancellationToken) -> void +Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.CompilationWithAnalyzers(Microsoft.CodeAnalysis.Compilation! compilation, System.Collections.Immutable.ImmutableArray analyzers, Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions? options) -> void Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.CompilationWithAnalyzers(Microsoft.CodeAnalysis.Compilation! compilation, System.Collections.Immutable.ImmutableArray analyzers, Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzersOptions! analysisOptions) -> void Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAllDiagnosticsAsync() -> System.Threading.Tasks.Task>! -Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAllDiagnosticsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task>! +Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAllDiagnosticsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task>! Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAnalysisResultAsync(Microsoft.CodeAnalysis.AdditionalText! file, Microsoft.CodeAnalysis.Text.TextSpan? filterSpan, System.Collections.Immutable.ImmutableArray analyzers, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAnalysisResultAsync(Microsoft.CodeAnalysis.AdditionalText! file, Microsoft.CodeAnalysis.Text.TextSpan? filterSpan, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAnalysisResultAsync(Microsoft.CodeAnalysis.AdditionalText! file, System.Collections.Immutable.ImmutableArray analyzers, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task! @@ -769,7 +777,7 @@ Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAnalyzerCompilati Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAnalyzerCompilationDiagnosticsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task>! Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAnalyzerDiagnosticsAsync() -> System.Threading.Tasks.Task>! Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAnalyzerDiagnosticsAsync(System.Collections.Immutable.ImmutableArray analyzers, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task>! -Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAnalyzerDiagnosticsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task>! +Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAnalyzerDiagnosticsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task>! Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAnalyzerSemanticDiagnosticsAsync(Microsoft.CodeAnalysis.SemanticModel! model, Microsoft.CodeAnalysis.Text.TextSpan? filterSpan, System.Collections.Immutable.ImmutableArray analyzers, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task>! Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAnalyzerSemanticDiagnosticsAsync(Microsoft.CodeAnalysis.SemanticModel! model, Microsoft.CodeAnalysis.Text.TextSpan? filterSpan, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task>! Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAnalyzerSyntaxDiagnosticsAsync(Microsoft.CodeAnalysis.SyntaxTree! tree, Microsoft.CodeAnalysis.Text.TextSpan? filterSpan, System.Collections.Immutable.ImmutableArray analyzers, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task>! @@ -865,6 +873,7 @@ Microsoft.CodeAnalysis.Diagnostics.SuppressionAnalysisContext.SuppressionAnalysi Microsoft.CodeAnalysis.Diagnostics.SuppressionInfo Microsoft.CodeAnalysis.Diagnostics.SuppressionInfo.Attribute.get -> Microsoft.CodeAnalysis.AttributeData? Microsoft.CodeAnalysis.Diagnostics.SuppressionInfo.Id.get -> string! +Microsoft.CodeAnalysis.Diagnostics.SuppressionInfo.ProgrammaticSuppressions.get -> System.Collections.Immutable.ImmutableArray Microsoft.CodeAnalysis.Diagnostics.SymbolAnalysisContext Microsoft.CodeAnalysis.Diagnostics.SymbolAnalysisContext.CancellationToken.get -> System.Threading.CancellationToken Microsoft.CodeAnalysis.Diagnostics.SymbolAnalysisContext.Compilation.get -> Microsoft.CodeAnalysis.Compilation! @@ -1033,12 +1042,18 @@ Microsoft.CodeAnalysis.Emit.EmitResult Microsoft.CodeAnalysis.Emit.EmitResult.Diagnostics.get -> System.Collections.Immutable.ImmutableArray Microsoft.CodeAnalysis.Emit.EmitResult.Success.get -> bool Microsoft.CodeAnalysis.Emit.InstrumentationKind +Microsoft.CodeAnalysis.Emit.InstrumentationKind.ModuleCancellation = 3 -> Microsoft.CodeAnalysis.Emit.InstrumentationKind Microsoft.CodeAnalysis.Emit.InstrumentationKind.None = 0 -> Microsoft.CodeAnalysis.Emit.InstrumentationKind +Microsoft.CodeAnalysis.Emit.InstrumentationKind.StackOverflowProbing = 2 -> Microsoft.CodeAnalysis.Emit.InstrumentationKind Microsoft.CodeAnalysis.Emit.InstrumentationKind.TestCoverage = 1 -> Microsoft.CodeAnalysis.Emit.InstrumentationKind Microsoft.CodeAnalysis.Emit.MethodInstrumentation Microsoft.CodeAnalysis.Emit.MethodInstrumentation.Kinds.get -> System.Collections.Immutable.ImmutableArray Microsoft.CodeAnalysis.Emit.MethodInstrumentation.Kinds.init -> void Microsoft.CodeAnalysis.Emit.MethodInstrumentation.MethodInstrumentation() -> void +Microsoft.CodeAnalysis.Emit.RuntimeRudeEdit +Microsoft.CodeAnalysis.Emit.RuntimeRudeEdit.Message.get -> string! +Microsoft.CodeAnalysis.Emit.RuntimeRudeEdit.RuntimeRudeEdit() -> void +Microsoft.CodeAnalysis.Emit.RuntimeRudeEdit.RuntimeRudeEdit(string! message) -> void Microsoft.CodeAnalysis.Emit.SemanticEdit Microsoft.CodeAnalysis.Emit.SemanticEdit.Equals(Microsoft.CodeAnalysis.Emit.SemanticEdit other) -> bool Microsoft.CodeAnalysis.Emit.SemanticEdit.Instrumentation.get -> Microsoft.CodeAnalysis.Emit.MethodInstrumentation @@ -1046,8 +1061,10 @@ Microsoft.CodeAnalysis.Emit.SemanticEdit.Kind.get -> Microsoft.CodeAnalysis.Emit Microsoft.CodeAnalysis.Emit.SemanticEdit.NewSymbol.get -> Microsoft.CodeAnalysis.ISymbol? Microsoft.CodeAnalysis.Emit.SemanticEdit.OldSymbol.get -> Microsoft.CodeAnalysis.ISymbol? Microsoft.CodeAnalysis.Emit.SemanticEdit.PreserveLocalVariables.get -> bool +Microsoft.CodeAnalysis.Emit.SemanticEdit.RuntimeRudeEdit.get -> System.Func? Microsoft.CodeAnalysis.Emit.SemanticEdit.SemanticEdit() -> void -Microsoft.CodeAnalysis.Emit.SemanticEdit.SemanticEdit(Microsoft.CodeAnalysis.Emit.SemanticEditKind kind, Microsoft.CodeAnalysis.ISymbol? oldSymbol, Microsoft.CodeAnalysis.ISymbol? newSymbol, System.Func? syntaxMap = null, bool preserveLocalVariables = false, Microsoft.CodeAnalysis.Emit.MethodInstrumentation instrumentation = default(Microsoft.CodeAnalysis.Emit.MethodInstrumentation)) -> void +Microsoft.CodeAnalysis.Emit.SemanticEdit.SemanticEdit(Microsoft.CodeAnalysis.Emit.SemanticEditKind kind, Microsoft.CodeAnalysis.ISymbol? oldSymbol, Microsoft.CodeAnalysis.ISymbol? newSymbol, System.Func? syntaxMap, bool preserveLocalVariables, Microsoft.CodeAnalysis.Emit.MethodInstrumentation instrumentation) -> void +Microsoft.CodeAnalysis.Emit.SemanticEdit.SemanticEdit(Microsoft.CodeAnalysis.Emit.SemanticEditKind kind, Microsoft.CodeAnalysis.ISymbol? oldSymbol, Microsoft.CodeAnalysis.ISymbol? newSymbol, System.Func? syntaxMap = null, System.Func? runtimeRudeEdit = null, Microsoft.CodeAnalysis.Emit.MethodInstrumentation instrumentation = default(Microsoft.CodeAnalysis.Emit.MethodInstrumentation)) -> void Microsoft.CodeAnalysis.Emit.SemanticEdit.SemanticEdit(Microsoft.CodeAnalysis.Emit.SemanticEditKind kind, Microsoft.CodeAnalysis.ISymbol? oldSymbol, Microsoft.CodeAnalysis.ISymbol? newSymbol, System.Func? syntaxMap, bool preserveLocalVariables) -> void Microsoft.CodeAnalysis.Emit.SemanticEdit.SyntaxMap.get -> System.Func? Microsoft.CodeAnalysis.Emit.SemanticEditKind @@ -1513,6 +1530,8 @@ Microsoft.CodeAnalysis.IParameterSymbol.HasExplicitDefaultValue.get -> bool Microsoft.CodeAnalysis.IParameterSymbol.IsDiscard.get -> bool Microsoft.CodeAnalysis.IParameterSymbol.IsOptional.get -> bool Microsoft.CodeAnalysis.IParameterSymbol.IsParams.get -> bool +Microsoft.CodeAnalysis.IParameterSymbol.IsParamsArray.get -> bool +Microsoft.CodeAnalysis.IParameterSymbol.IsParamsCollection.get -> bool Microsoft.CodeAnalysis.IParameterSymbol.IsThis.get -> bool Microsoft.CodeAnalysis.IParameterSymbol.NullableAnnotation.get -> Microsoft.CodeAnalysis.NullableAnnotation Microsoft.CodeAnalysis.IParameterSymbol.Ordinal.get -> int @@ -1773,6 +1792,7 @@ Microsoft.CodeAnalysis.OperationKind.CaughtException = 94 -> Microsoft.CodeAnaly Microsoft.CodeAnalysis.OperationKind.Coalesce = 34 -> Microsoft.CodeAnalysis.OperationKind Microsoft.CodeAnalysis.OperationKind.CoalesceAssignment = 97 -> Microsoft.CodeAnalysis.OperationKind Microsoft.CodeAnalysis.OperationKind.CollectionElementInitializer = 52 -> Microsoft.CodeAnalysis.OperationKind +Microsoft.CodeAnalysis.OperationKind.CollectionExpression = 127 -> Microsoft.CodeAnalysis.OperationKind Microsoft.CodeAnalysis.OperationKind.CompoundAssignment = 43 -> Microsoft.CodeAnalysis.OperationKind Microsoft.CodeAnalysis.OperationKind.Conditional = 33 -> Microsoft.CodeAnalysis.OperationKind Microsoft.CodeAnalysis.OperationKind.ConditionalAccess = 46 -> Microsoft.CodeAnalysis.OperationKind @@ -1855,6 +1875,7 @@ Microsoft.CodeAnalysis.OperationKind.Return = 9 -> Microsoft.CodeAnalysis.Operat Microsoft.CodeAnalysis.OperationKind.SimpleAssignment = 42 -> Microsoft.CodeAnalysis.OperationKind Microsoft.CodeAnalysis.OperationKind.SizeOf = 63 -> Microsoft.CodeAnalysis.OperationKind Microsoft.CodeAnalysis.OperationKind.SlicePattern = 122 -> Microsoft.CodeAnalysis.OperationKind +Microsoft.CodeAnalysis.OperationKind.Spread = 128 -> Microsoft.CodeAnalysis.OperationKind Microsoft.CodeAnalysis.OperationKind.StaticLocalInitializationSemaphore = 95 -> Microsoft.CodeAnalysis.OperationKind Microsoft.CodeAnalysis.OperationKind.Stop = 17 -> Microsoft.CodeAnalysis.OperationKind Microsoft.CodeAnalysis.OperationKind.Switch = 4 -> Microsoft.CodeAnalysis.OperationKind @@ -1887,6 +1908,7 @@ Microsoft.CodeAnalysis.Operations.ArgumentKind.DefaultValue = 3 -> Microsoft.Cod Microsoft.CodeAnalysis.Operations.ArgumentKind.Explicit = 1 -> Microsoft.CodeAnalysis.Operations.ArgumentKind Microsoft.CodeAnalysis.Operations.ArgumentKind.None = 0 -> Microsoft.CodeAnalysis.Operations.ArgumentKind Microsoft.CodeAnalysis.Operations.ArgumentKind.ParamArray = 2 -> Microsoft.CodeAnalysis.Operations.ArgumentKind +Microsoft.CodeAnalysis.Operations.ArgumentKind.ParamCollection = 4 -> Microsoft.CodeAnalysis.Operations.ArgumentKind Microsoft.CodeAnalysis.Operations.BinaryOperatorKind Microsoft.CodeAnalysis.Operations.BinaryOperatorKind.Add = 1 -> Microsoft.CodeAnalysis.Operations.BinaryOperatorKind Microsoft.CodeAnalysis.Operations.BinaryOperatorKind.And = 10 -> Microsoft.CodeAnalysis.Operations.BinaryOperatorKind @@ -2002,6 +2024,9 @@ Microsoft.CodeAnalysis.Operations.ICollectionElementInitializerOperation Microsoft.CodeAnalysis.Operations.ICollectionElementInitializerOperation.AddMethod.get -> Microsoft.CodeAnalysis.IMethodSymbol! Microsoft.CodeAnalysis.Operations.ICollectionElementInitializerOperation.Arguments.get -> System.Collections.Immutable.ImmutableArray Microsoft.CodeAnalysis.Operations.ICollectionElementInitializerOperation.IsDynamic.get -> bool +Microsoft.CodeAnalysis.Operations.ICollectionExpressionOperation +Microsoft.CodeAnalysis.Operations.ICollectionExpressionOperation.ConstructMethod.get -> Microsoft.CodeAnalysis.IMethodSymbol? +Microsoft.CodeAnalysis.Operations.ICollectionExpressionOperation.Elements.get -> System.Collections.Immutable.ImmutableArray Microsoft.CodeAnalysis.Operations.ICompoundAssignmentOperation Microsoft.CodeAnalysis.Operations.ICompoundAssignmentOperation.ConstrainedToType.get -> Microsoft.CodeAnalysis.ITypeSymbol? Microsoft.CodeAnalysis.Operations.ICompoundAssignmentOperation.InConversion.get -> Microsoft.CodeAnalysis.Operations.CommonConversion @@ -2267,6 +2292,10 @@ Microsoft.CodeAnalysis.Operations.ISizeOfOperation.TypeOperand.get -> Microsoft. Microsoft.CodeAnalysis.Operations.ISlicePatternOperation Microsoft.CodeAnalysis.Operations.ISlicePatternOperation.Pattern.get -> Microsoft.CodeAnalysis.Operations.IPatternOperation? Microsoft.CodeAnalysis.Operations.ISlicePatternOperation.SliceSymbol.get -> Microsoft.CodeAnalysis.ISymbol? +Microsoft.CodeAnalysis.Operations.ISpreadOperation +Microsoft.CodeAnalysis.Operations.ISpreadOperation.ElementConversion.get -> Microsoft.CodeAnalysis.Operations.CommonConversion +Microsoft.CodeAnalysis.Operations.ISpreadOperation.ElementType.get -> Microsoft.CodeAnalysis.ITypeSymbol? +Microsoft.CodeAnalysis.Operations.ISpreadOperation.Operand.get -> Microsoft.CodeAnalysis.IOperation! Microsoft.CodeAnalysis.Operations.IStopOperation Microsoft.CodeAnalysis.Operations.ISwitchCaseOperation Microsoft.CodeAnalysis.Operations.ISwitchCaseOperation.Body.get -> System.Collections.Immutable.ImmutableArray @@ -2423,6 +2452,7 @@ Microsoft.CodeAnalysis.RefKind.None = 0 -> Microsoft.CodeAnalysis.RefKind Microsoft.CodeAnalysis.RefKind.Out = 2 -> Microsoft.CodeAnalysis.RefKind Microsoft.CodeAnalysis.RefKind.Ref = 1 -> Microsoft.CodeAnalysis.RefKind Microsoft.CodeAnalysis.RefKind.RefReadOnly = 3 -> Microsoft.CodeAnalysis.RefKind +Microsoft.CodeAnalysis.RefKind.RefReadOnlyParameter = 4 -> Microsoft.CodeAnalysis.RefKind Microsoft.CodeAnalysis.ReportDiagnostic Microsoft.CodeAnalysis.ReportDiagnostic.Default = 0 -> Microsoft.CodeAnalysis.ReportDiagnostic Microsoft.CodeAnalysis.ReportDiagnostic.Error = 1 -> Microsoft.CodeAnalysis.ReportDiagnostic @@ -2485,6 +2515,7 @@ Microsoft.CodeAnalysis.SemanticModel.LookupSymbols(int position, Microsoft.CodeA Microsoft.CodeAnalysis.SemanticModel.ParentModel.get -> Microsoft.CodeAnalysis.SemanticModel? Microsoft.CodeAnalysis.SemanticModel.SemanticModel() -> void Microsoft.CodeAnalysis.SemanticModel.SyntaxTree.get -> Microsoft.CodeAnalysis.SyntaxTree! +Microsoft.CodeAnalysis.SeparatedSyntaxList Microsoft.CodeAnalysis.SeparatedSyntaxList Microsoft.CodeAnalysis.SeparatedSyntaxList.Add(TNode! node) -> Microsoft.CodeAnalysis.SeparatedSyntaxList Microsoft.CodeAnalysis.SeparatedSyntaxList.AddRange(System.Collections.Generic.IEnumerable! nodes) -> Microsoft.CodeAnalysis.SeparatedSyntaxList @@ -2799,6 +2830,7 @@ Microsoft.CodeAnalysis.SyntaxAnnotation.SyntaxAnnotation() -> void Microsoft.CodeAnalysis.SyntaxAnnotation.SyntaxAnnotation(string? kind) -> void Microsoft.CodeAnalysis.SyntaxAnnotation.SyntaxAnnotation(string? kind, string? data) -> void Microsoft.CodeAnalysis.SyntaxContextReceiverCreator +Microsoft.CodeAnalysis.SyntaxList Microsoft.CodeAnalysis.SyntaxList Microsoft.CodeAnalysis.SyntaxList.Add(TNode! node) -> Microsoft.CodeAnalysis.SyntaxList Microsoft.CodeAnalysis.SyntaxList.AddRange(System.Collections.Generic.IEnumerable! nodes) -> Microsoft.CodeAnalysis.SyntaxList @@ -3188,6 +3220,7 @@ Microsoft.CodeAnalysis.Text.SourceText.CanBeEmbedded.get -> bool Microsoft.CodeAnalysis.Text.SourceText.ChecksumAlgorithm.get -> Microsoft.CodeAnalysis.Text.SourceHashAlgorithm Microsoft.CodeAnalysis.Text.SourceText.ContentEquals(Microsoft.CodeAnalysis.Text.SourceText! other) -> bool Microsoft.CodeAnalysis.Text.SourceText.GetChecksum() -> System.Collections.Immutable.ImmutableArray +Microsoft.CodeAnalysis.Text.SourceText.GetContentHash() -> System.Collections.Immutable.ImmutableArray Microsoft.CodeAnalysis.Text.SourceText.GetSubText(int start) -> Microsoft.CodeAnalysis.Text.SourceText! Microsoft.CodeAnalysis.Text.SourceText.Lines.get -> Microsoft.CodeAnalysis.Text.TextLineCollection! Microsoft.CodeAnalysis.Text.SourceText.Replace(int start, int length, string! newText) -> Microsoft.CodeAnalysis.Text.SourceText! @@ -3549,12 +3582,13 @@ static Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.ClearAnalyzer static Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetEffectiveDiagnostics(System.Collections.Generic.IEnumerable! diagnostics, Microsoft.CodeAnalysis.Compilation! compilation) -> System.Collections.Generic.IEnumerable! static Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetEffectiveDiagnostics(System.Collections.Immutable.ImmutableArray diagnostics, Microsoft.CodeAnalysis.Compilation! compilation) -> System.Collections.Generic.IEnumerable! static Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.IsDiagnosticAnalyzerSuppressed(Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer! analyzer, Microsoft.CodeAnalysis.CompilationOptions! options, System.Action? onAnalyzerException = null) -> bool -static Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerExtensions.WithAnalyzers(this Microsoft.CodeAnalysis.Compilation! compilation, System.Collections.Immutable.ImmutableArray analyzers, Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers! +static Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerExtensions.WithAnalyzers(this Microsoft.CodeAnalysis.Compilation! compilation, System.Collections.Immutable.ImmutableArray analyzers, Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions? options = null) -> Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers! +static Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerExtensions.WithAnalyzers(this Microsoft.CodeAnalysis.Compilation! compilation, System.Collections.Immutable.ImmutableArray analyzers, Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions? options, System.Threading.CancellationToken cancellationToken) -> Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers! static Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerExtensions.WithAnalyzers(this Microsoft.CodeAnalysis.Compilation! compilation, System.Collections.Immutable.ImmutableArray analyzers, Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzersOptions! analysisOptions) -> Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers! static Microsoft.CodeAnalysis.Diagnostics.Suppression.Create(Microsoft.CodeAnalysis.SuppressionDescriptor! descriptor, Microsoft.CodeAnalysis.Diagnostic! suppressedDiagnostic) -> Microsoft.CodeAnalysis.Diagnostics.Suppression static Microsoft.CodeAnalysis.Diagnostics.Suppression.operator !=(Microsoft.CodeAnalysis.Diagnostics.Suppression left, Microsoft.CodeAnalysis.Diagnostics.Suppression right) -> bool static Microsoft.CodeAnalysis.Diagnostics.Suppression.operator ==(Microsoft.CodeAnalysis.Diagnostics.Suppression left, Microsoft.CodeAnalysis.Diagnostics.Suppression right) -> bool -static Microsoft.CodeAnalysis.DocumentationCommentId.CreateDeclarationId(Microsoft.CodeAnalysis.ISymbol! symbol) -> string! +static Microsoft.CodeAnalysis.DocumentationCommentId.CreateDeclarationId(Microsoft.CodeAnalysis.ISymbol! symbol) -> string? static Microsoft.CodeAnalysis.DocumentationCommentId.CreateReferenceId(Microsoft.CodeAnalysis.ISymbol! symbol) -> string! static Microsoft.CodeAnalysis.DocumentationCommentId.GetFirstSymbolForDeclarationId(string! id, Microsoft.CodeAnalysis.Compilation! compilation) -> Microsoft.CodeAnalysis.ISymbol? static Microsoft.CodeAnalysis.DocumentationCommentId.GetFirstSymbolForReferenceId(string! id, Microsoft.CodeAnalysis.Compilation! compilation) -> Microsoft.CodeAnalysis.ISymbol? @@ -3567,6 +3601,7 @@ static Microsoft.CodeAnalysis.EmbeddedText.FromStream(string! filePath, System.I static Microsoft.CodeAnalysis.Emit.EditAndContinueMethodDebugInformation.Create(System.Collections.Immutable.ImmutableArray compressedSlotMap, System.Collections.Immutable.ImmutableArray compressedLambdaMap) -> Microsoft.CodeAnalysis.Emit.EditAndContinueMethodDebugInformation static Microsoft.CodeAnalysis.Emit.EditAndContinueMethodDebugInformation.Create(System.Collections.Immutable.ImmutableArray compressedSlotMap, System.Collections.Immutable.ImmutableArray compressedLambdaMap, System.Collections.Immutable.ImmutableArray compressedStateMachineStateMap) -> Microsoft.CodeAnalysis.Emit.EditAndContinueMethodDebugInformation static Microsoft.CodeAnalysis.Emit.EmitBaseline.CreateInitialBaseline(Microsoft.CodeAnalysis.ModuleMetadata! module, System.Func! debugInformationProvider) -> Microsoft.CodeAnalysis.Emit.EmitBaseline! +static Microsoft.CodeAnalysis.Emit.EmitBaseline.CreateInitialBaseline(Microsoft.CodeAnalysis.Compilation! compilation, Microsoft.CodeAnalysis.ModuleMetadata! module, System.Func! debugInformationProvider, System.Func! localSignatureProvider, bool hasPortableDebugInformation) -> Microsoft.CodeAnalysis.Emit.EmitBaseline! static Microsoft.CodeAnalysis.Emit.EmitBaseline.CreateInitialBaseline(Microsoft.CodeAnalysis.ModuleMetadata! module, System.Func! debugInformationProvider, System.Func! localSignatureProvider, bool hasPortableDebugInformation) -> Microsoft.CodeAnalysis.Emit.EmitBaseline! static Microsoft.CodeAnalysis.Emit.EmitOptions.operator !=(Microsoft.CodeAnalysis.Emit.EmitOptions? left, Microsoft.CodeAnalysis.Emit.EmitOptions? right) -> bool static Microsoft.CodeAnalysis.Emit.EmitOptions.operator ==(Microsoft.CodeAnalysis.Emit.EmitOptions? left, Microsoft.CodeAnalysis.Emit.EmitOptions? right) -> bool @@ -3639,8 +3674,8 @@ static Microsoft.CodeAnalysis.ModuleMetadata.CreateFromFile(string! path) -> Mic static Microsoft.CodeAnalysis.ModuleMetadata.CreateFromImage(nint peImage, int size) -> Microsoft.CodeAnalysis.ModuleMetadata! static Microsoft.CodeAnalysis.ModuleMetadata.CreateFromImage(System.Collections.Generic.IEnumerable! peImage) -> Microsoft.CodeAnalysis.ModuleMetadata! static Microsoft.CodeAnalysis.ModuleMetadata.CreateFromImage(System.Collections.Immutable.ImmutableArray peImage) -> Microsoft.CodeAnalysis.ModuleMetadata! -static Microsoft.CodeAnalysis.ModuleMetadata.CreateFromMetadata(nint metadata, int size) -> Microsoft.CodeAnalysis.ModuleMetadata! static Microsoft.CodeAnalysis.ModuleMetadata.CreateFromMetadata(nint metadata, int size, System.Action! onDispose) -> Microsoft.CodeAnalysis.ModuleMetadata! +static Microsoft.CodeAnalysis.ModuleMetadata.CreateFromMetadata(nint metadata, int size) -> Microsoft.CodeAnalysis.ModuleMetadata! static Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(System.IO.Stream! peStream, bool leaveOpen = false) -> Microsoft.CodeAnalysis.ModuleMetadata! static Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(System.IO.Stream! peStream, System.Reflection.PortableExecutable.PEStreamOptions options) -> Microsoft.CodeAnalysis.ModuleMetadata! static Microsoft.CodeAnalysis.NullableContextExtensions.AnnotationsEnabled(this Microsoft.CodeAnalysis.NullableContext context) -> bool @@ -3669,6 +3704,7 @@ static Microsoft.CodeAnalysis.RuleSet.GetDiagnosticOptionsFromRulesetFile(string static Microsoft.CodeAnalysis.RuleSet.GetEffectiveIncludesFromFile(string! filePath) -> System.Collections.Immutable.ImmutableArray static Microsoft.CodeAnalysis.RuleSet.LoadEffectiveRuleSetFromFile(string! filePath) -> Microsoft.CodeAnalysis.RuleSet! static Microsoft.CodeAnalysis.SarifVersionFacts.TryParse(string! version, out Microsoft.CodeAnalysis.SarifVersion result) -> bool +static Microsoft.CodeAnalysis.SeparatedSyntaxList.Create(System.ReadOnlySpan nodes) -> Microsoft.CodeAnalysis.SeparatedSyntaxList static Microsoft.CodeAnalysis.SeparatedSyntaxList.explicit operator Microsoft.CodeAnalysis.SeparatedSyntaxList(Microsoft.CodeAnalysis.SeparatedSyntaxList nodes) -> Microsoft.CodeAnalysis.SeparatedSyntaxList static Microsoft.CodeAnalysis.SeparatedSyntaxList.implicit operator Microsoft.CodeAnalysis.SeparatedSyntaxList(Microsoft.CodeAnalysis.SeparatedSyntaxList nodes) -> Microsoft.CodeAnalysis.SeparatedSyntaxList static Microsoft.CodeAnalysis.SeparatedSyntaxList.op_Implicit(Microsoft.CodeAnalysis.SeparatedSyntaxList nodes) -> Microsoft.CodeAnalysis.SeparatedSyntaxList @@ -3693,6 +3729,7 @@ static Microsoft.CodeAnalysis.SymbolDisplayFormat.VisualBasicShortErrorMessageFo static Microsoft.CodeAnalysis.SyntaxAnnotation.ElasticAnnotation.get -> Microsoft.CodeAnalysis.SyntaxAnnotation! static Microsoft.CodeAnalysis.SyntaxAnnotation.operator !=(Microsoft.CodeAnalysis.SyntaxAnnotation? left, Microsoft.CodeAnalysis.SyntaxAnnotation? right) -> bool static Microsoft.CodeAnalysis.SyntaxAnnotation.operator ==(Microsoft.CodeAnalysis.SyntaxAnnotation? left, Microsoft.CodeAnalysis.SyntaxAnnotation? right) -> bool +static Microsoft.CodeAnalysis.SyntaxList.Create(System.ReadOnlySpan nodes) -> Microsoft.CodeAnalysis.SyntaxList static Microsoft.CodeAnalysis.SyntaxList.explicit operator Microsoft.CodeAnalysis.SyntaxList(Microsoft.CodeAnalysis.SyntaxList nodes) -> Microsoft.CodeAnalysis.SyntaxList static Microsoft.CodeAnalysis.SyntaxList.implicit operator Microsoft.CodeAnalysis.SyntaxList(Microsoft.CodeAnalysis.SyntaxList nodes) -> Microsoft.CodeAnalysis.SyntaxList static Microsoft.CodeAnalysis.SyntaxList.op_Implicit(Microsoft.CodeAnalysis.SyntaxList nodes) -> Microsoft.CodeAnalysis.SyntaxList @@ -3741,16 +3778,19 @@ static Microsoft.CodeAnalysis.SyntaxNodeOrToken.implicit operator Microsoft.Code static Microsoft.CodeAnalysis.SyntaxNodeOrToken.implicit operator Microsoft.CodeAnalysis.SyntaxNodeOrToken(Microsoft.CodeAnalysis.SyntaxToken token) -> Microsoft.CodeAnalysis.SyntaxNodeOrToken static Microsoft.CodeAnalysis.SyntaxNodeOrToken.operator !=(Microsoft.CodeAnalysis.SyntaxNodeOrToken left, Microsoft.CodeAnalysis.SyntaxNodeOrToken right) -> bool static Microsoft.CodeAnalysis.SyntaxNodeOrToken.operator ==(Microsoft.CodeAnalysis.SyntaxNodeOrToken left, Microsoft.CodeAnalysis.SyntaxNodeOrToken right) -> bool +static Microsoft.CodeAnalysis.SyntaxNodeOrTokenList.Create(System.ReadOnlySpan nodesAndTokens) -> Microsoft.CodeAnalysis.SyntaxNodeOrTokenList static Microsoft.CodeAnalysis.SyntaxNodeOrTokenList.operator !=(Microsoft.CodeAnalysis.SyntaxNodeOrTokenList left, Microsoft.CodeAnalysis.SyntaxNodeOrTokenList right) -> bool static Microsoft.CodeAnalysis.SyntaxNodeOrTokenList.operator ==(Microsoft.CodeAnalysis.SyntaxNodeOrTokenList left, Microsoft.CodeAnalysis.SyntaxNodeOrTokenList right) -> bool static Microsoft.CodeAnalysis.SyntaxToken.operator !=(Microsoft.CodeAnalysis.SyntaxToken left, Microsoft.CodeAnalysis.SyntaxToken right) -> bool static Microsoft.CodeAnalysis.SyntaxToken.operator ==(Microsoft.CodeAnalysis.SyntaxToken left, Microsoft.CodeAnalysis.SyntaxToken right) -> bool static Microsoft.CodeAnalysis.SyntaxTokenList.Create(Microsoft.CodeAnalysis.SyntaxToken token) -> Microsoft.CodeAnalysis.SyntaxTokenList +static Microsoft.CodeAnalysis.SyntaxTokenList.Create(System.ReadOnlySpan tokens) -> Microsoft.CodeAnalysis.SyntaxTokenList static Microsoft.CodeAnalysis.SyntaxTokenList.operator !=(Microsoft.CodeAnalysis.SyntaxTokenList left, Microsoft.CodeAnalysis.SyntaxTokenList right) -> bool static Microsoft.CodeAnalysis.SyntaxTokenList.operator ==(Microsoft.CodeAnalysis.SyntaxTokenList left, Microsoft.CodeAnalysis.SyntaxTokenList right) -> bool static Microsoft.CodeAnalysis.SyntaxTrivia.operator !=(Microsoft.CodeAnalysis.SyntaxTrivia left, Microsoft.CodeAnalysis.SyntaxTrivia right) -> bool static Microsoft.CodeAnalysis.SyntaxTrivia.operator ==(Microsoft.CodeAnalysis.SyntaxTrivia left, Microsoft.CodeAnalysis.SyntaxTrivia right) -> bool static Microsoft.CodeAnalysis.SyntaxTriviaList.Create(Microsoft.CodeAnalysis.SyntaxTrivia trivia) -> Microsoft.CodeAnalysis.SyntaxTriviaList +static Microsoft.CodeAnalysis.SyntaxTriviaList.Create(System.ReadOnlySpan trivias) -> Microsoft.CodeAnalysis.SyntaxTriviaList static Microsoft.CodeAnalysis.SyntaxTriviaList.Empty.get -> Microsoft.CodeAnalysis.SyntaxTriviaList static Microsoft.CodeAnalysis.SyntaxTriviaList.operator !=(Microsoft.CodeAnalysis.SyntaxTriviaList left, Microsoft.CodeAnalysis.SyntaxTriviaList right) -> bool static Microsoft.CodeAnalysis.SyntaxTriviaList.operator ==(Microsoft.CodeAnalysis.SyntaxTriviaList left, Microsoft.CodeAnalysis.SyntaxTriviaList right) -> bool @@ -3792,6 +3832,7 @@ virtual Microsoft.CodeAnalysis.Diagnostic.Properties.get -> System.Collections.I virtual Microsoft.CodeAnalysis.DiagnosticFormatter.Format(Microsoft.CodeAnalysis.Diagnostic! diagnostic, System.IFormatProvider? formatter = null) -> string! virtual Microsoft.CodeAnalysis.Diagnostics.AnalysisContext.ConfigureGeneratedCodeAnalysis(Microsoft.CodeAnalysis.Diagnostics.GeneratedCodeAnalysisFlags analysisMode) -> void virtual Microsoft.CodeAnalysis.Diagnostics.AnalysisContext.EnableConcurrentExecution() -> void +virtual Microsoft.CodeAnalysis.Diagnostics.AnalysisContext.MinimumReportedSeverity.get -> Microsoft.CodeAnalysis.DiagnosticSeverity virtual Microsoft.CodeAnalysis.Diagnostics.AnalysisContext.RegisterAdditionalFileAction(System.Action! action) -> void virtual Microsoft.CodeAnalysis.Diagnostics.AnalysisContext.RegisterOperationAction(System.Action! action, System.Collections.Immutable.ImmutableArray operationKinds) -> void virtual Microsoft.CodeAnalysis.Diagnostics.AnalysisContext.RegisterOperationBlockAction(System.Action! action) -> void @@ -3834,6 +3875,7 @@ virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitCaughtException( virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitCoalesce(Microsoft.CodeAnalysis.Operations.ICoalesceOperation! operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitCoalesceAssignment(Microsoft.CodeAnalysis.Operations.ICoalesceAssignmentOperation! operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitCollectionElementInitializer(Microsoft.CodeAnalysis.Operations.ICollectionElementInitializerOperation! operation) -> void +virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitCollectionExpression(Microsoft.CodeAnalysis.Operations.ICollectionExpressionOperation! operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitCompoundAssignment(Microsoft.CodeAnalysis.Operations.ICompoundAssignmentOperation! operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitConditional(Microsoft.CodeAnalysis.Operations.IConditionalOperation! operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitConditionalAccess(Microsoft.CodeAnalysis.Operations.IConditionalAccessOperation! operation) -> void @@ -3917,6 +3959,7 @@ virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitSimpleAssignment virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitSingleValueCaseClause(Microsoft.CodeAnalysis.Operations.ISingleValueCaseClauseOperation! operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitSizeOf(Microsoft.CodeAnalysis.Operations.ISizeOfOperation! operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitSlicePattern(Microsoft.CodeAnalysis.Operations.ISlicePatternOperation! operation) -> void +virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitSpread(Microsoft.CodeAnalysis.Operations.ISpreadOperation! operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitStaticLocalInitializationSemaphore(Microsoft.CodeAnalysis.FlowAnalysis.IStaticLocalInitializationSemaphoreOperation! operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitStop(Microsoft.CodeAnalysis.Operations.IStopOperation! operation) -> void virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitSwitch(Microsoft.CodeAnalysis.Operations.ISwitchOperation! operation) -> void @@ -3961,6 +4004,7 @@ virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.V virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitCoalesce(Microsoft.CodeAnalysis.Operations.ICoalesceOperation! operation, TArgument argument) -> TResult? virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitCoalesceAssignment(Microsoft.CodeAnalysis.Operations.ICoalesceAssignmentOperation! operation, TArgument argument) -> TResult? virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitCollectionElementInitializer(Microsoft.CodeAnalysis.Operations.ICollectionElementInitializerOperation! operation, TArgument argument) -> TResult? +virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitCollectionExpression(Microsoft.CodeAnalysis.Operations.ICollectionExpressionOperation! operation, TArgument argument) -> TResult? virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitCompoundAssignment(Microsoft.CodeAnalysis.Operations.ICompoundAssignmentOperation! operation, TArgument argument) -> TResult? virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitConditional(Microsoft.CodeAnalysis.Operations.IConditionalOperation! operation, TArgument argument) -> TResult? virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitConditionalAccess(Microsoft.CodeAnalysis.Operations.IConditionalAccessOperation! operation, TArgument argument) -> TResult? @@ -4044,6 +4088,7 @@ virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.V virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitSingleValueCaseClause(Microsoft.CodeAnalysis.Operations.ISingleValueCaseClauseOperation! operation, TArgument argument) -> TResult? virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitSizeOf(Microsoft.CodeAnalysis.Operations.ISizeOfOperation! operation, TArgument argument) -> TResult? virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitSlicePattern(Microsoft.CodeAnalysis.Operations.ISlicePatternOperation! operation, TArgument argument) -> TResult? +virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitSpread(Microsoft.CodeAnalysis.Operations.ISpreadOperation! operation, TArgument argument) -> TResult? virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitStaticLocalInitializationSemaphore(Microsoft.CodeAnalysis.FlowAnalysis.IStaticLocalInitializationSemaphoreOperation! operation, TArgument argument) -> TResult? virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitStop(Microsoft.CodeAnalysis.Operations.IStopOperation! operation, TArgument argument) -> TResult? virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitSwitch(Microsoft.CodeAnalysis.Operations.ISwitchOperation! operation, TArgument argument) -> TResult? @@ -4135,11 +4180,13 @@ virtual Microsoft.CodeAnalysis.SymbolVisitor.VisitPointerType(Microsoft virtual Microsoft.CodeAnalysis.SymbolVisitor.VisitProperty(Microsoft.CodeAnalysis.IPropertySymbol! symbol) -> TResult? virtual Microsoft.CodeAnalysis.SymbolVisitor.VisitRangeVariable(Microsoft.CodeAnalysis.IRangeVariableSymbol! symbol) -> TResult? virtual Microsoft.CodeAnalysis.SymbolVisitor.VisitTypeParameter(Microsoft.CodeAnalysis.ITypeParameterSymbol! symbol) -> TResult? +virtual Microsoft.CodeAnalysis.SyntaxContextReceiverCreator.Invoke() -> Microsoft.CodeAnalysis.ISyntaxContextReceiver? virtual Microsoft.CodeAnalysis.SyntaxNode.ChildThatContainsPosition(int position) -> Microsoft.CodeAnalysis.SyntaxNodeOrToken virtual Microsoft.CodeAnalysis.SyntaxNode.ParentTrivia.get -> Microsoft.CodeAnalysis.SyntaxTrivia virtual Microsoft.CodeAnalysis.SyntaxNode.SerializeTo(System.IO.Stream! stream, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> void virtual Microsoft.CodeAnalysis.SyntaxNode.ToFullString() -> string! virtual Microsoft.CodeAnalysis.SyntaxNode.WriteTo(System.IO.TextWriter! writer) -> void +virtual Microsoft.CodeAnalysis.SyntaxReceiverCreator.Invoke() -> Microsoft.CodeAnalysis.ISyntaxReceiver! virtual Microsoft.CodeAnalysis.SyntaxReference.GetSyntaxAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task! virtual Microsoft.CodeAnalysis.SyntaxTree.DiagnosticOptions.get -> System.Collections.Immutable.ImmutableDictionary! virtual Microsoft.CodeAnalysis.SyntaxTree.GetLineVisibility(int position, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.LineVisibility diff --git a/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt b/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt index e5fe82d74f013..8b137891791fe 100644 --- a/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt +++ b/src/Compilers/Core/Portable/PublicAPI.Unshipped.txt @@ -1,59 +1 @@ -Microsoft.CodeAnalysis.IParameterSymbol.IsParamsCollection.get -> bool -Microsoft.CodeAnalysis.IParameterSymbol.IsParamsArray.get -> bool -Microsoft.CodeAnalysis.Operations.ArgumentKind.ParamCollection = 4 -> Microsoft.CodeAnalysis.Operations.ArgumentKind -Microsoft.CodeAnalysis.Diagnostics.SuppressionInfo.ProgrammaticSuppressions.get -> System.Collections.Immutable.ImmutableArray -Microsoft.CodeAnalysis.Emit.InstrumentationKind.ModuleCancellation = 3 -> Microsoft.CodeAnalysis.Emit.InstrumentationKind -Microsoft.CodeAnalysis.Emit.InstrumentationKind.StackOverflowProbing = 2 -> Microsoft.CodeAnalysis.Emit.InstrumentationKind -Microsoft.CodeAnalysis.OperationKind.CollectionExpression = 127 -> Microsoft.CodeAnalysis.OperationKind -Microsoft.CodeAnalysis.OperationKind.Spread = 128 -> Microsoft.CodeAnalysis.OperationKind -Microsoft.CodeAnalysis.Operations.ICollectionExpressionOperation.ConstructMethod.get -> Microsoft.CodeAnalysis.IMethodSymbol? -Microsoft.CodeAnalysis.Operations.ICollectionExpressionOperation -Microsoft.CodeAnalysis.Operations.ICollectionExpressionOperation.Elements.get -> System.Collections.Immutable.ImmutableArray -Microsoft.CodeAnalysis.Operations.ISpreadOperation -Microsoft.CodeAnalysis.Operations.ISpreadOperation.ElementConversion.get -> Microsoft.CodeAnalysis.Operations.CommonConversion -Microsoft.CodeAnalysis.Operations.ISpreadOperation.ElementType.get -> Microsoft.CodeAnalysis.ITypeSymbol? -Microsoft.CodeAnalysis.Operations.ISpreadOperation.Operand.get -> Microsoft.CodeAnalysis.IOperation! -Microsoft.CodeAnalysis.SeparatedSyntaxList -Microsoft.CodeAnalysis.SyntaxList -static Microsoft.CodeAnalysis.SeparatedSyntaxList.Create(System.ReadOnlySpan nodes) -> Microsoft.CodeAnalysis.SeparatedSyntaxList -static Microsoft.CodeAnalysis.SyntaxList.Create(System.ReadOnlySpan nodes) -> Microsoft.CodeAnalysis.SyntaxList -static Microsoft.CodeAnalysis.SyntaxNodeOrTokenList.Create(System.ReadOnlySpan nodesAndTokens) -> Microsoft.CodeAnalysis.SyntaxNodeOrTokenList -static Microsoft.CodeAnalysis.SyntaxTokenList.Create(System.ReadOnlySpan tokens) -> Microsoft.CodeAnalysis.SyntaxTokenList -static Microsoft.CodeAnalysis.SyntaxTriviaList.Create(System.ReadOnlySpan trivias) -> Microsoft.CodeAnalysis.SyntaxTriviaList -virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitCollectionExpression(Microsoft.CodeAnalysis.Operations.ICollectionExpressionOperation! operation) -> void -virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitSpread(Microsoft.CodeAnalysis.Operations.ISpreadOperation! operation) -> void -virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitCollectionExpression(Microsoft.CodeAnalysis.Operations.ICollectionExpressionOperation! operation, TArgument argument) -> TResult? -virtual Microsoft.CodeAnalysis.Operations.OperationVisitor.VisitSpread(Microsoft.CodeAnalysis.Operations.ISpreadOperation! operation, TArgument argument) -> TResult? -*REMOVED*static Microsoft.CodeAnalysis.SeparatedSyntaxList.implicit operator Microsoft.CodeAnalysis.SeparatedSyntaxList(Microsoft.CodeAnalysis.SeparatedSyntaxList nodes) -> Microsoft.CodeAnalysis.SeparatedSyntaxList -*REMOVED*static Microsoft.CodeAnalysis.SyntaxList.implicit operator Microsoft.CodeAnalysis.SyntaxList(Microsoft.CodeAnalysis.SyntaxList nodes) -> Microsoft.CodeAnalysis.SyntaxList -*REMOVED*Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAllDiagnosticsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task>! -*REMOVED*Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAnalyzerDiagnosticsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task>! -*REMOVED*static Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerExtensions.WithAnalyzers(this Microsoft.CodeAnalysis.Compilation! compilation, System.Collections.Immutable.ImmutableArray analyzers, Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions? options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers! -const Microsoft.CodeAnalysis.WellKnownDiagnosticTags.CustomSeverityConfigurable = "CustomSeverityConfigurable" -> string! -Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.CompilationWithAnalyzers(Microsoft.CodeAnalysis.Compilation! compilation, System.Collections.Immutable.ImmutableArray analyzers, Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions? options) -> void -Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAllDiagnosticsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task>! -Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers.GetAnalyzerDiagnosticsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task>! -*REMOVED*Microsoft.CodeAnalysis.Emit.SemanticEdit.SemanticEdit(Microsoft.CodeAnalysis.Emit.SemanticEditKind kind, Microsoft.CodeAnalysis.ISymbol? oldSymbol, Microsoft.CodeAnalysis.ISymbol? newSymbol, System.Func? syntaxMap = null, bool preserveLocalVariables = false, Microsoft.CodeAnalysis.Emit.MethodInstrumentation instrumentation = default(Microsoft.CodeAnalysis.Emit.MethodInstrumentation)) -> void -Microsoft.CodeAnalysis.Emit.RuntimeRudeEdit -Microsoft.CodeAnalysis.Emit.RuntimeRudeEdit.Message.get -> string! -Microsoft.CodeAnalysis.Emit.RuntimeRudeEdit.RuntimeRudeEdit() -> void -Microsoft.CodeAnalysis.Emit.RuntimeRudeEdit.RuntimeRudeEdit(string! message) -> void -Microsoft.CodeAnalysis.Emit.SemanticEdit.RuntimeRudeEdit.get -> System.Func? -Microsoft.CodeAnalysis.Emit.SemanticEdit.SemanticEdit(Microsoft.CodeAnalysis.Emit.SemanticEditKind kind, Microsoft.CodeAnalysis.ISymbol? oldSymbol, Microsoft.CodeAnalysis.ISymbol? newSymbol, System.Func? syntaxMap = null, System.Func? runtimeRudeEdit = null, Microsoft.CodeAnalysis.Emit.MethodInstrumentation instrumentation = default(Microsoft.CodeAnalysis.Emit.MethodInstrumentation)) -> void -Microsoft.CodeAnalysis.Emit.SemanticEdit.SemanticEdit(Microsoft.CodeAnalysis.Emit.SemanticEditKind kind, Microsoft.CodeAnalysis.ISymbol? oldSymbol, Microsoft.CodeAnalysis.ISymbol? newSymbol, System.Func? syntaxMap, bool preserveLocalVariables, Microsoft.CodeAnalysis.Emit.MethodInstrumentation instrumentation) -> void -Microsoft.CodeAnalysis.Text.SourceText.GetContentHash() -> System.Collections.Immutable.ImmutableArray -static Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerExtensions.WithAnalyzers(this Microsoft.CodeAnalysis.Compilation! compilation, System.Collections.Immutable.ImmutableArray analyzers, Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions? options = null) -> Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers! -static Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzerExtensions.WithAnalyzers(this Microsoft.CodeAnalysis.Compilation! compilation, System.Collections.Immutable.ImmutableArray analyzers, Microsoft.CodeAnalysis.Diagnostics.AnalyzerOptions? options, System.Threading.CancellationToken cancellationToken) -> Microsoft.CodeAnalysis.Diagnostics.CompilationWithAnalyzers! -Microsoft.CodeAnalysis.RefKind.RefReadOnlyParameter = 4 -> Microsoft.CodeAnalysis.RefKind -virtual Microsoft.CodeAnalysis.Diagnostics.AnalysisContext.MinimumReportedSeverity.get -> Microsoft.CodeAnalysis.DiagnosticSeverity -static Microsoft.CodeAnalysis.Emit.EmitBaseline.CreateInitialBaseline(Microsoft.CodeAnalysis.Compilation! compilation, Microsoft.CodeAnalysis.ModuleMetadata! module, System.Func! debugInformationProvider, System.Func! localSignatureProvider, bool hasPortableDebugInformation) -> Microsoft.CodeAnalysis.Emit.EmitBaseline! -virtual Microsoft.CodeAnalysis.SyntaxContextReceiverCreator.Invoke() -> Microsoft.CodeAnalysis.ISyntaxContextReceiver? -virtual Microsoft.CodeAnalysis.SyntaxReceiverCreator.Invoke() -> Microsoft.CodeAnalysis.ISyntaxReceiver! -static Microsoft.CodeAnalysis.DocumentationCommentId.CreateDeclarationId(Microsoft.CodeAnalysis.ISymbol! symbol) -> string? -*REMOVED*static Microsoft.CodeAnalysis.DocumentationCommentId.CreateDeclarationId(Microsoft.CodeAnalysis.ISymbol! symbol) -> string! -[RSEXPERIMENTAL001]Microsoft.CodeAnalysis.SemanticModelOptions -[RSEXPERIMENTAL001]Microsoft.CodeAnalysis.SemanticModelOptions.None = 0 -> Microsoft.CodeAnalysis.SemanticModelOptions -[RSEXPERIMENTAL001]Microsoft.CodeAnalysis.SemanticModelOptions.IgnoreAccessibility = 1 -> Microsoft.CodeAnalysis.SemanticModelOptions -[RSEXPERIMENTAL001]Microsoft.CodeAnalysis.SemanticModelOptions.DisableNullableAnalysis = 2 -> Microsoft.CodeAnalysis.SemanticModelOptions -[RSEXPERIMENTAL001]Microsoft.CodeAnalysis.Compilation.GetSemanticModel(Microsoft.CodeAnalysis.SyntaxTree! syntaxTree, Microsoft.CodeAnalysis.SemanticModelOptions options) -> Microsoft.CodeAnalysis.SemanticModel! -abstract Microsoft.CodeAnalysis.SemanticModel.NullableAnalysisIsDisabled.get -> bool + diff --git a/src/Compilers/VisualBasic/Test/Semantic/HasValidFonts.vb b/src/Compilers/VisualBasic/Test/Semantic/HasValidFonts.vb index d784b33b2c560..62b3620a935a1 100644 --- a/src/Compilers/VisualBasic/Test/Semantic/HasValidFonts.vb +++ b/src/Compilers/VisualBasic/Test/Semantic/HasValidFonts.vb @@ -13,7 +13,9 @@ Friend Class HasValidFonts Get Try If RuntimeInformation.IsOSPlatform(OSPlatform.Windows) Then +#Disable Warning CA1416 ' Validate platform compatibility, we don't run tests on Windows < 6.1 Dim result = SystemFonts.DefaultFont +#Enable Warning CA1416 ' Validate platform compatibility Return result Is Nothing Else ' The only tests using fonts are Windows-only. diff --git a/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs b/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs index 1bbb94b3add03..1b3caba887859 100644 --- a/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs +++ b/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs @@ -33,7 +33,10 @@ internal abstract partial class AbstractInProcLanguageClient( AbstractLanguageClientMiddleLayer? middleLayer = null) : ILanguageClient, ILanguageServerFactory, ICapabilitiesProvider, ILanguageClientCustomMessage2 { private readonly IThreadingContext _threadingContext = threadingContext; + // https://github.com/dotnet/roslyn/issues/73626 tracks removal +#pragma warning disable CS0618 // Type or member is obsolete private readonly ILanguageClientMiddleLayer? _middleLayer = middleLayer; +#pragma warning restore CS0618 // Type or member is obsolete private readonly ILspServiceLoggerFactory _lspLoggerFactory = lspLoggerFactory; private readonly ExportProvider _exportProvider = exportProvider; diff --git a/src/EditorFeatures/Core/LanguageServer/AbstractLanguageClientMiddleLayer.cs b/src/EditorFeatures/Core/LanguageServer/AbstractLanguageClientMiddleLayer.cs index e7c26c5b245b0..c8ca2a2479681 100644 --- a/src/EditorFeatures/Core/LanguageServer/AbstractLanguageClientMiddleLayer.cs +++ b/src/EditorFeatures/Core/LanguageServer/AbstractLanguageClientMiddleLayer.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// 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. @@ -9,11 +9,14 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.LanguageClient; +// https://github.com/dotnet/roslyn/issues/73626 tracks removal +#pragma warning disable CS0618 // Type or member is obsolete internal abstract class AbstractLanguageClientMiddleLayer : ILanguageClientMiddleLayer +#pragma warning restore CS0618 // Type or member is obsolete { public abstract bool CanHandle(string methodName); public abstract Task HandleNotificationAsync(string methodName, JToken methodParam, Func sendNotification); public abstract Task HandleRequestAsync(string methodName, JToken methodParam, Func> sendRequest); -} \ No newline at end of file +} diff --git a/src/Features/Core/Portable/PublicAPI.Shipped.txt b/src/Features/Core/Portable/PublicAPI.Shipped.txt index c1a4928fee832..f1443c698b655 100644 --- a/src/Features/Core/Portable/PublicAPI.Shipped.txt +++ b/src/Features/Core/Portable/PublicAPI.Shipped.txt @@ -230,6 +230,7 @@ Microsoft.CodeAnalysis.QuickInfo.QuickInfoSectionKinds Microsoft.CodeAnalysis.QuickInfo.QuickInfoService Microsoft.CodeAnalysis.QuickInfo.QuickInfoService.GetQuickInfoAsync(Microsoft.CodeAnalysis.Document document, int position, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task Microsoft.CodeAnalysis.TaggedText +Microsoft.CodeAnalysis.TaggedText.Equals(Microsoft.CodeAnalysis.TaggedText other) -> bool Microsoft.CodeAnalysis.TaggedText.Tag.get -> string Microsoft.CodeAnalysis.TaggedText.TaggedText() -> void Microsoft.CodeAnalysis.TaggedText.TaggedText(string tag, string text) -> void @@ -237,6 +238,8 @@ Microsoft.CodeAnalysis.TaggedText.Text.get -> string Microsoft.CodeAnalysis.TextTags override Microsoft.CodeAnalysis.CodeActions.DocumentNavigationOperation.Apply(Microsoft.CodeAnalysis.Workspace workspace, System.Threading.CancellationToken cancellationToken) -> void override Microsoft.CodeAnalysis.Completion.CompletionItem.ToString() -> string +override Microsoft.CodeAnalysis.TaggedText.Equals(object obj) -> bool +override Microsoft.CodeAnalysis.TaggedText.GetHashCode() -> int override Microsoft.CodeAnalysis.TaggedText.ToString() -> string static Microsoft.CodeAnalysis.Completion.CharacterSetModificationRule.Create(Microsoft.CodeAnalysis.Completion.CharacterSetModificationKind kind, params char[] characters) -> Microsoft.CodeAnalysis.Completion.CharacterSetModificationRule static Microsoft.CodeAnalysis.Completion.CharacterSetModificationRule.Create(Microsoft.CodeAnalysis.Completion.CharacterSetModificationKind kind, System.Collections.Immutable.ImmutableArray characters) -> Microsoft.CodeAnalysis.Completion.CharacterSetModificationRule @@ -262,6 +265,8 @@ static Microsoft.CodeAnalysis.Completion.CompletionTrigger.CreateInsertionTrigge static Microsoft.CodeAnalysis.QuickInfo.QuickInfoItem.Create(Microsoft.CodeAnalysis.Text.TextSpan span, System.Collections.Immutable.ImmutableArray tags = default(System.Collections.Immutable.ImmutableArray), System.Collections.Immutable.ImmutableArray sections = default(System.Collections.Immutable.ImmutableArray), System.Collections.Immutable.ImmutableArray relatedSpans = default(System.Collections.Immutable.ImmutableArray)) -> Microsoft.CodeAnalysis.QuickInfo.QuickInfoItem static Microsoft.CodeAnalysis.QuickInfo.QuickInfoSection.Create(string kind, System.Collections.Immutable.ImmutableArray taggedParts) -> Microsoft.CodeAnalysis.QuickInfo.QuickInfoSection static Microsoft.CodeAnalysis.QuickInfo.QuickInfoService.GetService(Microsoft.CodeAnalysis.Document document) -> Microsoft.CodeAnalysis.QuickInfo.QuickInfoService +static Microsoft.CodeAnalysis.TaggedText.operator !=(Microsoft.CodeAnalysis.TaggedText left, Microsoft.CodeAnalysis.TaggedText right) -> bool +static Microsoft.CodeAnalysis.TaggedText.operator ==(Microsoft.CodeAnalysis.TaggedText left, Microsoft.CodeAnalysis.TaggedText right) -> bool static readonly Microsoft.CodeAnalysis.Completion.CompletionDescription.Empty -> Microsoft.CodeAnalysis.Completion.CompletionDescription static readonly Microsoft.CodeAnalysis.Completion.CompletionList.Empty -> Microsoft.CodeAnalysis.Completion.CompletionList static readonly Microsoft.CodeAnalysis.Completion.CompletionRules.Default -> Microsoft.CodeAnalysis.Completion.CompletionRules diff --git a/src/Features/Core/Portable/PublicAPI.Unshipped.txt b/src/Features/Core/Portable/PublicAPI.Unshipped.txt index 5177098e215f3..8b137891791fe 100644 --- a/src/Features/Core/Portable/PublicAPI.Unshipped.txt +++ b/src/Features/Core/Portable/PublicAPI.Unshipped.txt @@ -1,5 +1 @@ -Microsoft.CodeAnalysis.TaggedText.Equals(Microsoft.CodeAnalysis.TaggedText other) -> bool -override Microsoft.CodeAnalysis.TaggedText.Equals(object obj) -> bool -override Microsoft.CodeAnalysis.TaggedText.GetHashCode() -> int -static Microsoft.CodeAnalysis.TaggedText.operator !=(Microsoft.CodeAnalysis.TaggedText left, Microsoft.CodeAnalysis.TaggedText right) -> bool -static Microsoft.CodeAnalysis.TaggedText.operator ==(Microsoft.CodeAnalysis.TaggedText left, Microsoft.CodeAnalysis.TaggedText right) -> bool + diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/TelemetryReporterTests.cs b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/TelemetryReporterTests.cs index 25f175456269d..18ae7694a345c 100644 --- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/TelemetryReporterTests.cs +++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.UnitTests/TelemetryReporterTests.cs @@ -20,6 +20,9 @@ private async Task CreateReporterAsync() { var exportProvider = await LanguageServerTestComposition.CreateExportProviderAsync(TestOutputLogger.Factory, includeDevKitComponents: true, out var _); + // VS Telemetry requires this environment variable to be set. + Environment.SetEnvironmentVariable("CommonPropertyBagPath", Path.GetTempFileName()); + var reporter = exportProvider.GetExport().Value; Assert.NotNull(reporter); diff --git a/src/Scripting/Core/PublicAPI.Shipped.txt b/src/Scripting/Core/PublicAPI.Shipped.txt index 8668ebd32463a..a4d40dec208b3 100644 --- a/src/Scripting/Core/PublicAPI.Shipped.txt +++ b/src/Scripting/Core/PublicAPI.Shipped.txt @@ -160,3 +160,4 @@ static Microsoft.CodeAnalysis.Scripting.ScriptMetadataResolver.Default.get -> Mi static Microsoft.CodeAnalysis.Scripting.ScriptOptions.Default.get -> Microsoft.CodeAnalysis.Scripting.ScriptOptions static Microsoft.CodeAnalysis.Scripting.ScriptSourceResolver.Default.get -> Microsoft.CodeAnalysis.Scripting.ScriptSourceResolver virtual Microsoft.CodeAnalysis.Scripting.Hosting.PrintOptions.IsValidRadix(int radix) -> bool +virtual Microsoft.CodeAnalysis.Scripting.ScriptRunner.Invoke(object globals = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task diff --git a/src/Scripting/Core/PublicAPI.Unshipped.txt b/src/Scripting/Core/PublicAPI.Unshipped.txt index f79fe5ad87c59..8b137891791fe 100644 --- a/src/Scripting/Core/PublicAPI.Unshipped.txt +++ b/src/Scripting/Core/PublicAPI.Unshipped.txt @@ -1 +1 @@ -virtual Microsoft.CodeAnalysis.Scripting.ScriptRunner.Invoke(object globals = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task + diff --git a/src/VisualStudio/Core/Def/Progression/GraphBuilder.cs b/src/VisualStudio/Core/Def/Progression/GraphBuilder.cs index 6c89df41dd905..8844c23386857 100644 --- a/src/VisualStudio/Core/Def/Progression/GraphBuilder.cs +++ b/src/VisualStudio/Core/Def/Progression/GraphBuilder.cs @@ -26,7 +26,10 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.Progression; internal sealed partial class GraphBuilder { private readonly Graph _graph = new(); + // Our usage of SemaphoreSlim is fine. We don't perform blocking waits for it on the UI thread. +#pragma warning disable RS0030 // Do not use banned APIs private readonly SemaphoreSlim _gate = new(initialCount: 1); +#pragma warning restore RS0030 // Do not use banned APIs private readonly ISet _createdNodes = new HashSet(); private readonly IList> _deferredPropertySets = new List>(); diff --git a/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.cs b/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.cs index d8fe391bae6ff..2edbc7986c0bc 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioWorkspaceImpl.cs @@ -74,7 +74,10 @@ internal abstract partial class VisualStudioWorkspaceImpl : VisualStudioWorkspac /// /// Guards any updates to the maps here that aren't updated via interlocked updates. /// + // Our usage of SemaphoreSlim is fine. We don't perform blocking waits for it on the UI thread. +#pragma warning disable RS0030 // Do not use banned APIs private readonly SemaphoreSlim _gate = new SemaphoreSlim(initialCount: 1); +#pragma warning restore RS0030 // Do not use banned APIs /// /// A to make assertions that stuff is on the right thread. diff --git a/src/VisualStudio/Core/Def/SymbolSearch/VisualStudioSymbolSearchService.cs b/src/VisualStudio/Core/Def/SymbolSearch/VisualStudioSymbolSearchService.cs index a658f1d2e748b..4996add1ee1ea 100644 --- a/src/VisualStudio/Core/Def/SymbolSearch/VisualStudioSymbolSearchService.cs +++ b/src/VisualStudio/Core/Def/SymbolSearch/VisualStudioSymbolSearchService.cs @@ -42,7 +42,10 @@ namespace Microsoft.VisualStudio.LanguageServices.SymbolSearch; [ExportWorkspaceService(typeof(ISymbolSearchService), ServiceLayer.Host), Shared] internal partial class VisualStudioSymbolSearchService : AbstractDelayStartedService, ISymbolSearchService { + // Our usage of SemaphoreSlim is fine. We don't perform blocking waits for it on the UI thread. +#pragma warning disable RS0030 // Do not use banned APIs private readonly SemaphoreSlim _gate = new(initialCount: 1); +#pragma warning restore RS0030 // Do not use banned APIs // Note: A remote engine is disposable as it maintains a connection with ServiceHub, // but we want to keep it alive until the VS is closed, so we don't dispose it. diff --git a/src/VisualStudio/LiveShare/Impl/Client/RemoteLanguageServiceWorkspace.cs b/src/VisualStudio/LiveShare/Impl/Client/RemoteLanguageServiceWorkspace.cs index ef96a72e3debb..937bd05f5cb57 100644 --- a/src/VisualStudio/LiveShare/Impl/Client/RemoteLanguageServiceWorkspace.cs +++ b/src/VisualStudio/LiveShare/Impl/Client/RemoteLanguageServiceWorkspace.cs @@ -44,7 +44,10 @@ internal sealed class RemoteLanguageServiceWorkspace : CodeAnalysis.Workspace, I /// Gate to make sure we only update the paths and trigger RDT one at a time. /// Guards and /// + // Our usage of SemaphoreSlim is fine. We don't perform blocking waits for it on the UI thread. +#pragma warning disable RS0030 // Do not use banned APIs private static readonly SemaphoreSlim s_RemotePathsGate = new SemaphoreSlim(initialCount: 1); +#pragma warning restore RS0030 // Do not use banned APIs private readonly IServiceProvider _serviceProvider; private readonly IThreadingContext _threadingContext; diff --git a/src/Workspaces/Core/Portable/PublicAPI.Shipped.txt b/src/Workspaces/Core/Portable/PublicAPI.Shipped.txt index 1dbdce17d2e70..1c3695ccc2456 100644 --- a/src/Workspaces/Core/Portable/PublicAPI.Shipped.txt +++ b/src/Workspaces/Core/Portable/PublicAPI.Shipped.txt @@ -1,5 +1,4 @@ abstract Microsoft.CodeAnalysis.CodeActions.CodeAction.Title.get -> string -abstract Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions.ComputeOperationsAsync(object options, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task> abstract Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions.GetOptions(System.Threading.CancellationToken cancellationToken) -> object abstract Microsoft.CodeAnalysis.CodeActions.PreviewOperation.GetPreviewAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task abstract Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider.FixableDiagnosticIds.get -> System.Collections.Immutable.ImmutableArray @@ -120,7 +119,6 @@ abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ReferenceEqualsExpressio abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ReferenceNotEqualsExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.RemoveEventHandler(Microsoft.CodeAnalysis.SyntaxNode event, Microsoft.CodeAnalysis.SyntaxNode handler) -> Microsoft.CodeAnalysis.SyntaxNode abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ReturnStatement(Microsoft.CodeAnalysis.SyntaxNode expression = null) -> Microsoft.CodeAnalysis.SyntaxNode -abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SetAccessorDeclaration(Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, System.Collections.Generic.IEnumerable statements = null) -> Microsoft.CodeAnalysis.SyntaxNode abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SubtractExpression(Microsoft.CodeAnalysis.SyntaxNode left, Microsoft.CodeAnalysis.SyntaxNode right) -> Microsoft.CodeAnalysis.SyntaxNode abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SwitchSection(System.Collections.Generic.IEnumerable caseExpressions, System.Collections.Generic.IEnumerable statements) -> Microsoft.CodeAnalysis.SyntaxNode abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SwitchStatement(Microsoft.CodeAnalysis.SyntaxNode expression, System.Collections.Generic.IEnumerable sections) -> Microsoft.CodeAnalysis.SyntaxNode @@ -153,7 +151,6 @@ abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithSetAccessorStatement abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithStatements(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable statements) -> Microsoft.CodeAnalysis.SyntaxNode abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithType(Microsoft.CodeAnalysis.SyntaxNode declaration, Microsoft.CodeAnalysis.SyntaxNode type) -> Microsoft.CodeAnalysis.SyntaxNode abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeArguments(Microsoft.CodeAnalysis.SyntaxNode expression, System.Collections.Generic.IEnumerable typeArguments) -> Microsoft.CodeAnalysis.SyntaxNode -abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeConstraint(Microsoft.CodeAnalysis.SyntaxNode declaration, string typeParameterName, Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind kinds, System.Collections.Generic.IEnumerable types = null) -> Microsoft.CodeAnalysis.SyntaxNode abstract Microsoft.CodeAnalysis.Host.HostLanguageServices.GetService() -> TLanguageService abstract Microsoft.CodeAnalysis.Host.HostLanguageServices.Language.get -> string abstract Microsoft.CodeAnalysis.Host.HostLanguageServices.WorkspaceServices.get -> Microsoft.CodeAnalysis.Host.HostWorkspaceServices @@ -328,12 +325,24 @@ Microsoft.CodeAnalysis.CodeActions.ApplyChangesOperation.ApplyChangesOperation(M Microsoft.CodeAnalysis.CodeActions.ApplyChangesOperation.ChangedSolution.get -> Microsoft.CodeAnalysis.Solution Microsoft.CodeAnalysis.CodeActions.CodeAction Microsoft.CodeAnalysis.CodeActions.CodeAction.CodeAction() -> void +Microsoft.CodeAnalysis.CodeActions.CodeAction.GetOperationsAsync(Microsoft.CodeAnalysis.Solution originalSolution, System.IProgress progress, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task> Microsoft.CodeAnalysis.CodeActions.CodeAction.GetOperationsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task> Microsoft.CodeAnalysis.CodeActions.CodeAction.GetPreviewOperationsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task> Microsoft.CodeAnalysis.CodeActions.CodeAction.PostProcessAsync(System.Collections.Generic.IEnumerable operations, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task> Microsoft.CodeAnalysis.CodeActions.CodeAction.PostProcessChangesAsync(Microsoft.CodeAnalysis.Solution changedSolution, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +Microsoft.CodeAnalysis.CodeActions.CodeAction.Priority.get -> Microsoft.CodeAnalysis.CodeActions.CodeActionPriority Microsoft.CodeAnalysis.CodeActions.CodeActionOperation Microsoft.CodeAnalysis.CodeActions.CodeActionOperation.CodeActionOperation() -> void +Microsoft.CodeAnalysis.CodeActions.CodeActionPriority +Microsoft.CodeAnalysis.CodeActions.CodeActionPriority.Default = 2 -> Microsoft.CodeAnalysis.CodeActions.CodeActionPriority +Microsoft.CodeAnalysis.CodeActions.CodeActionPriority.High = 3 -> Microsoft.CodeAnalysis.CodeActions.CodeActionPriority +Microsoft.CodeAnalysis.CodeActions.CodeActionPriority.Low = 1 -> Microsoft.CodeAnalysis.CodeActions.CodeActionPriority +Microsoft.CodeAnalysis.CodeActions.CodeActionPriority.Lowest = 0 -> Microsoft.CodeAnalysis.CodeActions.CodeActionPriority +Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority +Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority.Default = 3 -> Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority +Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority.High = 4 -> Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority +Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority.Low = 2 -> Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority +Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority.Lowest = 1 -> Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions.CodeActionWithOptions() -> void Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions.GetOperationsAsync(object options, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task> @@ -345,6 +354,8 @@ Microsoft.CodeAnalysis.CodeActions.PreviewOperation Microsoft.CodeAnalysis.CodeActions.PreviewOperation.PreviewOperation() -> void Microsoft.CodeAnalysis.CodeActions.RenameAnnotation Microsoft.CodeAnalysis.CodeActions.WarningAnnotation +Microsoft.CodeAnalysis.CodeAnalysisProgress +Microsoft.CodeAnalysis.CodeAnalysisProgress.CodeAnalysisProgress() -> void Microsoft.CodeAnalysis.CodeFixes.CodeFixContext Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.CancellationToken.get -> System.Threading.CancellationToken Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.CodeFixContext() -> void @@ -361,6 +372,7 @@ Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.Span.get -> Microsoft.CodeAnalys Microsoft.CodeAnalysis.CodeFixes.CodeFixContext.TextDocument.get -> Microsoft.CodeAnalysis.TextDocument Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider.CodeFixProvider() -> void +Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider.RequestPriority.get -> Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority Microsoft.CodeAnalysis.CodeFixes.DocumentBasedFixAllProvider Microsoft.CodeAnalysis.CodeFixes.DocumentBasedFixAllProvider.DocumentBasedFixAllProvider() -> void Microsoft.CodeAnalysis.CodeFixes.DocumentBasedFixAllProvider.DocumentBasedFixAllProvider(System.Collections.Immutable.ImmutableArray supportedFixAllScopes) -> void @@ -387,6 +399,7 @@ Microsoft.CodeAnalysis.CodeFixes.FixAllContext.FixAllContext(Microsoft.CodeAnaly Microsoft.CodeAnalysis.CodeFixes.FixAllContext.GetAllDiagnosticsAsync(Microsoft.CodeAnalysis.Project project) -> System.Threading.Tasks.Task> Microsoft.CodeAnalysis.CodeFixes.FixAllContext.GetDocumentDiagnosticsAsync(Microsoft.CodeAnalysis.Document document) -> System.Threading.Tasks.Task> Microsoft.CodeAnalysis.CodeFixes.FixAllContext.GetProjectDiagnosticsAsync(Microsoft.CodeAnalysis.Project project) -> System.Threading.Tasks.Task> +Microsoft.CodeAnalysis.CodeFixes.FixAllContext.Progress.get -> System.IProgress Microsoft.CodeAnalysis.CodeFixes.FixAllContext.Project.get -> Microsoft.CodeAnalysis.Project Microsoft.CodeAnalysis.CodeFixes.FixAllContext.Scope.get -> Microsoft.CodeAnalysis.CodeFixes.FixAllScope Microsoft.CodeAnalysis.CodeFixes.FixAllContext.Solution.get -> Microsoft.CodeAnalysis.Solution @@ -412,6 +425,7 @@ Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringContext.Span.get -> Micro Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringContext.TextDocument.get -> Microsoft.CodeAnalysis.TextDocument Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringProvider Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringProvider.CodeRefactoringProvider() -> void +Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringProvider.RequestPriority.get -> Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority Microsoft.CodeAnalysis.CodeRefactorings.ExportCodeRefactoringProviderAttribute Microsoft.CodeAnalysis.CodeRefactorings.ExportCodeRefactoringProviderAttribute.DocumentExtensions.get -> string[] Microsoft.CodeAnalysis.CodeRefactorings.ExportCodeRefactoringProviderAttribute.DocumentExtensions.set -> void @@ -558,7 +572,7 @@ Microsoft.CodeAnalysis.Editing.DeclarationKind.Struct = 3 -> Microsoft.CodeAnaly Microsoft.CodeAnalysis.Editing.DeclarationKind.Variable = 21 -> Microsoft.CodeAnalysis.Editing.DeclarationKind Microsoft.CodeAnalysis.Editing.DeclarationModifiers Microsoft.CodeAnalysis.Editing.DeclarationModifiers.DeclarationModifiers() -> void -Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Equals(Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers) -> bool +Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Equals(Microsoft.CodeAnalysis.Editing.DeclarationModifiers other) -> bool Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsAbstract.get -> bool Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsAsync.get -> bool Microsoft.CodeAnalysis.Editing.DeclarationModifiers.IsConst.get -> bool @@ -747,6 +761,7 @@ Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ParameterDeclaration(string name, Microsoft.CodeAnalysis.Editing.SyntaxGenerator.PropertyDeclaration(Microsoft.CodeAnalysis.IPropertySymbol property, System.Collections.Generic.IEnumerable getAccessorStatements = null, System.Collections.Generic.IEnumerable setAccessorStatements = null) -> Microsoft.CodeAnalysis.SyntaxNode Microsoft.CodeAnalysis.Editing.SyntaxGenerator.RemoveAllAttributes(Microsoft.CodeAnalysis.SyntaxNode declaration) -> Microsoft.CodeAnalysis.SyntaxNode Microsoft.CodeAnalysis.Editing.SyntaxGenerator.RemoveNodes(Microsoft.CodeAnalysis.SyntaxNode root, System.Collections.Generic.IEnumerable declarations) -> Microsoft.CodeAnalysis.SyntaxNode +Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SetAccessorDeclaration(Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, System.Collections.Generic.IEnumerable statements = null) -> Microsoft.CodeAnalysis.SyntaxNode Microsoft.CodeAnalysis.Editing.SyntaxGenerator.StructDeclaration(string name, System.Collections.Generic.IEnumerable typeParameters = null, Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers = default(Microsoft.CodeAnalysis.Editing.DeclarationModifiers), System.Collections.Generic.IEnumerable interfaceTypes = null, System.Collections.Generic.IEnumerable members = null) -> Microsoft.CodeAnalysis.SyntaxNode Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SwitchSection(Microsoft.CodeAnalysis.SyntaxNode caseExpression, System.Collections.Generic.IEnumerable statements) -> Microsoft.CodeAnalysis.SyntaxNode Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SwitchStatement(Microsoft.CodeAnalysis.SyntaxNode expression, params Microsoft.CodeAnalysis.SyntaxNode[] sections) -> Microsoft.CodeAnalysis.SyntaxNode @@ -773,6 +788,7 @@ Microsoft.CodeAnalysis.Editing.SyntaxGenerator.VoidReturningLambdaExpression(Sys Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithAccessorDeclarations(Microsoft.CodeAnalysis.SyntaxNode declaration, params Microsoft.CodeAnalysis.SyntaxNode[] accessorDeclarations) -> Microsoft.CodeAnalysis.SyntaxNode Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeArguments(Microsoft.CodeAnalysis.SyntaxNode expression, params Microsoft.CodeAnalysis.SyntaxNode[] typeArguments) -> Microsoft.CodeAnalysis.SyntaxNode Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeConstraint(Microsoft.CodeAnalysis.SyntaxNode declaration, string typeParameterName, Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind kinds, params Microsoft.CodeAnalysis.SyntaxNode[] types) -> Microsoft.CodeAnalysis.SyntaxNode +Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeConstraint(Microsoft.CodeAnalysis.SyntaxNode declaration, string typeParameterName, Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind kinds, System.Collections.Generic.IEnumerable types = null) -> Microsoft.CodeAnalysis.SyntaxNode Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeConstraint(Microsoft.CodeAnalysis.SyntaxNode declaration, string typeParameterName, params Microsoft.CodeAnalysis.SyntaxNode[] types) -> Microsoft.CodeAnalysis.SyntaxNode Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeParameters(Microsoft.CodeAnalysis.SyntaxNode declaration, params string[] typeParameters) -> Microsoft.CodeAnalysis.SyntaxNode Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeParameters(Microsoft.CodeAnalysis.SyntaxNode declaration, System.Collections.Generic.IEnumerable typeParameters) -> Microsoft.CodeAnalysis.SyntaxNode @@ -1101,8 +1117,10 @@ Microsoft.CodeAnalysis.ProjectReference.ProjectReference(Microsoft.CodeAnalysis. Microsoft.CodeAnalysis.Recommendations.RecommendationOptions Microsoft.CodeAnalysis.Recommendations.Recommender Microsoft.CodeAnalysis.Rename.DocumentRenameOptions +Microsoft.CodeAnalysis.Rename.DocumentRenameOptions.Deconstruct(out bool RenameMatchingTypeInStrings, out bool RenameMatchingTypeInComments) -> void Microsoft.CodeAnalysis.Rename.DocumentRenameOptions.DocumentRenameOptions() -> void Microsoft.CodeAnalysis.Rename.DocumentRenameOptions.DocumentRenameOptions(bool RenameMatchingTypeInStrings = false, bool RenameMatchingTypeInComments = false) -> void +Microsoft.CodeAnalysis.Rename.DocumentRenameOptions.Equals(Microsoft.CodeAnalysis.Rename.DocumentRenameOptions other) -> bool Microsoft.CodeAnalysis.Rename.DocumentRenameOptions.RenameMatchingTypeInComments.get -> bool Microsoft.CodeAnalysis.Rename.DocumentRenameOptions.RenameMatchingTypeInComments.init -> void Microsoft.CodeAnalysis.Rename.DocumentRenameOptions.RenameMatchingTypeInStrings.get -> bool @@ -1119,6 +1137,8 @@ Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentActionSet.ApplicableActions. Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentActionSet.UpdateSolutionAsync(Microsoft.CodeAnalysis.Solution solution, System.Collections.Immutable.ImmutableArray actions, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentActionSet.UpdateSolutionAsync(Microsoft.CodeAnalysis.Solution solution, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task Microsoft.CodeAnalysis.Rename.SymbolRenameOptions +Microsoft.CodeAnalysis.Rename.SymbolRenameOptions.Deconstruct(out bool RenameOverloads, out bool RenameInStrings, out bool RenameInComments, out bool RenameFile) -> void +Microsoft.CodeAnalysis.Rename.SymbolRenameOptions.Equals(Microsoft.CodeAnalysis.Rename.SymbolRenameOptions other) -> bool Microsoft.CodeAnalysis.Rename.SymbolRenameOptions.RenameFile.get -> bool Microsoft.CodeAnalysis.Rename.SymbolRenameOptions.RenameFile.init -> void Microsoft.CodeAnalysis.Rename.SymbolRenameOptions.RenameInComments.get -> bool @@ -1438,6 +1458,7 @@ override Microsoft.CodeAnalysis.FileTextLoader.LoadTextAndVersionAsync(Microsoft override Microsoft.CodeAnalysis.FileTextLoader.LoadTextAndVersionAsync(Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.DocumentId documentId, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task override Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.Equals(object obj) -> bool override Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.GetHashCode() -> int +override Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.ToString() -> string override Microsoft.CodeAnalysis.Host.Mef.MefHostServices.CreateWorkspaceServices(Microsoft.CodeAnalysis.Workspace workspace) -> Microsoft.CodeAnalysis.Host.HostWorkspaceServices override Microsoft.CodeAnalysis.LoadTextOptions.Equals(object obj) -> bool override Microsoft.CodeAnalysis.LoadTextOptions.GetHashCode() -> int @@ -1456,6 +1477,12 @@ override Microsoft.CodeAnalysis.ProjectId.GetHashCode() -> int override Microsoft.CodeAnalysis.ProjectId.ToString() -> string override Microsoft.CodeAnalysis.ProjectReference.Equals(object obj) -> bool override Microsoft.CodeAnalysis.ProjectReference.GetHashCode() -> int +override Microsoft.CodeAnalysis.Rename.DocumentRenameOptions.Equals(object obj) -> bool +override Microsoft.CodeAnalysis.Rename.DocumentRenameOptions.GetHashCode() -> int +override Microsoft.CodeAnalysis.Rename.DocumentRenameOptions.ToString() -> string +override Microsoft.CodeAnalysis.Rename.SymbolRenameOptions.Equals(object obj) -> bool +override Microsoft.CodeAnalysis.Rename.SymbolRenameOptions.GetHashCode() -> int +override Microsoft.CodeAnalysis.Rename.SymbolRenameOptions.ToString() -> string override Microsoft.CodeAnalysis.SolutionId.Equals(object obj) -> bool override Microsoft.CodeAnalysis.SolutionId.GetHashCode() -> int override Microsoft.CodeAnalysis.VersionStamp.Equals(object obj) -> bool @@ -1469,14 +1496,22 @@ static Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.AdditiveTyp static Microsoft.CodeAnalysis.Classification.ClassificationTypeNames.AllTypeNames.get -> System.Collections.Immutable.ImmutableArray static Microsoft.CodeAnalysis.Classification.Classifier.GetClassifiedSpans(Microsoft.CodeAnalysis.SemanticModel semanticModel, Microsoft.CodeAnalysis.Text.TextSpan textSpan, Microsoft.CodeAnalysis.Workspace workspace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IEnumerable static Microsoft.CodeAnalysis.Classification.Classifier.GetClassifiedSpansAsync(Microsoft.CodeAnalysis.Document document, Microsoft.CodeAnalysis.Text.TextSpan textSpan, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task> +static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Collections.Immutable.ImmutableArray nestedActions, bool isInlinable, Microsoft.CodeAnalysis.CodeActions.CodeActionPriority priority = Microsoft.CodeAnalysis.CodeActions.CodeActionPriority.Default) -> Microsoft.CodeAnalysis.CodeActions.CodeAction static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Collections.Immutable.ImmutableArray nestedActions, bool isInlinable) -> Microsoft.CodeAnalysis.CodeActions.CodeAction -static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Func> createChangedDocument, string equivalenceKey = null) -> Microsoft.CodeAnalysis.CodeActions.CodeAction -static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Func> createChangedSolution, string equivalenceKey = null) -> Microsoft.CodeAnalysis.CodeActions.CodeAction +static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Func, System.Threading.CancellationToken, System.Threading.Tasks.Task> createChangedDocument, string equivalenceKey = null, Microsoft.CodeAnalysis.CodeActions.CodeActionPriority priority = Microsoft.CodeAnalysis.CodeActions.CodeActionPriority.Default) -> Microsoft.CodeAnalysis.CodeActions.CodeAction +static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Func, System.Threading.CancellationToken, System.Threading.Tasks.Task> createChangedSolution, string equivalenceKey = null, Microsoft.CodeAnalysis.CodeActions.CodeActionPriority priority = Microsoft.CodeAnalysis.CodeActions.CodeActionPriority.Default) -> Microsoft.CodeAnalysis.CodeActions.CodeAction +static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Func> createChangedDocument, string equivalenceKey = null, Microsoft.CodeAnalysis.CodeActions.CodeActionPriority priority = Microsoft.CodeAnalysis.CodeActions.CodeActionPriority.Default) -> Microsoft.CodeAnalysis.CodeActions.CodeAction +static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Func> createChangedDocument, string equivalenceKey) -> Microsoft.CodeAnalysis.CodeActions.CodeAction +static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Func> createChangedSolution, string equivalenceKey = null, Microsoft.CodeAnalysis.CodeActions.CodeActionPriority priority = Microsoft.CodeAnalysis.CodeActions.CodeActionPriority.Default) -> Microsoft.CodeAnalysis.CodeActions.CodeAction +static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Func> createChangedSolution, string equivalenceKey) -> Microsoft.CodeAnalysis.CodeActions.CodeAction static Microsoft.CodeAnalysis.CodeActions.ConflictAnnotation.Create(string description) -> Microsoft.CodeAnalysis.SyntaxAnnotation static Microsoft.CodeAnalysis.CodeActions.ConflictAnnotation.GetDescription(Microsoft.CodeAnalysis.SyntaxAnnotation annotation) -> string static Microsoft.CodeAnalysis.CodeActions.RenameAnnotation.Create() -> Microsoft.CodeAnalysis.SyntaxAnnotation static Microsoft.CodeAnalysis.CodeActions.WarningAnnotation.Create(string description) -> Microsoft.CodeAnalysis.SyntaxAnnotation static Microsoft.CodeAnalysis.CodeActions.WarningAnnotation.GetDescription(Microsoft.CodeAnalysis.SyntaxAnnotation annotation) -> string +static Microsoft.CodeAnalysis.CodeAnalysisProgress.AddCompleteItems(int count, string description = null) -> Microsoft.CodeAnalysis.CodeAnalysisProgress +static Microsoft.CodeAnalysis.CodeAnalysisProgress.AddIncompleteItems(int count, string description = null) -> Microsoft.CodeAnalysis.CodeAnalysisProgress +static Microsoft.CodeAnalysis.CodeAnalysisProgress.Description(string description) -> Microsoft.CodeAnalysis.CodeAnalysisProgress static Microsoft.CodeAnalysis.CodeFixes.FixAllProvider.Create(System.Func, System.Threading.Tasks.Task> fixAllAsync, System.Collections.Immutable.ImmutableArray supportedFixAllScopes) -> Microsoft.CodeAnalysis.CodeFixes.FixAllProvider static Microsoft.CodeAnalysis.CodeFixes.FixAllProvider.Create(System.Func, System.Threading.Tasks.Task> fixAllAsync) -> Microsoft.CodeAnalysis.CodeFixes.FixAllProvider static Microsoft.CodeAnalysis.CodeFixes.WellKnownFixAllProviders.BatchFixer.get -> Microsoft.CodeAnalysis.CodeFixes.FixAllProvider @@ -1499,10 +1534,10 @@ static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.File.get -> Microsoft static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.From(Microsoft.CodeAnalysis.ISymbol symbol) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.New.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.None.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers +static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.operator -(Microsoft.CodeAnalysis.Editing.DeclarationModifiers left, Microsoft.CodeAnalysis.Editing.DeclarationModifiers right) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.operator !=(Microsoft.CodeAnalysis.Editing.DeclarationModifiers left, Microsoft.CodeAnalysis.Editing.DeclarationModifiers right) -> bool static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.operator &(Microsoft.CodeAnalysis.Editing.DeclarationModifiers left, Microsoft.CodeAnalysis.Editing.DeclarationModifiers right) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.operator +(Microsoft.CodeAnalysis.Editing.DeclarationModifiers left, Microsoft.CodeAnalysis.Editing.DeclarationModifiers right) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers -static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.operator -(Microsoft.CodeAnalysis.Editing.DeclarationModifiers left, Microsoft.CodeAnalysis.Editing.DeclarationModifiers right) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.operator ==(Microsoft.CodeAnalysis.Editing.DeclarationModifiers left, Microsoft.CodeAnalysis.Editing.DeclarationModifiers right) -> bool static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.operator |(Microsoft.CodeAnalysis.Editing.DeclarationModifiers left, Microsoft.CodeAnalysis.Editing.DeclarationModifiers right) -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers static Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Override.get -> Microsoft.CodeAnalysis.Editing.DeclarationModifiers @@ -1630,6 +1665,8 @@ static Microsoft.CodeAnalysis.Recommendations.RecommendationOptions.HideAdvanced static Microsoft.CodeAnalysis.Recommendations.Recommender.GetRecommendedSymbolsAtPosition(Microsoft.CodeAnalysis.SemanticModel semanticModel, int position, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Collections.Generic.IEnumerable static Microsoft.CodeAnalysis.Recommendations.Recommender.GetRecommendedSymbolsAtPositionAsync(Microsoft.CodeAnalysis.Document document, int position, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task> static Microsoft.CodeAnalysis.Recommendations.Recommender.GetRecommendedSymbolsAtPositionAsync(Microsoft.CodeAnalysis.SemanticModel semanticModel, int position, Microsoft.CodeAnalysis.Workspace workspace, Microsoft.CodeAnalysis.Options.OptionSet options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task> +static Microsoft.CodeAnalysis.Rename.DocumentRenameOptions.operator !=(Microsoft.CodeAnalysis.Rename.DocumentRenameOptions left, Microsoft.CodeAnalysis.Rename.DocumentRenameOptions right) -> bool +static Microsoft.CodeAnalysis.Rename.DocumentRenameOptions.operator ==(Microsoft.CodeAnalysis.Rename.DocumentRenameOptions left, Microsoft.CodeAnalysis.Rename.DocumentRenameOptions right) -> bool static Microsoft.CodeAnalysis.Rename.RenameOptions.PreviewChanges.get -> Microsoft.CodeAnalysis.Options.Option static Microsoft.CodeAnalysis.Rename.RenameOptions.RenameInComments.get -> Microsoft.CodeAnalysis.Options.Option static Microsoft.CodeAnalysis.Rename.RenameOptions.RenameInStrings.get -> Microsoft.CodeAnalysis.Options.Option @@ -1638,6 +1675,8 @@ static Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentAsync(Microsoft.CodeA static Microsoft.CodeAnalysis.Rename.Renamer.RenameDocumentAsync(Microsoft.CodeAnalysis.Document document, string newDocumentName, System.Collections.Generic.IReadOnlyList newDocumentFolders = null, Microsoft.CodeAnalysis.Options.OptionSet optionSet = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task static Microsoft.CodeAnalysis.Rename.Renamer.RenameSymbolAsync(Microsoft.CodeAnalysis.Solution solution, Microsoft.CodeAnalysis.ISymbol symbol, Microsoft.CodeAnalysis.Rename.SymbolRenameOptions options, string newName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task static Microsoft.CodeAnalysis.Rename.Renamer.RenameSymbolAsync(Microsoft.CodeAnalysis.Solution solution, Microsoft.CodeAnalysis.ISymbol symbol, string newName, Microsoft.CodeAnalysis.Options.OptionSet optionSet, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task +static Microsoft.CodeAnalysis.Rename.SymbolRenameOptions.operator !=(Microsoft.CodeAnalysis.Rename.SymbolRenameOptions left, Microsoft.CodeAnalysis.Rename.SymbolRenameOptions right) -> bool +static Microsoft.CodeAnalysis.Rename.SymbolRenameOptions.operator ==(Microsoft.CodeAnalysis.Rename.SymbolRenameOptions left, Microsoft.CodeAnalysis.Rename.SymbolRenameOptions right) -> bool static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.AllowSimplificationToBaseType.get -> Microsoft.CodeAnalysis.Options.Option static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.AllowSimplificationToGenericType.get -> Microsoft.CodeAnalysis.Options.Option static Microsoft.CodeAnalysis.Simplification.SimplificationOptions.PreferAliasToQualification.get -> Microsoft.CodeAnalysis.Options.Option @@ -1692,19 +1731,31 @@ static readonly Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Silent -> Mi static readonly Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Suggestion -> Microsoft.CodeAnalysis.CodeStyle.NotificationOption static readonly Microsoft.CodeAnalysis.CodeStyle.NotificationOption.Warning -> Microsoft.CodeAnalysis.CodeStyle.NotificationOption static readonly Microsoft.CodeAnalysis.Editing.SyntaxGenerator.DefaultRemoveOptions -> Microsoft.CodeAnalysis.SyntaxRemoveOptions +virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputeOperationsAsync(System.IProgress progress, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task> virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputeOperationsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task> virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputePreviewOperationsAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task> +virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputePriority() -> Microsoft.CodeAnalysis.CodeActions.CodeActionPriority virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.EquivalenceKey.get -> string +virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.GetChangedDocumentAsync(System.IProgress progress, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.GetChangedDocumentAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.GetChangedSolutionAsync(System.IProgress progress, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.GetChangedSolutionAsync(System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.IsInlinable.get -> bool +virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.NestedActions.get -> System.Collections.Immutable.ImmutableArray virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.PostProcessChangesAsync(Microsoft.CodeAnalysis.Document document, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.Tags.get -> System.Collections.Immutable.ImmutableArray virtual Microsoft.CodeAnalysis.CodeActions.CodeActionOperation.Apply(Microsoft.CodeAnalysis.Workspace workspace, System.Threading.CancellationToken cancellationToken) -> void virtual Microsoft.CodeAnalysis.CodeActions.CodeActionOperation.Title.get -> string +virtual Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions.ComputeOperationsAsync(object options, System.IProgress progress, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task> +virtual Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions.ComputeOperationsAsync(object options, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task> +virtual Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider.ComputeRequestPriority() -> Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority virtual Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider.GetFixAllProvider() -> Microsoft.CodeAnalysis.CodeFixes.FixAllProvider virtual Microsoft.CodeAnalysis.CodeFixes.DocumentBasedFixAllProvider.GetFixAllTitle(Microsoft.CodeAnalysis.CodeFixes.FixAllContext fixAllContext) -> string virtual Microsoft.CodeAnalysis.CodeFixes.FixAllProvider.GetSupportedFixAllDiagnosticIds(Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider originalCodeFixProvider) -> System.Collections.Generic.IEnumerable virtual Microsoft.CodeAnalysis.CodeFixes.FixAllProvider.GetSupportedFixAllScopes() -> System.Collections.Generic.IEnumerable +virtual Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringProvider.ComputeRequestPriority() -> Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority +virtual Microsoft.CodeAnalysis.Editing.SymbolEditor.AsyncDeclarationEditAction.Invoke(Microsoft.CodeAnalysis.Editing.DocumentEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task +virtual Microsoft.CodeAnalysis.Editing.SymbolEditor.DeclarationEditAction.Invoke(Microsoft.CodeAnalysis.Editing.DocumentEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration) -> void virtual Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertNodesAfter(Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable newDeclarations) -> Microsoft.CodeAnalysis.SyntaxNode virtual Microsoft.CodeAnalysis.Editing.SyntaxGenerator.InsertNodesBefore(Microsoft.CodeAnalysis.SyntaxNode root, Microsoft.CodeAnalysis.SyntaxNode node, System.Collections.Generic.IEnumerable newDeclarations) -> Microsoft.CodeAnalysis.SyntaxNode virtual Microsoft.CodeAnalysis.Editing.SyntaxGenerator.MemberAccessExpression(Microsoft.CodeAnalysis.SyntaxNode expression, Microsoft.CodeAnalysis.SyntaxNode memberName) -> Microsoft.CodeAnalysis.SyntaxNode @@ -1715,6 +1766,7 @@ virtual Microsoft.CodeAnalysis.Editing.SyntaxGenerator.ReplaceNode(Microsoft.Cod virtual Microsoft.CodeAnalysis.FileTextLoader.CreateText(System.IO.Stream stream, Microsoft.CodeAnalysis.Workspace workspace) -> Microsoft.CodeAnalysis.Text.SourceText virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.GetLanguageServices(string languageName) -> Microsoft.CodeAnalysis.Host.HostLanguageServices virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.IsSupported(string languageName) -> bool +virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.MetadataFilter.Invoke(System.Collections.Generic.IReadOnlyDictionary metadata) -> bool virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.PersistentStorage.get -> Microsoft.CodeAnalysis.Host.IPersistentStorageService virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.SupportedLanguages.get -> System.Collections.Generic.IEnumerable virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.TemporaryStorage.get -> Microsoft.CodeAnalysis.Host.ITemporaryStorageService diff --git a/src/Workspaces/Core/Portable/PublicAPI.Unshipped.txt b/src/Workspaces/Core/Portable/PublicAPI.Unshipped.txt index 2cb22e6d85349..8b137891791fe 100644 --- a/src/Workspaces/Core/Portable/PublicAPI.Unshipped.txt +++ b/src/Workspaces/Core/Portable/PublicAPI.Unshipped.txt @@ -1,64 +1 @@ -*REMOVED*abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeConstraint(Microsoft.CodeAnalysis.SyntaxNode declaration, string typeParameterName, Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind kinds, System.Collections.Generic.IEnumerable types = null) -> Microsoft.CodeAnalysis.SyntaxNode -*REMOVED*abstract Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SetAccessorDeclaration(Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, System.Collections.Generic.IEnumerable statements = null) -> Microsoft.CodeAnalysis.SyntaxNode -*REMOVED*Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Equals(Microsoft.CodeAnalysis.Editing.DeclarationModifiers modifiers) -> bool -*REMOVED*static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Func> createChangedDocument, string equivalenceKey = null) -> Microsoft.CodeAnalysis.CodeActions.CodeAction -*REMOVED*static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Func> createChangedSolution, string equivalenceKey = null) -> Microsoft.CodeAnalysis.CodeActions.CodeAction -*REMOVED*abstract Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions.ComputeOperationsAsync(object options, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task> -Microsoft.CodeAnalysis.CodeActions.CodeAction.GetOperationsAsync(Microsoft.CodeAnalysis.Solution originalSolution, System.IProgress progress, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task> -Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority.Default = 3 -> Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority -Microsoft.CodeAnalysis.CodeAnalysisProgress -Microsoft.CodeAnalysis.CodeAnalysisProgress.CodeAnalysisProgress() -> void -Microsoft.CodeAnalysis.CodeFixes.FixAllContext.Progress.get -> System.IProgress -Microsoft.CodeAnalysis.Editing.SyntaxGenerator.SetAccessorDeclaration(Microsoft.CodeAnalysis.Accessibility accessibility = Microsoft.CodeAnalysis.Accessibility.NotApplicable, System.Collections.Generic.IEnumerable statements = null) -> Microsoft.CodeAnalysis.SyntaxNode -Microsoft.CodeAnalysis.Editing.SyntaxGenerator.WithTypeConstraint(Microsoft.CodeAnalysis.SyntaxNode declaration, string typeParameterName, Microsoft.CodeAnalysis.Editing.SpecialTypeConstraintKind kinds, System.Collections.Generic.IEnumerable types = null) -> Microsoft.CodeAnalysis.SyntaxNode -Microsoft.CodeAnalysis.CodeActions.CodeAction.Priority.get -> Microsoft.CodeAnalysis.CodeActions.CodeActionPriority -Microsoft.CodeAnalysis.CodeActions.CodeActionPriority -Microsoft.CodeAnalysis.CodeActions.CodeActionPriority.Default = 2 -> Microsoft.CodeAnalysis.CodeActions.CodeActionPriority -Microsoft.CodeAnalysis.CodeActions.CodeActionPriority.High = 3 -> Microsoft.CodeAnalysis.CodeActions.CodeActionPriority -Microsoft.CodeAnalysis.CodeActions.CodeActionPriority.Low = 1 -> Microsoft.CodeAnalysis.CodeActions.CodeActionPriority -Microsoft.CodeAnalysis.CodeActions.CodeActionPriority.Lowest = 0 -> Microsoft.CodeAnalysis.CodeActions.CodeActionPriority -Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority -Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority.High = 4 -> Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority -Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority.Low = 2 -> Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority -Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority.Lowest = 1 -> Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority -Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider.RequestPriority.get -> Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority -Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringProvider.RequestPriority.get -> Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority -static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Collections.Immutable.ImmutableArray nestedActions, bool isInlinable, Microsoft.CodeAnalysis.CodeActions.CodeActionPriority priority = Microsoft.CodeAnalysis.CodeActions.CodeActionPriority.Default) -> Microsoft.CodeAnalysis.CodeActions.CodeAction -static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Func, System.Threading.CancellationToken, System.Threading.Tasks.Task> createChangedDocument, string equivalenceKey = null, Microsoft.CodeAnalysis.CodeActions.CodeActionPriority priority = Microsoft.CodeAnalysis.CodeActions.CodeActionPriority.Default) -> Microsoft.CodeAnalysis.CodeActions.CodeAction -static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Func, System.Threading.CancellationToken, System.Threading.Tasks.Task> createChangedSolution, string equivalenceKey = null, Microsoft.CodeAnalysis.CodeActions.CodeActionPriority priority = Microsoft.CodeAnalysis.CodeActions.CodeActionPriority.Default) -> Microsoft.CodeAnalysis.CodeActions.CodeAction -static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Func> createChangedDocument, string equivalenceKey = null, Microsoft.CodeAnalysis.CodeActions.CodeActionPriority priority = Microsoft.CodeAnalysis.CodeActions.CodeActionPriority.Default) -> Microsoft.CodeAnalysis.CodeActions.CodeAction -static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Func> createChangedDocument, string equivalenceKey) -> Microsoft.CodeAnalysis.CodeActions.CodeAction -static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Func> createChangedSolution, string equivalenceKey = null, Microsoft.CodeAnalysis.CodeActions.CodeActionPriority priority = Microsoft.CodeAnalysis.CodeActions.CodeActionPriority.Default) -> Microsoft.CodeAnalysis.CodeActions.CodeAction -static Microsoft.CodeAnalysis.CodeActions.CodeAction.Create(string title, System.Func> createChangedSolution, string equivalenceKey) -> Microsoft.CodeAnalysis.CodeActions.CodeAction -static Microsoft.CodeAnalysis.CodeAnalysisProgress.AddCompleteItems(int count, string description = null) -> Microsoft.CodeAnalysis.CodeAnalysisProgress -static Microsoft.CodeAnalysis.CodeAnalysisProgress.AddIncompleteItems(int count, string description = null) -> Microsoft.CodeAnalysis.CodeAnalysisProgress -static Microsoft.CodeAnalysis.CodeAnalysisProgress.Description(string description) -> Microsoft.CodeAnalysis.CodeAnalysisProgress -virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputeOperationsAsync(System.IProgress progress, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task> -virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputePriority() -> Microsoft.CodeAnalysis.CodeActions.CodeActionPriority -virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.GetChangedDocumentAsync(System.IProgress progress, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task -virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.GetChangedSolutionAsync(System.IProgress progress, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task -virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.IsInlinable.get -> bool -virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.NestedActions.get -> System.Collections.Immutable.ImmutableArray -virtual Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions.ComputeOperationsAsync(object options, System.IProgress progress, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task> -virtual Microsoft.CodeAnalysis.CodeActions.CodeActionWithOptions.ComputeOperationsAsync(object options, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task> -virtual Microsoft.CodeAnalysis.CodeFixes.CodeFixProvider.ComputeRequestPriority() -> Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority -virtual Microsoft.CodeAnalysis.CodeRefactorings.CodeRefactoringProvider.ComputeRequestPriority() -> Microsoft.CodeAnalysis.CodeActions.CodeActionRequestPriority -Microsoft.CodeAnalysis.Rename.DocumentRenameOptions.Deconstruct(out bool RenameMatchingTypeInStrings, out bool RenameMatchingTypeInComments) -> void -Microsoft.CodeAnalysis.Rename.DocumentRenameOptions.Equals(Microsoft.CodeAnalysis.Rename.DocumentRenameOptions other) -> bool -Microsoft.CodeAnalysis.Rename.SymbolRenameOptions.Deconstruct(out bool RenameOverloads, out bool RenameInStrings, out bool RenameInComments, out bool RenameFile) -> void -Microsoft.CodeAnalysis.Rename.SymbolRenameOptions.Equals(Microsoft.CodeAnalysis.Rename.SymbolRenameOptions other) -> bool -override Microsoft.CodeAnalysis.FindSymbols.ReferenceLocation.ToString() -> string -override Microsoft.CodeAnalysis.Rename.DocumentRenameOptions.Equals(object obj) -> bool -override Microsoft.CodeAnalysis.Rename.DocumentRenameOptions.GetHashCode() -> int -override Microsoft.CodeAnalysis.Rename.DocumentRenameOptions.ToString() -> string -override Microsoft.CodeAnalysis.Rename.SymbolRenameOptions.Equals(object obj) -> bool -override Microsoft.CodeAnalysis.Rename.SymbolRenameOptions.GetHashCode() -> int -override Microsoft.CodeAnalysis.Rename.SymbolRenameOptions.ToString() -> string -static Microsoft.CodeAnalysis.Rename.DocumentRenameOptions.operator !=(Microsoft.CodeAnalysis.Rename.DocumentRenameOptions left, Microsoft.CodeAnalysis.Rename.DocumentRenameOptions right) -> bool -static Microsoft.CodeAnalysis.Rename.DocumentRenameOptions.operator ==(Microsoft.CodeAnalysis.Rename.DocumentRenameOptions left, Microsoft.CodeAnalysis.Rename.DocumentRenameOptions right) -> bool -static Microsoft.CodeAnalysis.Rename.SymbolRenameOptions.operator !=(Microsoft.CodeAnalysis.Rename.SymbolRenameOptions left, Microsoft.CodeAnalysis.Rename.SymbolRenameOptions right) -> bool -static Microsoft.CodeAnalysis.Rename.SymbolRenameOptions.operator ==(Microsoft.CodeAnalysis.Rename.SymbolRenameOptions left, Microsoft.CodeAnalysis.Rename.SymbolRenameOptions right) -> bool -virtual Microsoft.CodeAnalysis.Editing.SymbolEditor.AsyncDeclarationEditAction.Invoke(Microsoft.CodeAnalysis.Editing.DocumentEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.Task -virtual Microsoft.CodeAnalysis.Editing.SymbolEditor.DeclarationEditAction.Invoke(Microsoft.CodeAnalysis.Editing.DocumentEditor editor, Microsoft.CodeAnalysis.SyntaxNode declaration) -> void -virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.MetadataFilter.Invoke(System.Collections.Generic.IReadOnlyDictionary metadata) -> bool -Microsoft.CodeAnalysis.Editing.DeclarationModifiers.Equals(Microsoft.CodeAnalysis.Editing.DeclarationModifiers other) -> bool + From 2ab34d515890524976cb61ee411bc1571f233246 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Thu, 30 May 2024 14:35:09 -0700 Subject: [PATCH 38/38] Restore RazorCompiler EA layer for desktop (#73697) * Restore RazorCompiler EA layer for desktop * Fix nuget * Tests * Apply suggestions from code review Co-authored-by: Jan Jones * Apply suggestions from code review Co-authored-by: Jan Jones --------- Co-authored-by: Jan Jones --- .github/CODEOWNERS | 1 + Compilers.slnf | 2 + Roslyn.sln | 14 +++ .../CSharp/csc/CscCommandLine.projitems | 1 + .../AnalyzerAssemblyLoaderTests.cs | 74 +++++++++++++++ .../Microsoft.CodeAnalysis.UnitTests.csproj | 1 + .../VBCSCompilerCommandLine.projitems | 1 + ...crosoft.CodeAnalysis.Test.Utilities.csproj | 1 + ....CodeAnalysis.CSharp.Test.Utilities.csproj | 1 + .../VisualBasic/vbc/VbcCommandLine.projitems | 1 + ...crosoft.CodeAnalysis.LanguageServer.csproj | 3 + ...LanguageServerIndexFormat.Generator.csproj | 5 + .../DesktopCompilerArtifacts.targets | 1 + .../VS.Tools.Roslyn.Package.csproj | 1 + .../BuildBoss/CompilerNuGetCheckerUtil.cs | 4 +- .../RazorCompiler/GeneratorExtensions.cs | 34 +++++++ .../RazorCompiler/HostOutputNode.cs | 92 +++++++++++++++++++ .../RazorCompiler/InternalAPI.Shipped.txt | 1 + .../RazorCompiler/InternalAPI.Unshipped.txt | 15 +++ ...alysis.ExternalAccess.RazorCompiler.csproj | 46 ++++++++++ .../RazorCompiler/PublicAPI.Shipped.txt | 0 .../RazorCompiler/PublicAPI.Unshipped.txt | 0 .../RazorCompilerTest/HostOutputsTests.cs | 51 ++++++++++ ...ernalAccess.RazorCompiler.UnitTests.csproj | 14 +++ .../Setup/Roslyn.VisualStudio.Setup.csproj | 6 ++ ...oft.CodeAnalysis.Workspaces.MSBuild.csproj | 3 + ...soft.CodeAnalysis.Remote.ServiceHub.csproj | 1 + 27 files changed, 373 insertions(+), 1 deletion(-) create mode 100644 src/Tools/ExternalAccess/RazorCompiler/GeneratorExtensions.cs create mode 100644 src/Tools/ExternalAccess/RazorCompiler/HostOutputNode.cs create mode 100644 src/Tools/ExternalAccess/RazorCompiler/InternalAPI.Shipped.txt create mode 100644 src/Tools/ExternalAccess/RazorCompiler/InternalAPI.Unshipped.txt create mode 100644 src/Tools/ExternalAccess/RazorCompiler/Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.csproj create mode 100644 src/Tools/ExternalAccess/RazorCompiler/PublicAPI.Shipped.txt create mode 100644 src/Tools/ExternalAccess/RazorCompiler/PublicAPI.Unshipped.txt create mode 100644 src/Tools/ExternalAccess/RazorCompilerTest/HostOutputsTests.cs create mode 100644 src/Tools/ExternalAccess/RazorCompilerTest/Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.UnitTests.csproj diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d5e45cc903032..92ccd213d591e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -45,4 +45,5 @@ src/Features/**/PublicAPI.Unshipped.txt @dotnet/roslyn-api-owners src/EditorFeatures/**/PublicAPI.Unshipped.txt @dotnet/roslyn-api-owners src/Tools/ExternalAccess/OmniSharp*/ @333fred @dibarbet +src/Tools/ExternalAccess/RazorCompiler*/ @dotnet/roslyn-compiler src/Tools/ExternalAccess/CompilerDeveloperSDK/ @333fred diff --git a/Compilers.slnf b/Compilers.slnf index c810adbc006d7..e73b1562e7b0b 100644 --- a/Compilers.slnf +++ b/Compilers.slnf @@ -67,6 +67,8 @@ "src\\Tools\\BuildBoss\\BuildBoss.csproj", "src\\Tools\\Replay\\Replay.csproj", "src\\Tools\\BuildValidator\\BuildValidator.csproj", + "src\\Tools\\ExternalAccess\\RazorCompilerTest\\Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.UnitTests.csproj", + "src\\Tools\\ExternalAccess\\RazorCompiler\\Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.csproj", "src\\Tools\\PrepareTests\\PrepareTests.csproj", "src\\Tools\\Source\\CompilerGeneratorTools\\Source\\BoundTreeGenerator\\CompilersBoundTreeGenerator.csproj", "src\\Tools\\Source\\CompilerGeneratorTools\\Source\\CSharpErrorFactsGenerator\\CSharpErrorFactsGenerator.csproj", diff --git a/Roslyn.sln b/Roslyn.sln index b682dc262a06b..9a79c163e46ca 100644 --- a/Roslyn.sln +++ b/Roslyn.sln @@ -504,6 +504,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Test EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestDiscoveryWorker", "src\Tools\TestDiscoveryWorker\TestDiscoveryWorker.csproj", "{8BC50AFF-1EBF-4E9A-AEBB-04F387AA800F}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler", "src\Tools\ExternalAccess\RazorCompiler\Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.csproj", "{E5E0BF73-95F7-4BC3-8443-2336C4FF4297}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.UnitTests", "src\Tools\ExternalAccess\RazorCompilerTest\Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.UnitTests.csproj", "{828FD0DB-9927-42AC-B6C2-D1514965D6C3}" +EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.LanguageServer", "src\Features\LanguageServer\Microsoft.CodeAnalysis.LanguageServer\Microsoft.CodeAnalysis.LanguageServer.csproj", "{2A3C94F7-5B5E-4CDC-B645-672815E61DEB}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.LanguageServer.UnitTests", "src\Features\LanguageServer\Microsoft.CodeAnalysis.LanguageServer.UnitTests\Microsoft.CodeAnalysis.LanguageServer.UnitTests.csproj", "{9A90AA02-4275-40ED-B1F1-731AF17E675C}" @@ -1282,6 +1286,14 @@ Global {8BC50AFF-1EBF-4E9A-AEBB-04F387AA800F}.Debug|Any CPU.Build.0 = Debug|Any CPU {8BC50AFF-1EBF-4E9A-AEBB-04F387AA800F}.Release|Any CPU.ActiveCfg = Release|Any CPU {8BC50AFF-1EBF-4E9A-AEBB-04F387AA800F}.Release|Any CPU.Build.0 = Release|Any CPU + {E5E0BF73-95F7-4BC3-8443-2336C4FF4297}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E5E0BF73-95F7-4BC3-8443-2336C4FF4297}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E5E0BF73-95F7-4BC3-8443-2336C4FF4297}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E5E0BF73-95F7-4BC3-8443-2336C4FF4297}.Release|Any CPU.Build.0 = Release|Any CPU + {828FD0DB-9927-42AC-B6C2-D1514965D6C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {828FD0DB-9927-42AC-B6C2-D1514965D6C3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {828FD0DB-9927-42AC-B6C2-D1514965D6C3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {828FD0DB-9927-42AC-B6C2-D1514965D6C3}.Release|Any CPU.Build.0 = Release|Any CPU {2A3C94F7-5B5E-4CDC-B645-672815E61DEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2A3C94F7-5B5E-4CDC-B645-672815E61DEB}.Debug|Any CPU.Build.0 = Debug|Any CPU {2A3C94F7-5B5E-4CDC-B645-672815E61DEB}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -1600,6 +1612,8 @@ Global {58AD1B2C-6FFC-47CB-838A-54D0CA2BF0C8} = {D449D505-CC6A-4E0B-AF1B-976E2D0AE67A} {8A29449D-411E-49E4-B99E-E8428076BB21} = {55A62CFA-1155-46F1-ADF3-BEEE51B58AB5} {8BC50AFF-1EBF-4E9A-AEBB-04F387AA800F} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} + {E5E0BF73-95F7-4BC3-8443-2336C4FF4297} = {8977A560-45C2-4EC2-A849-97335B382C74} + {828FD0DB-9927-42AC-B6C2-D1514965D6C3} = {8977A560-45C2-4EC2-A849-97335B382C74} {2A3C94F7-5B5E-4CDC-B645-672815E61DEB} = {D449D505-CC6A-4E0B-AF1B-976E2D0AE67A} {9A90AA02-4275-40ED-B1F1-731AF17E675C} = {D449D505-CC6A-4E0B-AF1B-976E2D0AE67A} {521ADC3E-CC15-414B-9356-D87C5BCF3A24} = {C52D8057-43AF-40E6-A01B-6CDBB7301985} diff --git a/src/Compilers/CSharp/csc/CscCommandLine.projitems b/src/Compilers/CSharp/csc/CscCommandLine.projitems index eb07fde346dce..b25a580868321 100644 --- a/src/Compilers/CSharp/csc/CscCommandLine.projitems +++ b/src/Compilers/CSharp/csc/CscCommandLine.projitems @@ -36,6 +36,7 @@ + diff --git a/src/Compilers/Core/CodeAnalysisTest/AnalyzerAssemblyLoaderTests.cs b/src/Compilers/Core/CodeAnalysisTest/AnalyzerAssemblyLoaderTests.cs index 5c47171fb8a6f..949110ac56a74 100644 --- a/src/Compilers/Core/CodeAnalysisTest/AnalyzerAssemblyLoaderTests.cs +++ b/src/Compilers/Core/CodeAnalysisTest/AnalyzerAssemblyLoaderTests.cs @@ -519,6 +519,80 @@ public void AssemblyLoading_DependencyInDifferentDirectory(AnalyzerTestKind kind }); } +#if NET472 + /// + /// Verify that MS.CA.EA.RazorCompiler will be loaded from the compiler directory not the + /// analyzer directory. + /// + [Theory] + [CombinatorialData] + public void AssemblyLoading_RazorCompiler1(AnalyzerTestKind kind) + { + Run(kind, static (AnalyzerAssemblyLoader loader, AssemblyLoadTestFixture testFixture) => + { + using var temp = new TempRoot(); + var tempDir = temp.CreateDirectory(); + + var externalAccessRazorPath = typeof(Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.GeneratorExtensions).Assembly.Location; + var alternatePath = tempDir.CreateDirectory("a").CreateFile("Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.dll").CopyContentFrom(externalAccessRazorPath).Path; + + loader.AddDependencyLocation(alternatePath); + Assembly assembly = loader.LoadFromPath(alternatePath); + + Assert.Equal(externalAccessRazorPath, assembly.Location); + + // Even though EA.RazorCompiler is loaded from the compiler directory the shadow copy loader + // still does a defensive copy. + var copyCount = loader is ShadowCopyAnalyzerAssemblyLoader + ? 1 + : (int?)null; + + VerifyDependencyAssemblies( + loader, + copyCount: copyCount, + []); + }); + } + + /// + /// Verify that MS.CA.EA.RazorCompiler will be loaded from the compiler directory not the + /// analyzer directory. + /// + [Theory] + [CombinatorialData] + public void AssemblyLoading_RazorCompiler2(AnalyzerTestKind kind) + { + Run(kind, static (AnalyzerAssemblyLoader loader, AssemblyLoadTestFixture testFixture) => + { + using var temp = new TempRoot(); + var tempDir = temp.CreateDirectory(); + + var externalAccessRazorPath = typeof(Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.GeneratorExtensions).Assembly.Location; + var dir = tempDir.CreateDirectory("a"); + var alternatePath = dir.CreateFile("Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.dll").CopyContentFrom(externalAccessRazorPath).Path; + var deltaFile = dir.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).Path; + + loader.AddDependencyLocation(alternatePath); + loader.AddDependencyLocation(deltaFile); + Assembly razorAssembly = loader.LoadFromPath(alternatePath); + _ = loader.LoadFromPath(deltaFile); + + Assert.Equal(externalAccessRazorPath, razorAssembly.Location); + + // Even though EA.RazorCompiler is loaded from the compiler directory the shadow copy loader + // still does a defensive copy. + var copyCount = loader is ShadowCopyAnalyzerAssemblyLoader + ? 2 + : (int?)null; + VerifyDependencyAssemblies( + loader, + copyCount: copyCount, + deltaFile); + }); + } + +#endif + /// /// Similar to except want to validate /// a dependency in the same directory is preferred over one in a different directory. diff --git a/src/Compilers/Core/CodeAnalysisTest/Microsoft.CodeAnalysis.UnitTests.csproj b/src/Compilers/Core/CodeAnalysisTest/Microsoft.CodeAnalysis.UnitTests.csproj index e80335a1d132f..5cd86acd69fc0 100644 --- a/src/Compilers/Core/CodeAnalysisTest/Microsoft.CodeAnalysis.UnitTests.csproj +++ b/src/Compilers/Core/CodeAnalysisTest/Microsoft.CodeAnalysis.UnitTests.csproj @@ -23,6 +23,7 @@ + diff --git a/src/Compilers/Server/VBCSCompiler/VBCSCompilerCommandLine.projitems b/src/Compilers/Server/VBCSCompiler/VBCSCompilerCommandLine.projitems index 851b618b90dba..25e47648faab4 100644 --- a/src/Compilers/Server/VBCSCompiler/VBCSCompilerCommandLine.projitems +++ b/src/Compilers/Server/VBCSCompiler/VBCSCompilerCommandLine.projitems @@ -56,6 +56,7 @@ + diff --git a/src/Compilers/Test/Core/Microsoft.CodeAnalysis.Test.Utilities.csproj b/src/Compilers/Test/Core/Microsoft.CodeAnalysis.Test.Utilities.csproj index bdfcfbef906ef..d9938a752fd05 100644 --- a/src/Compilers/Test/Core/Microsoft.CodeAnalysis.Test.Utilities.csproj +++ b/src/Compilers/Test/Core/Microsoft.CodeAnalysis.Test.Utilities.csproj @@ -66,6 +66,7 @@ + diff --git a/src/Compilers/Test/Utilities/CSharp/Microsoft.CodeAnalysis.CSharp.Test.Utilities.csproj b/src/Compilers/Test/Utilities/CSharp/Microsoft.CodeAnalysis.CSharp.Test.Utilities.csproj index c332e5d4851d8..6e56556faaccf 100644 --- a/src/Compilers/Test/Utilities/CSharp/Microsoft.CodeAnalysis.CSharp.Test.Utilities.csproj +++ b/src/Compilers/Test/Utilities/CSharp/Microsoft.CodeAnalysis.CSharp.Test.Utilities.csproj @@ -32,6 +32,7 @@ + diff --git a/src/Compilers/VisualBasic/vbc/VbcCommandLine.projitems b/src/Compilers/VisualBasic/vbc/VbcCommandLine.projitems index d1729cd816e1c..a85e09f46fdde 100644 --- a/src/Compilers/VisualBasic/vbc/VbcCommandLine.projitems +++ b/src/Compilers/VisualBasic/vbc/VbcCommandLine.projitems @@ -36,6 +36,7 @@ + diff --git a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Microsoft.CodeAnalysis.LanguageServer.csproj b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Microsoft.CodeAnalysis.LanguageServer.csproj index b628f743b2ed0..cc877c4cc5a8e 100644 --- a/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Microsoft.CodeAnalysis.LanguageServer.csproj +++ b/src/Features/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/Microsoft.CodeAnalysis.LanguageServer.csproj @@ -69,6 +69,9 @@ + + + diff --git a/src/Features/Lsif/Generator/Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.csproj b/src/Features/Lsif/Generator/Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.csproj index 20ba57b5f5573..0d3924a25d6f6 100644 --- a/src/Features/Lsif/Generator/Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.csproj +++ b/src/Features/Lsif/Generator/Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.csproj @@ -86,6 +86,11 @@ + + + diff --git a/src/NuGet/Microsoft.Net.Compilers.Toolset/DesktopCompilerArtifacts.targets b/src/NuGet/Microsoft.Net.Compilers.Toolset/DesktopCompilerArtifacts.targets index aa85224f576fa..7008b7b87c2f6 100644 --- a/src/NuGet/Microsoft.Net.Compilers.Toolset/DesktopCompilerArtifacts.targets +++ b/src/NuGet/Microsoft.Net.Compilers.Toolset/DesktopCompilerArtifacts.targets @@ -33,6 +33,7 @@ + diff --git a/src/NuGet/VS.Tools.Roslyn.Package/VS.Tools.Roslyn.Package.csproj b/src/NuGet/VS.Tools.Roslyn.Package/VS.Tools.Roslyn.Package.csproj index a2cd0a4560532..5a7283350c3c1 100644 --- a/src/NuGet/VS.Tools.Roslyn.Package/VS.Tools.Roslyn.Package.csproj +++ b/src/NuGet/VS.Tools.Roslyn.Package/VS.Tools.Roslyn.Package.csproj @@ -26,6 +26,7 @@ + diff --git a/src/Tools/BuildBoss/CompilerNuGetCheckerUtil.cs b/src/Tools/BuildBoss/CompilerNuGetCheckerUtil.cs index 95268daf87b17..23717503f643f 100644 --- a/src/Tools/BuildBoss/CompilerNuGetCheckerUtil.cs +++ b/src/Tools/BuildBoss/CompilerNuGetCheckerUtil.cs @@ -178,7 +178,9 @@ private bool CheckPackages(TextWriter textWriter) allGood &= VerifyPackageCore( textWriter, FindNuGetPackage(Path.Combine(ArtifactsDirectory, "packages", Configuration, "Shipping"), "Microsoft.Net.Compilers.Toolset"), - excludeFunc: relativeFileName => relativeFileName.StartsWith(@"tasks\netcore\bincore\Microsoft.DiaSymReader.Native", PathComparison), + excludeFunc: relativeFileName => + relativeFileName.StartsWith(@"tasks\netcore\bincore\Microsoft.DiaSymReader.Native", PathComparison) || + relativeFileName.StartsWith(@"tasks\netcore\bincore\Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.dll", PathComparison), (@"tasks\net472", GetProjectOutputDirectory("csc", "net472")), (@"tasks\net472", GetProjectOutputDirectory("vbc", "net472")), (@"tasks\net472", GetProjectOutputDirectory("csi", "net472")), diff --git a/src/Tools/ExternalAccess/RazorCompiler/GeneratorExtensions.cs b/src/Tools/ExternalAccess/RazorCompiler/GeneratorExtensions.cs new file mode 100644 index 0000000000000..bc7d9f43af7be --- /dev/null +++ b/src/Tools/ExternalAccess/RazorCompiler/GeneratorExtensions.cs @@ -0,0 +1,34 @@ +// 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.Immutable; +using System.Threading; +using Microsoft.CodeAnalysis.PooledObjects; + +namespace Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler +{ + internal static partial class GeneratorExtensions + { + public static void RegisterHostOutput(ref this IncrementalGeneratorInitializationContext @this, IncrementalValuesProvider source, Action action) + { + _ = @this; + source.Node.RegisterOutput(new HostOutputNode(source.Node, action)); + } + + public static ImmutableArray<(string Key, string Value)> GetHostOutputs(this GeneratorRunResult runResult) => runResult.HostOutputs; + } + + internal readonly struct HostProductionContext + { + internal readonly ArrayBuilder<(string, string)> Outputs; + + internal HostProductionContext(ArrayBuilder<(string, string)> outputs) + { + Outputs = outputs; + } + + public void AddOutput(string name, string value) => Outputs.Add((name, value)); + } +} diff --git a/src/Tools/ExternalAccess/RazorCompiler/HostOutputNode.cs b/src/Tools/ExternalAccess/RazorCompiler/HostOutputNode.cs new file mode 100644 index 0000000000000..3ae1b7dcd296e --- /dev/null +++ b/src/Tools/ExternalAccess/RazorCompiler/HostOutputNode.cs @@ -0,0 +1,92 @@ +// 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.Diagnostics; +using System.Text; +using System.Threading; +using Microsoft.CodeAnalysis.PooledObjects; +using Roslyn.Utilities; +using TOutput = System.Collections.Immutable.ImmutableArray<(string, string)>; + +namespace Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler +{ + internal sealed class HostOutputNode : IIncrementalGeneratorOutputNode, IIncrementalGeneratorNode + { + private readonly IIncrementalGeneratorNode _source; + + private readonly Action _action; + + public HostOutputNode(IIncrementalGeneratorNode source, Action action) + { + _source = source; + _action = action; + } + + public IncrementalGeneratorOutputKind Kind => GeneratorDriver.HostKind; + + public NodeStateTable UpdateStateTable(DriverStateTable.Builder graphState, NodeStateTable? previousTable, CancellationToken cancellationToken) + { + string stepName = "HostOutput"; + var sourceTable = graphState.GetLatestStateTableForNode(_source); + if (sourceTable.IsCached && previousTable is not null) + { + if (graphState.DriverState.TrackIncrementalSteps) + { + return previousTable.CreateCachedTableWithUpdatedSteps(sourceTable, stepName, EqualityComparer.Default); + } + return previousTable; + } + + var nodeTable = graphState.CreateTableBuilder(previousTable, stepName, EqualityComparer.Default); + foreach (var entry in sourceTable) + { + var inputs = nodeTable.TrackIncrementalSteps ? ImmutableArray.Create((entry.Step!, entry.OutputIndex)) : default; + if (entry.State == EntryState.Removed) + { + nodeTable.TryRemoveEntries(TimeSpan.Zero, inputs); + } + else if (entry.State != EntryState.Cached || !nodeTable.TryUseCachedEntries(TimeSpan.Zero, inputs)) + { + ArrayBuilder<(string, string)> output = ArrayBuilder<(string, string)>.GetInstance(); + HostProductionContext context = new HostProductionContext(output); + var stopwatch = SharedStopwatch.StartNew(); + _action(context, entry.Item, cancellationToken); + nodeTable.AddEntry(output.ToImmutableAndFree(), EntryState.Added, stopwatch.Elapsed, inputs, EntryState.Added); + } + } + + return nodeTable.ToImmutableAndFree(); + } + + public void AppendOutputs(IncrementalExecutionContext context, CancellationToken cancellationToken) + { + // get our own state table + Debug.Assert(context.TableBuilder is not null); + var table = context.TableBuilder!.GetLatestStateTableForNode(this); + + // add each non-removed entry to the context + foreach (var (list, state, _, _) in table) + { + if (state != EntryState.Removed) + { + context.HostOutputBuilder.AddRange(list); + } + } + + if (context.GeneratorRunStateBuilder.RecordingExecutedSteps) + { + context.GeneratorRunStateBuilder.RecordStepsFromOutputNodeUpdate(table); + } + } + + IIncrementalGeneratorNode IIncrementalGeneratorNode.WithComparer(IEqualityComparer comparer) => throw ExceptionUtilities.Unreachable(); + + public IIncrementalGeneratorNode WithTrackingName(string name) => throw ExceptionUtilities.Unreachable(); + + void IIncrementalGeneratorNode.RegisterOutput(IIncrementalGeneratorOutputNode output) => throw ExceptionUtilities.Unreachable(); + } +} diff --git a/src/Tools/ExternalAccess/RazorCompiler/InternalAPI.Shipped.txt b/src/Tools/ExternalAccess/RazorCompiler/InternalAPI.Shipped.txt new file mode 100644 index 0000000000000..7dc5c58110bfa --- /dev/null +++ b/src/Tools/ExternalAccess/RazorCompiler/InternalAPI.Shipped.txt @@ -0,0 +1 @@ +#nullable enable diff --git a/src/Tools/ExternalAccess/RazorCompiler/InternalAPI.Unshipped.txt b/src/Tools/ExternalAccess/RazorCompiler/InternalAPI.Unshipped.txt new file mode 100644 index 0000000000000..7c99629a815f4 --- /dev/null +++ b/src/Tools/ExternalAccess/RazorCompiler/InternalAPI.Unshipped.txt @@ -0,0 +1,15 @@ +#nullable enable +Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.GeneratorExtensions +Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.HostOutputNode +Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.HostOutputNode.AppendOutputs(Microsoft.CodeAnalysis.IncrementalExecutionContext context, System.Threading.CancellationToken cancellationToken) -> void +Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.HostOutputNode.HostOutputNode(Microsoft.CodeAnalysis.IIncrementalGeneratorNode! source, System.Action! action) -> void +Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.HostOutputNode.Kind.get -> Microsoft.CodeAnalysis.IncrementalGeneratorOutputKind +Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.HostOutputNode.UpdateStateTable(Microsoft.CodeAnalysis.DriverStateTable.Builder! graphState, Microsoft.CodeAnalysis.NodeStateTable>? previousTable, System.Threading.CancellationToken cancellationToken) -> Microsoft.CodeAnalysis.NodeStateTable>! +Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.HostOutputNode.WithTrackingName(string! name) -> Microsoft.CodeAnalysis.IIncrementalGeneratorNode>! +Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.HostProductionContext +Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.HostProductionContext.AddOutput(string! name, string! value) -> void +Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.HostProductionContext.HostProductionContext() -> void +Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.HostProductionContext.HostProductionContext(Microsoft.CodeAnalysis.PooledObjects.ArrayBuilder<(string!, string!)>! outputs) -> void +readonly Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.HostProductionContext.Outputs -> Microsoft.CodeAnalysis.PooledObjects.ArrayBuilder<(string!, string!)>! +static Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.GeneratorExtensions.GetHostOutputs(this Microsoft.CodeAnalysis.GeneratorRunResult runResult) -> System.Collections.Immutable.ImmutableArray<(string! Key, string! Value)> +static Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.GeneratorExtensions.RegisterHostOutput(this ref Microsoft.CodeAnalysis.IncrementalGeneratorInitializationContext this, Microsoft.CodeAnalysis.IncrementalValuesProvider source, System.Action! action) -> void diff --git a/src/Tools/ExternalAccess/RazorCompiler/Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.csproj b/src/Tools/ExternalAccess/RazorCompiler/Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.csproj new file mode 100644 index 0000000000000..f41f08081f772 --- /dev/null +++ b/src/Tools/ExternalAccess/RazorCompiler/Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.csproj @@ -0,0 +1,46 @@ + + + + + Library + Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler + $(NetRoslynSourceBuild);netstandard2.0 + + + false + + + true + Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler + + A supporting package for Razor source generator: + https://github.com/dotnet/razor + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Tools/ExternalAccess/RazorCompiler/PublicAPI.Shipped.txt b/src/Tools/ExternalAccess/RazorCompiler/PublicAPI.Shipped.txt new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/src/Tools/ExternalAccess/RazorCompiler/PublicAPI.Unshipped.txt b/src/Tools/ExternalAccess/RazorCompiler/PublicAPI.Unshipped.txt new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/src/Tools/ExternalAccess/RazorCompilerTest/HostOutputsTests.cs b/src/Tools/ExternalAccess/RazorCompilerTest/HostOutputsTests.cs new file mode 100644 index 0000000000000..ac6da1b1b9d6a --- /dev/null +++ b/src/Tools/ExternalAccess/RazorCompilerTest/HostOutputsTests.cs @@ -0,0 +1,51 @@ +// 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.Linq; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Test.Utilities; +using Microsoft.CodeAnalysis.CSharp.UnitTests; +using Microsoft.CodeAnalysis.Test.Utilities; +using Roslyn.Test.Utilities.TestGenerators; +using Xunit; + +namespace Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.UnitTests +{ + public class HostOutputsTests : CSharpTestBase + { + [Fact] + public void Added() + { + var source = """ + class C { } + """; + var parseOptions = TestOptions.Regular; + var compilation = CreateCompilation(source, options: TestOptions.DebugDllThrowing, parseOptions: parseOptions); + compilation.VerifyDiagnostics(); + + Assert.Single(compilation.SyntaxTrees); + + var generator = new PipelineCallbackGenerator(ctx => + { + var syntaxProvider = ctx.SyntaxProvider.CreateSyntaxProvider((n, _) => n.IsKind(SyntaxKind.ClassDeclaration), (c, _) => c.Node); + + ctx.RegisterHostOutput(syntaxProvider, static (hpc, node, _) => + { + hpc.AddOutput("test", node.ToFullString()); + }); + }); + + GeneratorDriver driver = CSharpGeneratorDriver.Create(new[] { generator.AsSourceGenerator() }, parseOptions: parseOptions); + driver = driver.RunGenerators(compilation); + + var result = driver.GetRunResult().Results.Single(); + Assert.Empty(result.Diagnostics); + + var hostOutputs = result.GetHostOutputs(); + Assert.Equal(1, hostOutputs.Length); + Assert.Equal("test", hostOutputs[0].Key); + Assert.Equal(source, hostOutputs[0].Value); + } + } +} diff --git a/src/Tools/ExternalAccess/RazorCompilerTest/Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.UnitTests.csproj b/src/Tools/ExternalAccess/RazorCompilerTest/Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.UnitTests.csproj new file mode 100644 index 0000000000000..caa37487800e7 --- /dev/null +++ b/src/Tools/ExternalAccess/RazorCompilerTest/Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.UnitTests.csproj @@ -0,0 +1,14 @@ + + + + + Library + Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.UnitTests + $(NetRoslyn);net472 + + + + + + + diff --git a/src/VisualStudio/Setup/Roslyn.VisualStudio.Setup.csproj b/src/VisualStudio/Setup/Roslyn.VisualStudio.Setup.csproj index 5183dad27cba1..12a14f196cf15 100644 --- a/src/VisualStudio/Setup/Roslyn.VisualStudio.Setup.csproj +++ b/src/VisualStudio/Setup/Roslyn.VisualStudio.Setup.csproj @@ -92,6 +92,12 @@ true BindingRedirect + + Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler + BuiltProjectOutputGroup + true + BindingRedirect + Workspaces.Desktop BuiltProjectOutputGroup;SatelliteDllsProjectOutputGroup diff --git a/src/Workspaces/Core/MSBuild/Microsoft.CodeAnalysis.Workspaces.MSBuild.csproj b/src/Workspaces/Core/MSBuild/Microsoft.CodeAnalysis.Workspaces.MSBuild.csproj index 98ad23cbaab6d..9cab9ff8c290b 100644 --- a/src/Workspaces/Core/MSBuild/Microsoft.CodeAnalysis.Workspaces.MSBuild.csproj +++ b/src/Workspaces/Core/MSBuild/Microsoft.CodeAnalysis.Workspaces.MSBuild.csproj @@ -41,6 +41,9 @@ true + + true + diff --git a/src/Workspaces/Remote/ServiceHub/Microsoft.CodeAnalysis.Remote.ServiceHub.csproj b/src/Workspaces/Remote/ServiceHub/Microsoft.CodeAnalysis.Remote.ServiceHub.csproj index 2d85cd9ac2631..52a04fe8774d6 100644 --- a/src/Workspaces/Remote/ServiceHub/Microsoft.CodeAnalysis.Remote.ServiceHub.csproj +++ b/src/Workspaces/Remote/ServiceHub/Microsoft.CodeAnalysis.Remote.ServiceHub.csproj @@ -16,6 +16,7 @@ +