From 0d5696626019b1780706ef2c98f9cfc6189b596b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Matou=C5=A1ek?= Date: Fri, 13 Dec 2024 14:10:30 -0800 Subject: [PATCH] Fix `Change failed to apply (error code: ...)` intermittent failures (#45097) --- .../dotnet-watch/HotReload/DefaultDeltaApplier.cs | 5 +++-- .../SDKCustomCreateXUnitWorkItemsWithTestExclusion.cs | 2 +- test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/BuiltInTools/dotnet-watch/HotReload/DefaultDeltaApplier.cs b/src/BuiltInTools/dotnet-watch/HotReload/DefaultDeltaApplier.cs index ca0fe1297410..4c703612ffb3 100644 --- a/src/BuiltInTools/dotnet-watch/HotReload/DefaultDeltaApplier.cs +++ b/src/BuiltInTools/dotnet-watch/HotReload/DefaultDeltaApplier.cs @@ -136,10 +136,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; } diff --git a/test/HelixTasks/SDKCustomCreateXUnitWorkItemsWithTestExclusion.cs b/test/HelixTasks/SDKCustomCreateXUnitWorkItemsWithTestExclusion.cs index 99f111f3c177..24b8237217b1 100644 --- a/test/HelixTasks/SDKCustomCreateXUnitWorkItemsWithTestExclusion.cs +++ b/test/HelixTasks/SDKCustomCreateXUnitWorkItemsWithTestExclusion.cs @@ -152,7 +152,7 @@ private async Task> PrepareWorkItem(ITaskItem xunitProject) var testFilter = string.IsNullOrEmpty(assemblyPartitionInfo.ClassListArgumentString) ? "" : $"--filter \"{assemblyPartitionInfo.ClassListArgumentString}\""; command = $"{driver} test {assemblyName} -e HELIX_WORK_ITEM_TIMEOUT={timeout} {testExecutionDirectory} {msbuildAdditionalSdkResolverFolder} " + - $"{(XUnitArguments != null ? " " + XUnitArguments : "")} --results-directory .{Path.DirectorySeparatorChar} --logger trx --blame-hang --blame-hang-timeout 30m {testFilter} -- {arguments}"; + $"{(XUnitArguments != null ? " " + XUnitArguments : "")} --results-directory .{Path.DirectorySeparatorChar} --logger trx --logger \"console;verbosity=detailed\" --blame-hang --blame-hang-timeout 30m {testFilter} -- {arguments}"; Log.LogMessage($"Creating work item with properties Identity: {assemblyName}, PayloadDirectory: {publishDirectory}, Command: {command}"); diff --git a/test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs b/test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs index 23f3076915a9..1ced8644525a 100644 --- a/test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs +++ b/test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs @@ -68,7 +68,7 @@ public static void Print() await App.AssertOutputLineStartsWith("Changed!"); } - [Fact] + [Fact(Skip = "https://github.com/dotnet/sdk/issues/45457")] public async Task ChangeFileInFSharpProject() { var testAsset = TestAssets.CopyTestAsset("FSharpTestAppSimple")