diff --git a/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Wasm/Uno.UI.RuntimeTests.Engine.Wasm.csproj b/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Wasm/Uno.UI.RuntimeTests.Engine.Wasm.csproj index 920a8c6..741af2f 100644 --- a/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Wasm/Uno.UI.RuntimeTests.Engine.Wasm.csproj +++ b/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Wasm/Uno.UI.RuntimeTests.Engine.Wasm.csproj @@ -51,7 +51,7 @@ - + diff --git a/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Wasm/Uno.UI.RuntimeTests.Engine.Wasm.csproj b/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Wasm/Uno.UI.RuntimeTests.Engine.Wasm.csproj index 2fdc76c..9503b20 100644 --- a/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Wasm/Uno.UI.RuntimeTests.Engine.Wasm.csproj +++ b/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Wasm/Uno.UI.RuntimeTests.Engine.Wasm.csproj @@ -51,7 +51,7 @@ - + diff --git a/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/ProcessHelper.cs b/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/ProcessHelper.cs index 074fdbb..40fe1c2 100644 --- a/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/ProcessHelper.cs +++ b/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/ProcessHelper.cs @@ -150,7 +150,7 @@ private static Process SetupProcess( public static async Task WaitForExitWithCancellationAsync(this Process process, CancellationToken ct) { await using var cancel = ct.Register(process.Close); - await process.WaitForExitAsync(ct); + await process.WaitForExitAsync(CancellationToken.None); // If the ct has been cancelled, we want to wait for exit! } public static void EnsureSuccess(this Process process, ILogger log, StringBuilder error) diff --git a/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/SecondaryApp.cs b/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/SecondaryApp.cs index ba77c4f..88e2636 100644 --- a/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/SecondaryApp.cs +++ b/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/SecondaryApp.cs @@ -63,9 +63,18 @@ internal static async Task RunTest(UnitTestEngineConfig config var resultFile = await RunLocalApp("127.0.0.1", devServer.Port, config, isAppVisible, ct); // Finally, read the test results - var results = await JsonSerializer.DeserializeAsync(File.OpenRead(resultFile), cancellationToken: ct); - - return results ?? Array.Empty(); + try + { + var results = await JsonSerializer.DeserializeAsync(File.OpenRead(resultFile), cancellationToken: ct); + + return results ?? Array.Empty(); + } + catch (JsonException error) + { + throw new InvalidOperationException( + $"Failed to deserialize the test results from '{resultFile}', this usually indicates that the secondary app has been closed (or crashed) before the end of the test suit.", + error); + } } private static async Task RunLocalApp(string devServerHost, int devServerPort, UnitTestEngineConfig config, bool isAppVisible, CancellationToken ct) diff --git a/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/HotReloadHelper.cs b/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/HotReloadHelper.cs index 62b228f..e0137f9 100644 --- a/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/HotReloadHelper.cs +++ b/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/HotReloadHelper.cs @@ -101,13 +101,13 @@ public static partial class HotReloadHelper throw new InvalidOperationException("The project file path could not be found."); } + var projectDir = Path.GetDirectoryName(projectFile); #if __SKIA__ if (!File.Exists(projectFile)) // Sanity! { throw new InvalidOperationException("Unable to find project file."); } - var projectDir = Path.GetDirectoryName(projectFile); if (!Directory.Exists(projectDir)) { throw new InvalidOperationException("Unable to find project directory.");