From f8a8f0599108dbb8d44cabfaf52cac43d6826bb1 Mon Sep 17 00:00:00 2001 From: Andrew Hall Date: Mon, 7 Apr 2025 13:20:16 -0700 Subject: [PATCH 01/10] Update packages to latest --- eng/Version.Details.xml | 76 ++++++++++++++++++++--------------------- eng/Versions.props | 38 ++++++++++----------- 2 files changed, 57 insertions(+), 57 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4da415ea939..3f4173865a0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -11,82 +11,82 @@ 14f833124983b36ac4083338d0cad6caefce2489 - + https://github.com/dotnet/roslyn - 467f6bb29a6281fe0d0b7f8b2066281d17e83fac + 09312a65870e883999ffe2ca25edd05cbc241e05 - + https://github.com/dotnet/roslyn - 467f6bb29a6281fe0d0b7f8b2066281d17e83fac + 09312a65870e883999ffe2ca25edd05cbc241e05 - + https://github.com/dotnet/roslyn - 467f6bb29a6281fe0d0b7f8b2066281d17e83fac + 09312a65870e883999ffe2ca25edd05cbc241e05 - + https://github.com/dotnet/roslyn - 467f6bb29a6281fe0d0b7f8b2066281d17e83fac + 09312a65870e883999ffe2ca25edd05cbc241e05 - + https://github.com/dotnet/roslyn - 467f6bb29a6281fe0d0b7f8b2066281d17e83fac + 09312a65870e883999ffe2ca25edd05cbc241e05 - + https://github.com/dotnet/roslyn - 467f6bb29a6281fe0d0b7f8b2066281d17e83fac + 09312a65870e883999ffe2ca25edd05cbc241e05 - + https://github.com/dotnet/roslyn - 467f6bb29a6281fe0d0b7f8b2066281d17e83fac + 09312a65870e883999ffe2ca25edd05cbc241e05 - + https://github.com/dotnet/roslyn - 467f6bb29a6281fe0d0b7f8b2066281d17e83fac + 09312a65870e883999ffe2ca25edd05cbc241e05 - + https://github.com/dotnet/roslyn - 467f6bb29a6281fe0d0b7f8b2066281d17e83fac + 09312a65870e883999ffe2ca25edd05cbc241e05 - + https://github.com/dotnet/roslyn - 467f6bb29a6281fe0d0b7f8b2066281d17e83fac + 09312a65870e883999ffe2ca25edd05cbc241e05 - + https://github.com/dotnet/roslyn - 467f6bb29a6281fe0d0b7f8b2066281d17e83fac + 09312a65870e883999ffe2ca25edd05cbc241e05 - + https://github.com/dotnet/roslyn - 467f6bb29a6281fe0d0b7f8b2066281d17e83fac + 09312a65870e883999ffe2ca25edd05cbc241e05 - + https://github.com/dotnet/roslyn - 467f6bb29a6281fe0d0b7f8b2066281d17e83fac + 09312a65870e883999ffe2ca25edd05cbc241e05 - + https://github.com/dotnet/roslyn - 467f6bb29a6281fe0d0b7f8b2066281d17e83fac + 09312a65870e883999ffe2ca25edd05cbc241e05 - + https://github.com/dotnet/roslyn - 467f6bb29a6281fe0d0b7f8b2066281d17e83fac + 09312a65870e883999ffe2ca25edd05cbc241e05 - + https://github.com/dotnet/roslyn - 467f6bb29a6281fe0d0b7f8b2066281d17e83fac + 09312a65870e883999ffe2ca25edd05cbc241e05 - + https://github.com/dotnet/roslyn - 467f6bb29a6281fe0d0b7f8b2066281d17e83fac + 09312a65870e883999ffe2ca25edd05cbc241e05 - + https://github.com/dotnet/roslyn - 467f6bb29a6281fe0d0b7f8b2066281d17e83fac + 09312a65870e883999ffe2ca25edd05cbc241e05 - + https://github.com/dotnet/roslyn - 467f6bb29a6281fe0d0b7f8b2066281d17e83fac + 09312a65870e883999ffe2ca25edd05cbc241e05 diff --git a/eng/Versions.props b/eng/Versions.props index 59e50320fd4..b5332a9b4c3 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -51,25 +51,25 @@ 6.0.1 10.0.620402 9.0.0-beta.25204.5 - 4.14.0-3.25201.17 - 4.14.0-3.25201.17 - 4.14.0-3.25201.17 - 4.14.0-3.25201.17 - 4.14.0-3.25201.17 - 4.14.0-3.25201.17 - 4.14.0-3.25201.17 - 4.14.0-3.25201.17 - 4.14.0-3.25201.17 - 4.14.0-3.25201.17 - 4.14.0-3.25201.17 - 4.14.0-3.25201.17 - 4.14.0-3.25201.17 - 4.14.0-3.25201.17 - 4.14.0-3.25201.17 - 4.14.0-3.25201.17 - 4.14.0-3.25201.17 - 4.14.0-3.25201.17 - 4.14.0-3.25201.17 + 5.0.0-1.25207.1 + 5.0.0-1.25207.1 + 5.0.0-1.25207.1 + 5.0.0-1.25207.1 + 5.0.0-1.25207.1 + 5.0.0-1.25207.1 + 5.0.0-1.25207.1 + 5.0.0-1.25207.1 + 5.0.0-1.25207.1 + 5.0.0-1.25207.1 + 5.0.0-1.25207.1 + 5.0.0-1.25207.1 + 5.0.0-1.25207.1 + 5.0.0-1.25207.1 + 5.0.0-1.25207.1 + 5.0.0-1.25207.1 + 5.0.0-1.25207.1 + 5.0.0-1.25207.1 + 5.0.0-1.25207.1 - + https://github.com/dotnet/roslyn - 09312a65870e883999ffe2ca25edd05cbc241e05 + 931392ecdcae209648a599560cee2d87cf3fb631 + + https://github.com/dotnet/roslyn + 931392ecdcae209648a599560cee2d87cf3fb631 + + + https://github.com/dotnet/roslyn + 931392ecdcae209648a599560cee2d87cf3fb631 + diff --git a/eng/Versions.props b/eng/Versions.props index 9ac0436d83c..7954840aee5 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -6,6 +6,8 @@ 1.1.33 true true + 5.0.0-1.25209.4 + 5.0.0-1.25209.4 @@ -51,25 +53,25 @@ 6.0.1 10.0.620402 9.0.0-beta.25204.5 - 5.0.0-dev - 5.0.0-dev - 5.0.0-dev - 5.0.0-dev - 5.0.0-dev - 5.0.0-dev - 5.0.0-dev - 5.0.0-dev - 5.0.0-dev - 5.0.0-dev - 5.0.0-dev - 5.0.0-dev - 5.0.0-dev - 5.0.0-dev - 5.0.0-dev - 5.0.0-dev - 5.0.0-dev - 5.0.0-dev - 5.0.0-dev + 5.0.0-1.25209.4 + 5.0.0-1.25209.4 + 5.0.0-1.25209.4 + 5.0.0-1.25209.4 + 5.0.0-1.25209.4 + 5.0.0-1.25209.4 + 5.0.0-1.25209.4 + 5.0.0-1.25209.4 + 5.0.0-1.25209.4 + 5.0.0-1.25209.4 + 5.0.0-1.25209.4 + 5.0.0-1.25209.4 + 5.0.0-1.25209.4 + 5.0.0-1.25209.4 + 5.0.0-1.25209.4 + 5.0.0-1.25209.4 + 5.0.0-1.25209.4 + 5.0.0-1.25209.4 + 5.0.0-1.25209.4 - + https://github.com/dotnet/roslyn - 931392ecdcae209648a599560cee2d87cf3fb631 + c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 - + https://github.com/dotnet/roslyn - 931392ecdcae209648a599560cee2d87cf3fb631 + c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 - + https://github.com/dotnet/roslyn - 931392ecdcae209648a599560cee2d87cf3fb631 + c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + + + https://github.com/dotnet/roslyn + c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + + + https://github.com/dotnet/roslyn + c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 diff --git a/eng/Versions.props b/eng/Versions.props index 7954840aee5..33a370e0864 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -6,8 +6,6 @@ 1.1.33 true true - 5.0.0-1.25209.4 - 5.0.0-1.25209.4 @@ -53,25 +51,28 @@ 6.0.1 10.0.620402 9.0.0-beta.25204.5 - 5.0.0-1.25209.4 - 5.0.0-1.25209.4 - 5.0.0-1.25209.4 - 5.0.0-1.25209.4 - 5.0.0-1.25209.4 - 5.0.0-1.25209.4 - 5.0.0-1.25209.4 - 5.0.0-1.25209.4 - 5.0.0-1.25209.4 - 5.0.0-1.25209.4 - 5.0.0-1.25209.4 - 5.0.0-1.25209.4 - 5.0.0-1.25209.4 - 5.0.0-1.25209.4 - 5.0.0-1.25209.4 - 5.0.0-1.25209.4 - 5.0.0-1.25209.4 - 5.0.0-1.25209.4 - 5.0.0-1.25209.4 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 + 5.0.0-1.25209.5 - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 33d8b8bf8fa..3069ccdf5d7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -11,99 +11,103 @@ 14f833124983b36ac4083338d0cad6caefce2489 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 https://github.com/dotnet/roslyn 09312a65870e883999ffe2ca25edd05cbc241e05 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 - + https://github.com/dotnet/roslyn - c3f48b60744c3eaa0c7c9c01739f6ccad14bcda3 + 605d9346cdae106907f67663250788eff6048b09 + + + https://github.com/dotnet/roslyn + 605d9346cdae106907f67663250788eff6048b09 diff --git a/eng/Versions.props b/eng/Versions.props index 33a370e0864..9800a4cafc3 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -47,32 +47,33 @@ --> + 3.12.0-beta1.25209.6 6.0.2-servicing.22064.6 6.0.1 10.0.620402 9.0.0-beta.25204.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 - 5.0.0-1.25209.5 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 + 5.0.0-1.25209.6 - 3.12.0-beta1.25209.6 + 3.12.0-beta1.25209.6 6.0.2-servicing.22064.6 6.0.1 10.0.620402 9.0.0-beta.25204.5 5.0.0-1.25209.6 - 5.0.0-1.25209.6 + 5.0.0-1.25209.6 5.0.0-1.25209.6 + 5.0.0-1.25207.1 5.0.0-1.25209.6 5.0.0-1.25209.6 5.0.0-1.25209.6 @@ -66,7 +67,7 @@ 5.0.0-1.25209.6 5.0.0-1.25209.6 5.0.0-1.25209.6 - 5.0.0-1.25209.6 + 5.0.0-1.25209.6 5.0.0-1.25209.6 5.0.0-1.25209.6 5.0.0-1.25209.6 From 346dce7fffb98ceed021bfa92df0b030fd3247d7 Mon Sep 17 00:00:00 2001 From: Andrew Hall Date: Thu, 10 Apr 2025 11:06:56 -0700 Subject: [PATCH 09/10] Fix test composition --- .../Mef/TestComposition.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Mef/TestComposition.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Mef/TestComposition.cs index f96aa15fefe..477ada1563e 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Mef/TestComposition.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Mef/TestComposition.cs @@ -30,7 +30,6 @@ public sealed partial class TestComposition .AddAssemblies(Assembly.LoadFrom("Microsoft.CodeAnalysis.CSharp.EditorFeatures.dll")) .AddAssemblies(Assembly.LoadFrom("Microsoft.CodeAnalysis.EditorFeatures.dll")) .AddAssemblies(Assembly.LoadFrom("Microsoft.CodeAnalysis.ExternalAccess.Razor.Features.dll")) - .AddAssemblies(Assembly.LoadFrom("Microsoft.CodeAnalysis.ExternalAccess.Razor.EditorFeatures.dll")) .AddAssemblies(Assembly.LoadFrom("Microsoft.CodeAnalysis.LanguageServer.Protocol.dll")) .AddParts(typeof(RazorTestWorkspaceRegistrationService)); From 001b584b002bc9d41589d4963e5de1b0d89c07da Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Thu, 10 Apr 2025 13:34:43 -0700 Subject: [PATCH 10/10] Fix CSharpTestLspServer The RoslynLanguageServer in the latest Microsoft.CodeAnalysis.LanguageServer.Protocol.dll doesn't exit gracefully when the JsonRpc it's listening to is forcibly disconnected. Unfortunately, that's exactly how our CSharpTestLspServer shuts down the RoslynLanguageServer that it creates. Ultimately, the Razor EA should be updated to provide a IAsyncDisposable implementation that can be called to gracefully shut down the language server. However, in the meantime, this change uses reflection to get at the underlying RoslynLanguageServer and call ShutdownAsync and ExitAsync on it before disposing the server-side JsonRpc. --- .../LanguageServer/CSharpTestLspServer.cs | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/CSharpTestLspServer.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/CSharpTestLspServer.cs index b042c73a934..f4462da41f9 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/CSharpTestLspServer.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/CSharpTestLspServer.cs @@ -5,16 +5,17 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; +using System.Reflection; using System.Text.Json; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.ExternalAccess.Razor; -using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.VisualStudio.Composition; using Nerdbank.Streams; using StreamJsonRpc; +using Xunit; namespace Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; @@ -26,6 +27,8 @@ public sealed class CSharpTestLspServer : IAsyncDisposable private readonly JsonRpc _clientRpc; private readonly JsonRpc _serverRpc; + private readonly object _roslynLanguageServer; + private readonly SystemTextJsonFormatter _clientMessageFormatter; private readonly SystemTextJsonFormatter _serverMessageFormatter; private readonly HeaderDelimitedMessageHandler _clientMessageHandler; @@ -67,7 +70,17 @@ private CSharpTestLspServer( _clientRpc.StartListening(); - _ = CreateLanguageServer(_serverRpc, _serverMessageFormatter.JsonSerializerOptions, testWorkspace, languageServerFactory, exportProvider, serverCapabilities); + var languageServerTarget = CreateLanguageServer(_serverRpc, _serverMessageFormatter.JsonSerializerOptions, testWorkspace, languageServerFactory, exportProvider, serverCapabilities); + + // This isn't ideal, but we need to pull the actual RoslynLanguageServer out of languageServerTarget + // so that we can call ShutdownAsync and ExitAsync on it when dispos + var languageServerField = languageServerTarget.GetType().GetField("_languageServer", BindingFlags.Instance | BindingFlags.NonPublic); + Assert.NotNull(languageServerField); + + var roslynLanguageServer = languageServerField.GetValue(languageServerTarget); + Assert.NotNull(roslynLanguageServer); + + _roslynLanguageServer = roslynLanguageServer; static SystemTextJsonFormatter CreateSystemTextJsonMessageFormatter(AbstractRazorLanguageServerFactoryWrapper languageServerFactory) { @@ -142,6 +155,21 @@ internal Task ExecuteRequestAsync( public async ValueTask DisposeAsync() { + // This is a bit of a hack, but we need to call ShutdownAsync and ExitAsync on the RoslynLanguageServer + // so that it disconnects gracefully from _serverRpc. Otherwise, it'll fail if we dispose _serverRpc + // which forcibly disconnects the JsonRpc from the RoslynLanguageServer. + var shutdownAsyncMethod = _roslynLanguageServer.GetType() + .GetMethod("ShutdownAsync", BindingFlags.Instance | BindingFlags.Public); + Assert.NotNull(shutdownAsyncMethod); + + await (Task)shutdownAsyncMethod.Invoke(_roslynLanguageServer, parameters: [$"{nameof(CSharpTestLspServer)} shutting down"]).AssumeNotNull(); + + var exitAsyncMethod = _roslynLanguageServer.GetType() + .GetMethod("ExitAsync", BindingFlags.Instance | BindingFlags.Public); + Assert.NotNull(exitAsyncMethod); + + await (Task)exitAsyncMethod.Invoke(_roslynLanguageServer, parameters: null).AssumeNotNull(); + _testWorkspace.Dispose(); _exportProvider.Dispose();