Skip to content

Commit 0d56966

Browse files
authored
Fix Change failed to apply (error code: ...) intermittent failures (#45097)
1 parent 40c57de commit 0d56966

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/BuiltInTools/dotnet-watch/HotReload/DefaultDeltaApplier.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,11 @@ private async Task<bool> ReceiveApplyUpdateResult(CancellationToken cancellation
136136
var status = ArrayPool<byte>.Shared.Rent(1);
137137
try
138138
{
139-
var statusBytesRead = await _pipe.ReadAsync(status, cancellationToken);
139+
var statusBytesRead = await _pipe.ReadAsync(status, offset: 0, count: 1, cancellationToken);
140140
if (statusBytesRead != 1 || status[0] != UpdatePayload.ApplySuccessValue)
141141
{
142-
Reporter.Error($"Change failed to apply (error code: '{BitConverter.ToString(status, 0, statusBytesRead)}'). Further changes won't be applied to this process.");
142+
var message = (statusBytesRead == 0) ? "received no data" : $"received status 0x{status[0]:x2}";
143+
Reporter.Error($"Change failed to apply ({message}). Further changes won't be applied to this process.");
143144
return false;
144145
}
145146

test/HelixTasks/SDKCustomCreateXUnitWorkItemsWithTestExclusion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ private async Task<List<ITaskItem>> PrepareWorkItem(ITaskItem xunitProject)
152152

153153
var testFilter = string.IsNullOrEmpty(assemblyPartitionInfo.ClassListArgumentString) ? "" : $"--filter \"{assemblyPartitionInfo.ClassListArgumentString}\"";
154154
command = $"{driver} test {assemblyName} -e HELIX_WORK_ITEM_TIMEOUT={timeout} {testExecutionDirectory} {msbuildAdditionalSdkResolverFolder} " +
155-
$"{(XUnitArguments != null ? " " + XUnitArguments : "")} --results-directory .{Path.DirectorySeparatorChar} --logger trx --blame-hang --blame-hang-timeout 30m {testFilter} -- {arguments}";
155+
$"{(XUnitArguments != null ? " " + XUnitArguments : "")} --results-directory .{Path.DirectorySeparatorChar} --logger trx --logger \"console;verbosity=detailed\" --blame-hang --blame-hang-timeout 30m {testFilter} -- {arguments}";
156156

157157
Log.LogMessage($"Creating work item with properties Identity: {assemblyName}, PayloadDirectory: {publishDirectory}, Command: {command}");
158158

test/dotnet-watch.Tests/HotReload/ApplyDeltaTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public static void Print()
6868
await App.AssertOutputLineStartsWith("Changed!");
6969
}
7070

71-
[Fact]
71+
[Fact(Skip = "https://github.com/dotnet/sdk/issues/45457")]
7272
public async Task ChangeFileInFSharpProject()
7373
{
7474
var testAsset = TestAssets.CopyTestAsset("FSharpTestAppSimple")

0 commit comments

Comments
 (0)