From 7d020a5eb22c43759ab729249f6b67813e85e1ee Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 11 Nov 2024 13:32:50 +0000 Subject: [PATCH 1/8] Update dependencies from https://github.com/dotnet/roslyn build 20241118.2 Microsoft.SourceBuild.Intermediate.roslyn , Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.CodeAnalysis.CSharp.CodeStyle , Microsoft.CodeAnalysis.CSharp.Features , Microsoft.CodeAnalysis.CSharp.Workspaces , Microsoft.CodeAnalysis.Workspaces.MSBuild , Microsoft.Net.Compilers.Toolset , Microsoft.Net.Compilers.Toolset.Framework From Version 4.13.0-2.24558.12 -> To Version 4.13.0-2.24568.2 --- eng/Version.Details.xml | 36 ++++++++++++++++++------------------ eng/Versions.props | 16 ++++++++-------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b4968dc2c138..e969c8ab4f43 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -93,43 +93,43 @@ e9dab83bc86ec414b7288d3f8be48a2b14eabb5d - + https://github.com/dotnet/roslyn - c0b2f366d0fb54cf49040a82f0d044bb959a9e73 + 324fd25331c969cd742ba68eee09ffd4b6fd29e3 - + https://github.com/dotnet/roslyn - c0b2f366d0fb54cf49040a82f0d044bb959a9e73 + 324fd25331c969cd742ba68eee09ffd4b6fd29e3 - + https://github.com/dotnet/roslyn - c0b2f366d0fb54cf49040a82f0d044bb959a9e73 + 324fd25331c969cd742ba68eee09ffd4b6fd29e3 - + https://github.com/dotnet/roslyn - c0b2f366d0fb54cf49040a82f0d044bb959a9e73 + 324fd25331c969cd742ba68eee09ffd4b6fd29e3 - + https://github.com/dotnet/roslyn - c0b2f366d0fb54cf49040a82f0d044bb959a9e73 + 324fd25331c969cd742ba68eee09ffd4b6fd29e3 - + https://github.com/dotnet/roslyn - c0b2f366d0fb54cf49040a82f0d044bb959a9e73 + 324fd25331c969cd742ba68eee09ffd4b6fd29e3 - + https://github.com/dotnet/roslyn - c0b2f366d0fb54cf49040a82f0d044bb959a9e73 + 324fd25331c969cd742ba68eee09ffd4b6fd29e3 - + https://github.com/dotnet/roslyn - c0b2f366d0fb54cf49040a82f0d044bb959a9e73 + 324fd25331c969cd742ba68eee09ffd4b6fd29e3 - + https://github.com/dotnet/roslyn - c0b2f366d0fb54cf49040a82f0d044bb959a9e73 + 324fd25331c969cd742ba68eee09ffd4b6fd29e3 https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore diff --git a/eng/Versions.props b/eng/Versions.props index b2a719958c48..5bbd294825c8 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -223,14 +223,14 @@ - 4.13.0-2.24558.12 - 4.13.0-2.24558.12 - 4.13.0-2.24558.12 - 4.13.0-2.24558.12 - 4.13.0-2.24558.12 - 4.13.0-2.24558.12 - 4.13.0-2.24558.12 - 4.13.0-2.24558.12 + 4.13.0-2.24568.2 + 4.13.0-2.24568.2 + 4.13.0-2.24568.2 + 4.13.0-2.24568.2 + 4.13.0-2.24568.2 + 4.13.0-2.24568.2 + 4.13.0-2.24568.2 + 4.13.0-2.24568.2 From d07e858bc77514192f6e34de4c6ff2029dbc0f96 Mon Sep 17 00:00:00 2001 From: Tomas Matousek Date: Thu, 14 Nov 2024 13:44:04 -0800 Subject: [PATCH 2/8] Update to new Roslyn APIs --- .../HotReload/CompilationHandler.cs | 31 ++++++++++++------- .../dotnet-watch/HotReloadDotNetWatcher.cs | 17 +++++----- .../dotnet-watch/Internal/IReporter.cs | 2 +- .../HotReload/ApplyDeltaTests.cs | 24 ++++++-------- .../HotReload/RuntimeProcessLauncherTests.cs | 9 +++--- 5 files changed, 45 insertions(+), 38 deletions(-) diff --git a/src/BuiltInTools/dotnet-watch/HotReload/CompilationHandler.cs b/src/BuiltInTools/dotnet-watch/HotReload/CompilationHandler.cs index b64873f7a74d..2d2903f4b665 100644 --- a/src/BuiltInTools/dotnet-watch/HotReload/CompilationHandler.cs +++ b/src/BuiltInTools/dotnet-watch/HotReload/CompilationHandler.cs @@ -72,7 +72,7 @@ public async ValueTask TerminateNonRootProcessesAndDispose(CancellationToken can Dispose(); } - public ValueTask RestartSessionAsync(ImmutableDictionary projectsToBeRebuilt, CancellationToken cancellationToken) + public void DiscardProjectBaselines(ImmutableDictionary projectsToBeRebuilt, CancellationToken cancellationToken) { // Remove previous updates to all modules that were affected by rude edits. // All running projects that statically reference these modules have been terminated. @@ -85,9 +85,13 @@ public ValueTask RestartSessionAsync(ImmutableDictionary proj _previousUpdates = _previousUpdates.RemoveAll(update => projectsToBeRebuilt.ContainsKey(update.ProjectId)); } - _hotReloadService.EndSession(); - _reporter.Report(MessageDescriptor.HotReloadSessionEnded); - return StartSessionAsync(cancellationToken); + _hotReloadService.UpdateBaselines(Workspace.CurrentSolution, projectsToBeRebuilt.Keys.ToImmutableArray()); + } + + public void UpdateProjectBaselines(ImmutableDictionary projectsToBeRebuilt, CancellationToken cancellationToken) + { + _hotReloadService.UpdateBaselines(Workspace.CurrentSolution, projectsToBeRebuilt.Keys.ToImmutableArray()); + _reporter.Report(MessageDescriptor.ProjectBaselinesUpdated); } public async ValueTask StartSessionAsync(CancellationToken cancellationToken) @@ -275,14 +279,19 @@ private static void PrepareCompilations(Solution solution, string projectPath, C } public async ValueTask<(ImmutableDictionary projectsToRebuild, ImmutableArray terminatedProjects)> HandleFileChangesAsync( - Func, CancellationToken, Task> restartPrompt, + Func, CancellationToken, Task> restartPrompt, CancellationToken cancellationToken) { var currentSolution = Workspace.CurrentSolution; var runningProjects = _runningProjects; - var updates = await _hotReloadService.GetUpdatesAsync(currentSolution, isRunningProject: p => runningProjects.ContainsKey(p.FilePath!), cancellationToken); - var anyProcessNeedsRestart = updates.ProjectsToRestart.Count > 0; + var runningProjectIds = currentSolution.Projects + .Where(project => project.FilePath != null && runningProjects.ContainsKey(project.FilePath)) + .Select(project => project.Id) + .ToImmutableHashSet(); + + var updates = await _hotReloadService.GetUpdatesAsync(currentSolution, runningProjectIds, cancellationToken); + var anyProcessNeedsRestart = !updates.ProjectIdsToRestart.IsEmpty; await DisplayResultsAsync(updates, cancellationToken); @@ -300,13 +309,13 @@ private static void PrepareCompilations(Solution solution, string projectPath, C return (ImmutableDictionary.Empty, []); } - await restartPrompt.Invoke(updates.ProjectsToRestart, cancellationToken); + await restartPrompt.Invoke(updates.ProjectIdsToRestart.Select(id => currentSolution.GetProject(id)!.Name), cancellationToken); // Terminate all tracked processes that need to be restarted, // except for the root process, which will terminate later on. - var terminatedProjects = await TerminateNonRootProcessesAsync(updates.ProjectsToRestart.Select(p => p.FilePath!), cancellationToken); + var terminatedProjects = await TerminateNonRootProcessesAsync(updates.ProjectIdsToRestart.Select(id => currentSolution.GetProject(id)!.FilePath!), cancellationToken); - return (updates.ProjectsToRebuild.ToImmutableDictionary(keySelector: p => p.Id, elementSelector: p => p.FilePath!), terminatedProjects); + return (updates.ProjectIdsToRebuild.ToImmutableDictionary(keySelector: id => id, elementSelector: id => currentSolution.GetProject(id)!.FilePath!), terminatedProjects); } Debug.Assert(updates.Status == ModuleUpdateStatus.Ready); @@ -351,7 +360,7 @@ await ForEachProjectAsync(projectsToUpdate, async (runningProject, cancellationT private async ValueTask DisplayResultsAsync(WatchHotReloadService.Updates updates, CancellationToken cancellationToken) { - var anyProcessNeedsRestart = updates.ProjectsToRestart.Count > 0; + var anyProcessNeedsRestart = !updates.ProjectIdsToRestart.IsEmpty; switch (updates.Status) { diff --git a/src/BuiltInTools/dotnet-watch/HotReloadDotNetWatcher.cs b/src/BuiltInTools/dotnet-watch/HotReloadDotNetWatcher.cs index 45b0fc6d200d..89124521e6f0 100644 --- a/src/BuiltInTools/dotnet-watch/HotReloadDotNetWatcher.cs +++ b/src/BuiltInTools/dotnet-watch/HotReloadDotNetWatcher.cs @@ -255,7 +255,7 @@ void FileChangedCallback(string path, ChangeKind kind) HotReloadEventSource.Log.HotReloadStart(HotReloadEventSource.StartType.CompilationHandler); - var (projectsToRebuild, projectsToRestart) = await compilationHandler.HandleFileChangesAsync(restartPrompt: async (projects, cancellationToken) => + var (projectsToRebuild, projectsToRestart) = await compilationHandler.HandleFileChangesAsync(restartPrompt: async (projectNames, cancellationToken) => { if (_rudeEditRestartPrompt != null) { @@ -271,9 +271,9 @@ void FileChangedCallback(string path, ChangeKind kind) { Context.Reporter.Output("Affected projects:"); - foreach (var project in projects.OrderBy(p => p.Name)) + foreach (var projectName in projectNames.OrderBy(n => n)) { - Context.Reporter.Output(" " + project.Name); + Context.Reporter.Output(" " + projectName); } question = "Do you want to restart these projects?"; @@ -289,9 +289,9 @@ void FileChangedCallback(string path, ChangeKind kind) { Context.Reporter.Verbose("Restarting without prompt since dotnet-watch is running in non-interactive mode."); - foreach (var project in projects) + foreach (var projectName in projectNames) { - Context.Reporter.Verbose($" Project to restart: '{project.Name}'"); + Context.Reporter.Verbose($" Project to restart: '{projectName}'"); } } }, iterationCancellationToken); @@ -312,6 +312,9 @@ void FileChangedCallback(string path, ChangeKind kind) if (projectsToRebuild.Count > 0) { + // Discard baselines before build. + compilationHandler.DiscardProjectBaselines(projectsToRebuild, iterationCancellationToken); + while (true) { iterationCancellationToken.ThrowIfCancellationRequested(); @@ -347,8 +350,8 @@ void FileChangedCallback(string path, ChangeKind kind) // Apply them to the workspace. _ = await CaptureChangedFilesSnapshot(projectsToRebuild); - // Restart session to capture new baseline that reflects the changes to the restarted projects. - await compilationHandler.RestartSessionAsync(projectsToRebuild, iterationCancellationToken); + // Update project baselines to reflect changes to the restarted projects. + compilationHandler.UpdateProjectBaselines(projectsToRebuild, iterationCancellationToken); } if (projectsToRestart is not []) diff --git a/src/BuiltInTools/dotnet-watch/Internal/IReporter.cs b/src/BuiltInTools/dotnet-watch/Internal/IReporter.cs index 20ff02183c39..932c92d59fdd 100644 --- a/src/BuiltInTools/dotnet-watch/Internal/IReporter.cs +++ b/src/BuiltInTools/dotnet-watch/Internal/IReporter.cs @@ -52,7 +52,7 @@ public bool TryGetMessage(string? prefix, object?[] args, [NotNullWhen(true)] ou // predefined messages used for testing: public static readonly MessageDescriptor HotReloadSessionStarting = new(Format: null, Emoji: null, MessageSeverity.None, s_id++); public static readonly MessageDescriptor HotReloadSessionStarted = new("Hot reload session started.", "🔥", MessageSeverity.Verbose, s_id++); - public static readonly MessageDescriptor HotReloadSessionEnded = new("Hot reload session ended.", "🔥", MessageSeverity.Verbose, s_id++); + public static readonly MessageDescriptor ProjectBaselinesUpdated = new("Project baselines updated.", "🔥", MessageSeverity.Verbose, s_id++); public static readonly MessageDescriptor FixBuildError = new("Fix the error to continue or press Ctrl+C to exit.", "⌚", MessageSeverity.Warning, s_id++); public static readonly MessageDescriptor WaitingForChanges = new("Waiting for changes", "⌚", MessageSeverity.Verbose, s_id++); public static readonly MessageDescriptor LaunchedProcess = new("Launched '{0}' with arguments '{1}': process id {2}", "🚀", MessageSeverity.Verbose, s_id++); diff --git a/test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs b/test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs index a2060d3f9470..275dab47e8f0 100644 --- a/test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs +++ b/test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs @@ -459,7 +459,6 @@ public async Task Aspire() Assert.Equal(1, App.Process.Output.Count(line => line.StartsWith("dotnet watch ⌚ Launching browser: "))); App.Process.ClearOutput(); -#if TODO // needs Roslyn update // rude edit with build error: UpdateSourceFile( serviceSourcePath, @@ -484,23 +483,15 @@ public async Task Aspire() } else { - App.AssertOutputContains("dotnet watch ⌚ [WatchAspire.ApiService (net9.0)] Exited"); + // Unix process may return exit code = 128 + SIGTERM + // dotnet watch ❌ [WatchAspire.ApiService (net9.0)] Exited with error code 143 + App.AssertOutputContains("[WatchAspire.ApiService (net9.0)] Exited"); } App.AssertOutputContains($"dotnet watch ⌚ Building '{serviceProjectPath}' ..."); App.AssertOutputContains("error CS0246: The type or namespace name 'WeatherForecast' could not be found"); App.Process.ClearOutput(); - // TODO: remove - Log("dotnet build-server shutdown"); - var workloadInstallCommandSpec = new DotnetCommand(Logger, ["build-server", "shutdown"]) - { - WorkingDirectory = testAsset.Path, - }; - - var result = workloadInstallCommandSpec.Execute(); - Assert.Equal(0, result.ExitCode); - // fix build error: UpdateSourceFile( serviceSourcePath, @@ -509,8 +500,9 @@ public async Task Aspire() await App.AssertOutputLineStartsWith("dotnet watch ⌚ [WatchAspire.ApiService (net9.0)] Capabilities"); App.AssertOutputContains("dotnet watch ⌚ Build succeeded."); + App.AssertOutputContains("dotnet watch 🔥 Project baselines updated."); App.AssertOutputContains($"dotnet watch ⭐ Starting project: {serviceProjectPath}"); -#endif + App.SendControlC(); await App.AssertOutputLineStartsWith("dotnet watch 🛑 Shutdown requested. Press Ctrl+C again to force exit."); @@ -523,8 +515,10 @@ public async Task Aspire() } else { - await App.AssertOutputLineStartsWith("dotnet watch ⌚ [WatchAspire.ApiService (net9.0)] Exited"); - await App.AssertOutputLineStartsWith("dotnet watch ⌚ [WatchAspire.AppHost (net9.0)] Exited"); + // Unix process may return exit code = 128 + SIGTERM + // dotnet watch ❌ [WatchAspire.ApiService (net9.0)] Exited with error code 143 + await App.AssertOutputLine(line => line.Contains("[WatchAspire.ApiService (net9.0)] Exited"), failure: _ => false); + await App.AssertOutputLine(line => line.Contains("[WatchAspire.AppHost (net9.0)] Exited"), failure: _ => false); } await App.AssertOutputLineStartsWith("dotnet watch ⭐ Waiting for server to shutdown ..."); diff --git a/test/dotnet-watch.Tests/HotReload/RuntimeProcessLauncherTests.cs b/test/dotnet-watch.Tests/HotReload/RuntimeProcessLauncherTests.cs index e3b84fb7633b..c4ab7b0db357 100644 --- a/test/dotnet-watch.Tests/HotReload/RuntimeProcessLauncherTests.cs +++ b/test/dotnet-watch.Tests/HotReload/RuntimeProcessLauncherTests.cs @@ -130,7 +130,8 @@ public async Task UpdateAndRudeEdit(TriggerEvent trigger) var changeHandled = reporter.RegisterSemaphore(MessageDescriptor.HotReloadChangeHandled); var sessionStarted = reporter.RegisterSemaphore(MessageDescriptor.HotReloadSessionStarted); - + var projectBaselinesUpdated = reporter.RegisterSemaphore(MessageDescriptor.ProjectBaselinesUpdated); + await launchCompletionA.Task; await launchCompletionB.Task; @@ -146,10 +147,10 @@ public async Task UpdateAndRudeEdit(TriggerEvent trigger) Log("Waiting for changed handled ..."); await changeHandled.WaitAsync(); - // Wait for a new session to start, so that we capture the new solution snapshot + // Wait for project baselines to be updated, so that we capture the new solution snapshot // and further changes are treated as another update. - Log("Waiting for session started..."); - await sessionStarted.WaitAsync(); + Log("Waiting for baselines updated..."); + await projectBaselinesUpdated.WaitAsync(); await MakeValidDependencyChange(); From d54f4f6aabf836c249fe8b2367159748c43ba34f Mon Sep 17 00:00:00 2001 From: Tomas Matousek Date: Sat, 23 Nov 2024 14:39:24 -0800 Subject: [PATCH 3/8] dotnet-watch: Fix buffer size --- .../dotnet-watch/HotReload/DefaultDeltaApplier.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/BuiltInTools/dotnet-watch/HotReload/DefaultDeltaApplier.cs b/src/BuiltInTools/dotnet-watch/HotReload/DefaultDeltaApplier.cs index fd5a94da5380..2ccd307bd6e1 100644 --- a/src/BuiltInTools/dotnet-watch/HotReload/DefaultDeltaApplier.cs +++ b/src/BuiltInTools/dotnet-watch/HotReload/DefaultDeltaApplier.cs @@ -140,10 +140,11 @@ private async Task ReceiveApplyUpdateResult(CancellationToken cancellation var status = ArrayPool.Shared.Rent(1); try { - var statusBytesRead = await _pipe.ReadAsync(status, cancellationToken); + var statusBytesRead = await _pipe.ReadAsync(status, offset: 0, count: 1, cancellationToken); if (statusBytesRead != 1 || status[0] != UpdatePayload.ApplySuccessValue) { - Reporter.Error($"Change failed to apply (error code: '{BitConverter.ToString(status, 0, statusBytesRead)}'). Further changes won't be applied to this process."); + var message = (statusBytesRead == 0) ? "received no data" : $"received status 0x{status[0]:x2}"; + Reporter.Error($"Change failed to apply ({message}). Further changes won't be applied to this process."); return false; } From 582359a6e34a59fb2d4bbd4231194992cd663b5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Matou=C5=A1ek?= Date: Fri, 22 Nov 2024 17:00:21 -0800 Subject: [PATCH 4/8] Disable test ItUsesArtifactsOutputPathForPublish --- test/Microsoft.NET.Build.Tests/ArtifactsOutputPathTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.NET.Build.Tests/ArtifactsOutputPathTests.cs b/test/Microsoft.NET.Build.Tests/ArtifactsOutputPathTests.cs index 4afaaa3a9074..4a4c86049f40 100644 --- a/test/Microsoft.NET.Build.Tests/ArtifactsOutputPathTests.cs +++ b/test/Microsoft.NET.Build.Tests/ArtifactsOutputPathTests.cs @@ -94,7 +94,7 @@ public void ItUsesArtifactsOutputPathForBuild() } } - [Fact] + [Fact(Skip = "https://github.com/dotnet/sdk/issues/45057")] public void ItUsesArtifactsOutputPathForPublish() { var (testProjects, testAsset) = GetTestProjects(); From 7a83a5904337a80afce88935bd9cbc39c91b820d Mon Sep 17 00:00:00 2001 From: Tomas Matousek Date: Sat, 23 Nov 2024 07:51:17 -0800 Subject: [PATCH 5/8] Fix GivenDotnetTestBuildsAndRunsTestFromCsproj tests --- ...enDotnetTestBuildsAndRunsTestfromCsproj.cs | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs index 1af8c78c493d..85d6749e07a5 100644 --- a/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs +++ b/test/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestfromCsproj.cs @@ -18,7 +18,7 @@ public GivenDotnetTestBuildsAndRunsTestFromCsproj(ITestOutputHelper log) : base( [Fact] public void MSTestSingleTFM() { - var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("3"); + var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]); // Call test CommandResult result = new DotnetTestCommand(Log, disableNewOutput: true) @@ -160,7 +160,7 @@ public void GivenAFailingTestItDisplaysFailureDetails() public void ItAcceptsMultipleLoggersAsCliArguments() { // Copy and restore VSTestCore project in output directory of project dotnet-vstest.Tests - var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("10"); + var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]); var trxFileNamePattern = "custom*.trx"; string trxLoggerDirectory = Path.Combine(testProjectDirectory, "RD"); @@ -197,7 +197,7 @@ public void ItAcceptsMultipleLoggersAsCliArguments() public void TestWillNotBuildTheProjectIfNoBuildArgsIsGiven() { // Copy and restore VSTestCore project in output directory of project dotnet-vstest.Tests - var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("5"); + var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]); string configuration = Environment.GetEnvironmentVariable("CONFIGURATION") ?? "Debug"; string expectedError = Path.Combine(testProjectDirectory, "bin", configuration, ToolsetInfo.CurrentTargetFramework, "VSTestCore.dll"); @@ -225,7 +225,7 @@ public void TestWillNotBuildTheProjectIfNoBuildArgsIsGiven() public void TestWillCreateTrxLoggerInTheSpecifiedResultsDirectoryBySwitch() { // Copy and restore VSTestCore project in output directory of project dotnet-vstest.Tests - var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("6"); + var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]); string trxLoggerDirectory = Path.Combine(testProjectDirectory, "TR", "x.y"); @@ -256,7 +256,7 @@ public void TestWillCreateTrxLoggerInTheSpecifiedResultsDirectoryBySwitch() public void ItCreatesTrxReportInTheSpecifiedResultsDirectoryByArgs() { // Copy and restore VSTestCore project in output directory of project dotnet-vstest.Tests - var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("7"); + var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]); var trxFileNamePattern = "custom*.trx"; string trxLoggerDirectory = Path.Combine(testProjectDirectory, "RD"); @@ -342,7 +342,7 @@ public void ItBuildsAndTestsAppWhenRestoringToSpecificDirectory() public void ItUsesVerbosityPassedToDefineVerbosityOfConsoleLoggerOfTheTests(string verbosity, bool shouldShowPassedTests) { // Copy and restore VSTestCore project in output directory of project dotnet-vstest.Tests - var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp($"9_{verbosity}"); + var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([verbosity, shouldShowPassedTests]); // Call test CommandResult result = new DotnetTestCommand(Log, disableNewOutput: true) @@ -414,7 +414,7 @@ public void ItTestsWithTheSpecifiedRuntimeOption() public void ItAcceptsNoLogoAsCliArguments() { // Copy and restore VSTestCore project in output directory of project dotnet-vstest.Tests - var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("14"); + var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]); // Call test with logger enable CommandResult result = new DotnetTestCommand(Log, disableNewOutput: true) @@ -434,7 +434,7 @@ public void ItAcceptsNoLogoAsCliArguments() [PlatformSpecificFact(TestPlatforms.Windows)] public void ItCreatesCoverageFileWhenCodeCoverageEnabledByRunsettings() { - var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("11"); + var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]); string resultsDirectory = Path.Combine(testProjectDirectory, "RD"); @@ -475,7 +475,7 @@ public void ItCreatesCoverageFileWhenCodeCoverageEnabledByRunsettings() [PlatformSpecificFact(TestPlatforms.Windows | TestPlatforms.OSX | TestPlatforms.Linux)] public void ItCreatesCoverageFileInResultsDirectory() { - var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("12"); + var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]); string resultsDirectory = Path.Combine(testProjectDirectory, "RD"); @@ -511,7 +511,7 @@ public void ItCreatesCoverageFileInResultsDirectory() [PlatformSpecificFact(TestPlatforms.Windows | TestPlatforms.OSX | TestPlatforms.Linux)] public void ItCreatesCoberturaFileProvidedByCommandInResultsDirectory() { - var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("15"); + var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]); string resultsDirectory = Path.Combine(testProjectDirectory, "RD"); @@ -547,7 +547,7 @@ public void ItCreatesCoberturaFileProvidedByCommandInResultsDirectory() [PlatformSpecificFact(TestPlatforms.Windows)] public void ItHandlesMultipleCollectCommandInResultsDirectory() { - var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("16"); + var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]); string resultsDirectory = Path.Combine(testProjectDirectory, "RD"); @@ -588,7 +588,7 @@ public void ItHandlesMultipleCollectCommandInResultsDirectory() [PlatformSpecificFact(TestPlatforms.FreeBSD)] public void ItShouldShowWarningMessageOnCollectCodeCoverage() { - var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp("13"); + var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([]); // Call test CommandResult result = new DotnetTestCommand(Log, disableNewOutput: true) @@ -714,7 +714,7 @@ public void FilterPropertyCorrectlyHandlesComma(string filter, string folderSuff [InlineData("--results-directory")] public void EnsureOutputPathEscaped(string flag) { - var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp(flag); + var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([flag]); var pathWithComma = Path.Combine(AppContext.BaseDirectory, "a,b"); @@ -763,7 +763,7 @@ public void PathEndsWithSlashOrBackslash(string flag, string slashesOrBackslashe { // NOTE: We also want to test with forward slashes because on Windows they // are converted to backslashes and so need to be handled correctly. - string testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp(Guid.NewGuid().ToString()); + string testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([flag, slashesOrBackslashes]); string flagDirectory = Path.Combine(testProjectDirectory, "flag-dir"); // Call test @@ -788,7 +788,7 @@ public void PathEndsWithSlashOrBackslash(string flag, string slashesOrBackslashe [InlineData("-e:foo=barexe")] public void ArgumentsEndWithDllOrExeShouldNotFail(string arg) { - var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp(); + var testProjectDirectory = CopyAndRestoreVSTestDotNetCoreTestApp([arg]); // Call test CommandResult result = new DotnetTestCommand(Log, disableNewOutput: true) @@ -804,12 +804,12 @@ public void ArgumentsEndWithDllOrExeShouldNotFail(string arg) } } - private string CopyAndRestoreVSTestDotNetCoreTestApp([CallerMemberName] string callingMethod = "") + private string CopyAndRestoreVSTestDotNetCoreTestApp(object[] parameters, [CallerMemberName] string callingMethod = "") { // Copy VSTestCore project in output directory of project dotnet-vstest.Tests string testAppName = "VSTestCore"; - var testInstance = _testAssetsManager.CopyTestAsset(testAppName, callingMethod: callingMethod) + var testInstance = _testAssetsManager.CopyTestAsset(testAppName, callingMethod: callingMethod, identifier: string.Join(",", parameters.Select(p => p.ToString()))) .WithSource() .WithVersionVariables(); From d549fca7ccc7002ad6ac4f6c7cb3da5b80c6041b Mon Sep 17 00:00:00 2001 From: Tomas Matousek Date: Sat, 23 Nov 2024 17:50:52 -0800 Subject: [PATCH 6/8] Write command output to test output as soon as available --- .../Commands/TestCommand.cs | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/test/Microsoft.NET.TestFramework/Commands/TestCommand.cs b/test/Microsoft.NET.TestFramework/Commands/TestCommand.cs index 55b8c0181e83..91d10b15d4c4 100644 --- a/test/Microsoft.NET.TestFramework/Commands/TestCommand.cs +++ b/test/Microsoft.NET.TestFramework/Commands/TestCommand.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. using System.Diagnostics; @@ -120,19 +120,30 @@ private static bool SuccessOrNotTransientRestoreError(CommandResult result) public virtual CommandResult Execute(IEnumerable args) { - var command = CreateCommandSpec(args) + var spec = CreateCommandSpec(args); + + var command = spec .ToCommand(_doNotEscapeArguments) .CaptureStdOut() .CaptureStdErr(); - if (CommandOutputHandler != null) + command.OnOutputLine(line => { - command.OnOutputLine(CommandOutputHandler); - } + Log.WriteLine($"》{line}"); + CommandOutputHandler?.Invoke(line); + }); - var result = ((Command)command).Execute(ProcessStartedHandler); + command.OnErrorLine(line => + { + Log.WriteLine($"❌{line}"); + CommandOutputHandler?.Invoke(line); + }); + + var display = $"dotnet {string.Join(" ", spec.Arguments)}"; - LogCommandResult(Log, result); + Log.WriteLine($"Executing '{display}':"); + var result = ((Command)command).Execute(ProcessStartedHandler); + Log.WriteLine($"Command '{display}' exited with exit code {result.ExitCode}."); return result; } From 67ff5973e34dd9a160a415a94969a46fe80f9895 Mon Sep 17 00:00:00 2001 From: Tomas Matousek Date: Sat, 23 Nov 2024 17:51:40 -0800 Subject: [PATCH 7/8] Fix --- test/Microsoft.NET.TestFramework/Commands/TestCommand.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/test/Microsoft.NET.TestFramework/Commands/TestCommand.cs b/test/Microsoft.NET.TestFramework/Commands/TestCommand.cs index 91d10b15d4c4..ebbdcadba8e2 100644 --- a/test/Microsoft.NET.TestFramework/Commands/TestCommand.cs +++ b/test/Microsoft.NET.TestFramework/Commands/TestCommand.cs @@ -136,7 +136,6 @@ public virtual CommandResult Execute(IEnumerable args) command.OnErrorLine(line => { Log.WriteLine($"❌{line}"); - CommandOutputHandler?.Invoke(line); }); var display = $"dotnet {string.Join(" ", spec.Arguments)}"; From b1e3e343d6b0025c3c3a4c4e2233f80e1b84a024 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 24 Nov 2024 02:57:24 +0000 Subject: [PATCH 8/8] Update dependencies from https://github.com/dotnet/roslyn build 20241123.1 Microsoft.SourceBuild.Intermediate.roslyn , Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.CodeAnalysis.CSharp.CodeStyle , Microsoft.CodeAnalysis.CSharp.Features , Microsoft.CodeAnalysis.CSharp.Workspaces , Microsoft.CodeAnalysis.Workspaces.MSBuild , Microsoft.Net.Compilers.Toolset , Microsoft.Net.Compilers.Toolset.Framework From Version 4.13.0-2.24558.12 -> To Version 4.13.0-2.24573.1 --- eng/Version.Details.xml | 36 ++++++++++++++++++------------------ eng/Versions.props | 16 ++++++++-------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e969c8ab4f43..c6fd30ac8153 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -93,43 +93,43 @@ e9dab83bc86ec414b7288d3f8be48a2b14eabb5d - + https://github.com/dotnet/roslyn - 324fd25331c969cd742ba68eee09ffd4b6fd29e3 + 235c3b8625197dfdcc0c3b13186d104f362df2e8 - + https://github.com/dotnet/roslyn - 324fd25331c969cd742ba68eee09ffd4b6fd29e3 + 235c3b8625197dfdcc0c3b13186d104f362df2e8 - + https://github.com/dotnet/roslyn - 324fd25331c969cd742ba68eee09ffd4b6fd29e3 + 235c3b8625197dfdcc0c3b13186d104f362df2e8 - + https://github.com/dotnet/roslyn - 324fd25331c969cd742ba68eee09ffd4b6fd29e3 + 235c3b8625197dfdcc0c3b13186d104f362df2e8 - + https://github.com/dotnet/roslyn - 324fd25331c969cd742ba68eee09ffd4b6fd29e3 + 235c3b8625197dfdcc0c3b13186d104f362df2e8 - + https://github.com/dotnet/roslyn - 324fd25331c969cd742ba68eee09ffd4b6fd29e3 + 235c3b8625197dfdcc0c3b13186d104f362df2e8 - + https://github.com/dotnet/roslyn - 324fd25331c969cd742ba68eee09ffd4b6fd29e3 + 235c3b8625197dfdcc0c3b13186d104f362df2e8 - + https://github.com/dotnet/roslyn - 324fd25331c969cd742ba68eee09ffd4b6fd29e3 + 235c3b8625197dfdcc0c3b13186d104f362df2e8 - + https://github.com/dotnet/roslyn - 324fd25331c969cd742ba68eee09ffd4b6fd29e3 + 235c3b8625197dfdcc0c3b13186d104f362df2e8 https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore diff --git a/eng/Versions.props b/eng/Versions.props index 5bbd294825c8..5e9b7162a7a7 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -223,14 +223,14 @@ - 4.13.0-2.24568.2 - 4.13.0-2.24568.2 - 4.13.0-2.24568.2 - 4.13.0-2.24568.2 - 4.13.0-2.24568.2 - 4.13.0-2.24568.2 - 4.13.0-2.24568.2 - 4.13.0-2.24568.2 + 4.13.0-2.24573.1 + 4.13.0-2.24573.1 + 4.13.0-2.24573.1 + 4.13.0-2.24573.1 + 4.13.0-2.24573.1 + 4.13.0-2.24573.1 + 4.13.0-2.24573.1 + 4.13.0-2.24573.1