From 502713a8bad6405a2067555809aaba53649a22f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ayta=C3=A7=20Kayadelen?= Date: Sun, 24 Mar 2024 01:07:25 +0100 Subject: [PATCH] cancel initializing devices on DM shutdown --- Project-Aurora/AuroraDeviceManager/Devices/DeviceManager.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Project-Aurora/AuroraDeviceManager/Devices/DeviceManager.cs b/Project-Aurora/AuroraDeviceManager/Devices/DeviceManager.cs index 7eab94701..b57857877 100644 --- a/Project-Aurora/AuroraDeviceManager/Devices/DeviceManager.cs +++ b/Project-Aurora/AuroraDeviceManager/Devices/DeviceManager.cs @@ -103,7 +103,8 @@ private static bool DeviceEnabled(DeviceContainer dc) public Task ShutdownDevices() { - var shutdownTasks = InitializedDeviceContainers.Select(dc => dc.DisableDevice()); + var startingDevices = DeviceContainers.Where(dc => dc.Device is { IsInitialized: false, IsDoingWork: true }); + var shutdownTasks = InitializedDeviceContainers.Union(startingDevices).Select(dc => dc.DisableDevice()); return Task.WhenAll(shutdownTasks); }