Attempted fix for the ArgumentException when calling ITaskService.GetRunningTasks on some systems.

This commit is contained in:
Michael Möller 2020-02-25 23:25:52 +01:00
parent 56ee2f5c0d
commit c827a83dff

View File

@ -4,7 +4,7 @@
License, v. 2.0. If a copy of the MPL was not distributed with this
file, You can obtain one at http://mozilla.org/MPL/2.0/.
Copyright (C) 2009-2010 Michael Möller <mmoeller@openhardwaremonitor.org>
Copyright (C) 2009-2020 Michael Möller <mmoeller@openhardwaremonitor.org>
*/
@ -55,9 +55,11 @@ namespace OpenHardwareMonitor.GUI {
}
if (scheduler != null) {
try {
// check if the taskscheduler is running
IRunningTaskCollection collection = scheduler.GetRunningTasks(0);
try {
try {
// check if the taskscheduler is running
IRunningTaskCollection collection = scheduler.GetRunningTasks(0);
} catch (ArgumentException) { }
ITaskFolder folder = scheduler.GetFolder("\\Open Hardware Monitor");
IRegisteredTask task = folder.GetTask("Startup");