diff --git a/Laerdal.McuMgr.slnx.DotSettings.user b/Laerdal.McuMgr.slnx.DotSettings.user index 8e5f73b..b93224e 100644 --- a/Laerdal.McuMgr.slnx.DotSettings.user +++ b/Laerdal.McuMgr.slnx.DotSettings.user @@ -6,6 +6,10 @@ <SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from Solution" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> <Solution /> </SessionState> + True + True + True + True diff --git a/Laerdal.McuMgr/Shared/Common/Helpers/TaskCompletionSourceExtensions.cs b/Laerdal.McuMgr/Shared/Common/Helpers/TaskCompletionSourceExtensions.cs index d245727..9fa8c0a 100644 --- a/Laerdal.McuMgr/Shared/Common/Helpers/TaskCompletionSourceExtensions.cs +++ b/Laerdal.McuMgr/Shared/Common/Helpers/TaskCompletionSourceExtensions.cs @@ -12,7 +12,7 @@ namespace Laerdal.McuMgr.Common.Helpers /// Task is not actually in a "scheduler" (since TCS tasks are Promise Tasks) /// never completing tasks, of any type, is generally considered a bug. /// - public static class TaskCompletionSourceExtensions + static internal class TaskCompletionSourceExtensions { /// /// Sets up a timeout-monitor on the given task. This is essentially a wrapper around @@ -35,7 +35,7 @@ public static class TaskCompletionSourceExtensions /// try /// { /// PropertyChanged += MyEventHandler_; - /// await tcs.WaitTaskWithOptionalTimeoutAsync(timeout); + /// await tcs.WaitAndFossilizeTaskWithOptionalTimeoutAsync(timeout); /// } /// finally /// { @@ -60,11 +60,11 @@ public static class TaskCompletionSourceExtensions /// } /// } /// - public static Task WaitTaskWithOptionalTimeoutAsync(this TaskCompletionSource tcs, int timeoutInMilliseconds, CancellationToken cancellationToken = default) + public static Task WaitAndFossilizeTaskWithOptionalTimeoutAsync(this TaskCompletionSource tcs, int timeoutInMilliseconds, CancellationToken cancellationToken = default) { return timeoutInMilliseconds <= 0 ? tcs.Task - : tcs.WaitTaskWithTimeoutAsync(TimeSpan.FromMilliseconds(timeoutInMilliseconds), cancellationToken); + : tcs.WaitAndFossilizeTaskWithTimeoutAsync(TimeSpan.FromMilliseconds(timeoutInMilliseconds), cancellationToken); } /// @@ -88,7 +88,7 @@ public static Task WaitTaskWithOptionalTimeoutAsync(this TaskCompletionSource tc /// try /// { /// PropertyChanged += MyEventHandler_; - /// await tcs.WaitTaskWithOptionalTimeoutAsync(timeout); + /// await tcs.WaitAndFossilizeTaskWithOptionalTimeoutAsync(timeout); /// } /// finally /// { @@ -113,11 +113,11 @@ public static Task WaitTaskWithOptionalTimeoutAsync(this TaskCompletionSource tc /// } /// } /// - public static Task WaitTaskWithOptionalTimeoutAsync(this TaskCompletionSource tcs, TimeSpan timespan, CancellationToken cancellationToken = default) + public static Task WaitAndFossilizeTaskWithOptionalTimeoutAsync(this TaskCompletionSource tcs, TimeSpan timespan, CancellationToken cancellationToken = default) { return timespan <= TimeSpan.Zero ? tcs.Task - : tcs.WaitTaskWithTimeoutAsync(timespan, cancellationToken); + : tcs.WaitAndFossilizeTaskWithTimeoutAsync(timespan, cancellationToken); } /// @@ -142,7 +142,7 @@ public static Task WaitTaskWithOptionalTimeoutAsync(this TaskCompletionSource tc /// try /// { /// PropertyChanged += MyEventHandler_; - /// await tcs.WaitTaskWithOptionalTimeoutAsync(timeout); + /// await tcs.WaitAndFossilizeTaskWithOptionalTimeoutAsync(timeout); /// } /// finally /// { @@ -167,9 +167,9 @@ public static Task WaitTaskWithOptionalTimeoutAsync(this TaskCompletionSource tc /// } /// } /// - public static Task WaitTaskWithTimeoutAsync(this TaskCompletionSource tcs, int timeoutInMilliseconds, CancellationToken cancellationToken = default) + public static Task WaitAndFossilizeTaskWithTimeoutAsync(this TaskCompletionSource tcs, int timeoutInMilliseconds, CancellationToken cancellationToken = default) { - return tcs.WaitTaskWithTimeoutAsync(TimeSpan.FromMilliseconds(timeoutInMilliseconds), cancellationToken); + return tcs.WaitAndFossilizeTaskWithTimeoutAsync(TimeSpan.FromMilliseconds(timeoutInMilliseconds), cancellationToken); } /// @@ -194,7 +194,7 @@ public static Task WaitTaskWithTimeoutAsync(this TaskCompletionSource tcs, int t /// try /// { /// PropertyChanged += MyEventHandler_; - /// await tcs.WaitTaskWithTimeoutAsync(timeout); + /// await tcs.WaitAndFossilizeTaskWithTimeoutAsync(timeout); /// } /// finally /// { @@ -219,7 +219,7 @@ public static Task WaitTaskWithTimeoutAsync(this TaskCompletionSource tcs, int t /// } /// } /// - public async static Task WaitTaskWithTimeoutAsync(this TaskCompletionSource tcs, TimeSpan timespan, CancellationToken cancellationToken = default) + public async static Task WaitAndFossilizeTaskWithTimeoutAsync(this TaskCompletionSource tcs, TimeSpan timespan, CancellationToken cancellationToken = default) { if (timespan < TimeSpan.Zero) //note that this deviates from the behaviour of .WaitAsync() which does accept -1 milliseconds which means "wait forever" { @@ -279,7 +279,7 @@ public async static Task WaitTaskWithTimeoutAsync(this TaskCompletionSource tcs, /// try /// { /// PropertyChanged += MyEventHandler_; - /// await tcs.WaitTaskWithTimeoutAsync<int>(timeout); + /// await tcs.WaitAndFossilizeTaskWithTimeoutAsync<int>(timeout); /// } /// finally /// { @@ -304,11 +304,11 @@ public async static Task WaitTaskWithTimeoutAsync(this TaskCompletionSource tcs, /// } /// } /// - public static Task WaitTaskWithOptionalTimeoutAsync(this TaskCompletionSource tcs, int timeoutInMilliseconds, CancellationToken cancellationToken = default) + public static Task WaitAndFossilizeTaskWithOptionalTimeoutAsync(this TaskCompletionSource tcs, int timeoutInMilliseconds, CancellationToken cancellationToken = default) { return timeoutInMilliseconds <= 0 ? tcs.Task - : tcs.WaitTaskWithTimeoutAsync(TimeSpan.FromMilliseconds(timeoutInMilliseconds), cancellationToken); + : tcs.WaitAndFossilizeTaskWithTimeoutAsync(TimeSpan.FromMilliseconds(timeoutInMilliseconds), cancellationToken); } /// @@ -332,7 +332,7 @@ public static Task WaitTaskWithOptionalTimeoutAsync(this TaskCompletionSou /// try /// { /// PropertyChanged += MyEventHandler_; - /// await tcs.WaitTaskWithOptionalTimeoutAsync<int>(timeout); + /// await tcs.WaitAndFossilizeTaskWithOptionalTimeoutAsync<int>(timeout); /// } /// finally /// { @@ -357,11 +357,11 @@ public static Task WaitTaskWithOptionalTimeoutAsync(this TaskCompletionSou /// } /// } /// - public static Task WaitTaskWithOptionalTimeoutAsync(this TaskCompletionSource tcs, TimeSpan timespan, CancellationToken cancellationToken = default) + public static Task WaitAndFossilizeTaskWithOptionalTimeoutAsync(this TaskCompletionSource tcs, TimeSpan timespan, CancellationToken cancellationToken = default) { return timespan <= TimeSpan.Zero ? tcs.Task - : tcs.WaitTaskWithTimeoutAsync(timespan, cancellationToken); + : tcs.WaitAndFossilizeTaskWithTimeoutAsync(timespan, cancellationToken); } /// @@ -385,7 +385,7 @@ public static Task WaitTaskWithOptionalTimeoutAsync(this TaskCompletionSou /// try /// { /// PropertyChanged += MyEventHandler_; - /// await tcs.WaitTaskWithTimeoutAsync<int>(timeout); + /// await tcs.WaitAndFossilizeTaskWithTimeoutAsync<int>(timeout); /// } /// finally /// { @@ -410,9 +410,9 @@ public static Task WaitTaskWithOptionalTimeoutAsync(this TaskCompletionSou /// } /// } /// - public static Task WaitTaskWithTimeoutAsync(this TaskCompletionSource tcs, int timeoutInMilliseconds, CancellationToken cancellationToken = default) + public static Task WaitAndFossilizeTaskWithTimeoutAsync(this TaskCompletionSource tcs, int timeoutInMilliseconds, CancellationToken cancellationToken = default) { - return tcs.WaitTaskWithTimeoutAsync(TimeSpan.FromMilliseconds(timeoutInMilliseconds), cancellationToken); + return tcs.WaitAndFossilizeTaskWithTimeoutAsync(TimeSpan.FromMilliseconds(timeoutInMilliseconds), cancellationToken); } /// @@ -436,7 +436,7 @@ public static Task WaitTaskWithTimeoutAsync(this TaskCompletionSource t /// try /// { /// PropertyChanged += MyEventHandler_; - /// await tcs.WaitTaskWithTimeoutAsync<int>(timeout); + /// await tcs.WaitAndFossilizeTaskWithTimeoutAsync<int>(timeout); /// } /// finally /// { @@ -461,7 +461,7 @@ public static Task WaitTaskWithTimeoutAsync(this TaskCompletionSource t /// } /// } /// - public async static Task WaitTaskWithTimeoutAsync(this TaskCompletionSource tcs, TimeSpan timespan, CancellationToken cancellationToken = default) + public async static Task WaitAndFossilizeTaskWithTimeoutAsync(this TaskCompletionSource tcs, TimeSpan timespan, CancellationToken cancellationToken = default) { if (timespan < TimeSpan.Zero) //note that this deviates from the behaviour of .WaitAsync() which does accept -1 milliseconds which means "wait forever" { diff --git a/Laerdal.McuMgr/Shared/DeviceResetter/DeviceResetter.cs b/Laerdal.McuMgr/Shared/DeviceResetter/DeviceResetter.cs index 78f98c0..b23a155 100644 --- a/Laerdal.McuMgr/Shared/DeviceResetter/DeviceResetter.cs +++ b/Laerdal.McuMgr/Shared/DeviceResetter/DeviceResetter.cs @@ -109,7 +109,7 @@ public async Task ResetAsync(int timeoutInMs = -1) if (verdict != EDeviceResetterInitializationVerdict.Success) throw new ArgumentException(verdict.ToString()); - await taskCompletionSource.WaitTaskWithOptionalTimeoutAsync(timeoutInMs); + await taskCompletionSource.WaitAndFossilizeTaskWithOptionalTimeoutAsync(timeoutInMs); } catch (TimeoutException ex) { diff --git a/Laerdal.McuMgr/Shared/FileDownloader/FileDownloader.cs b/Laerdal.McuMgr/Shared/FileDownloader/FileDownloader.cs index 61df02e..811cacf 100644 --- a/Laerdal.McuMgr/Shared/FileDownloader/FileDownloader.cs +++ b/Laerdal.McuMgr/Shared/FileDownloader/FileDownloader.cs @@ -285,7 +285,7 @@ public async Task DownloadAsync( if (verdict != EFileDownloaderVerdict.Success) throw new ArgumentException(verdict.ToString()); - result = await taskCompletionSource.WaitTaskWithOptionalTimeoutAsync(timeoutForDownloadInMs); + result = await taskCompletionSource.WaitAndFossilizeTaskWithOptionalTimeoutAsync(timeoutForDownloadInMs); break; } catch (TimeoutException ex) diff --git a/Laerdal.McuMgr/Shared/FileUploader/FileUploader.cs b/Laerdal.McuMgr/Shared/FileUploader/FileUploader.cs index 7ab5240..8d7f2d7 100644 --- a/Laerdal.McuMgr/Shared/FileUploader/FileUploader.cs +++ b/Laerdal.McuMgr/Shared/FileUploader/FileUploader.cs @@ -352,7 +352,7 @@ public async Task UploadAsync( if (verdict != EFileUploaderVerdict.Success) throw new ArgumentException(verdict.ToString()); - await taskCompletionSource.WaitTaskWithOptionalTimeoutAsync(timeoutForUploadInMs); //order + await taskCompletionSource.WaitAndFossilizeTaskWithOptionalTimeoutAsync(timeoutForUploadInMs); //order break; } catch (TimeoutException ex) diff --git a/Laerdal.McuMgr/Shared/FirmwareEraser/FirmwareEraser.cs b/Laerdal.McuMgr/Shared/FirmwareEraser/FirmwareEraser.cs index ba9d5ba..ff14369 100644 --- a/Laerdal.McuMgr/Shared/FirmwareEraser/FirmwareEraser.cs +++ b/Laerdal.McuMgr/Shared/FirmwareEraser/FirmwareEraser.cs @@ -125,7 +125,7 @@ public async Task EraseAsync(int imageIndex = 1, int timeoutInMs = -1) if (verdict != EFirmwareErasureInitializationVerdict.Success) throw new ArgumentException(verdict.ToString()); - await taskCompletionSource.WaitTaskWithOptionalTimeoutAsync(timeoutInMs); + await taskCompletionSource.WaitAndFossilizeTaskWithOptionalTimeoutAsync(timeoutInMs); } catch (TimeoutException ex) { diff --git a/Laerdal.McuMgr/Shared/FirmwareInstaller/FirmwareInstaller.cs b/Laerdal.McuMgr/Shared/FirmwareInstaller/FirmwareInstaller.cs index f4d558b..336caf3 100644 --- a/Laerdal.McuMgr/Shared/FirmwareInstaller/FirmwareInstaller.cs +++ b/Laerdal.McuMgr/Shared/FirmwareInstaller/FirmwareInstaller.cs @@ -266,7 +266,7 @@ public async Task InstallAsync( if (verdict != EFirmwareInstallationVerdict.Success) throw new ArgumentException(verdict.ToString()); - await taskCompletionSource.WaitTaskWithOptionalTimeoutAsync(timeoutInMs); + await taskCompletionSource.WaitAndFossilizeTaskWithOptionalTimeoutAsync(timeoutInMs); } catch (TimeoutException ex) {