dahall / TaskScheduler

Provides a .NET wrapper for the Windows Task Scheduler. It aggregates the multiple versions, provides an editor and allows for localization.
MIT License
1.21k stars 191 forks source link

Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Win32.TaskScheduler.V2Interop.ITaskSettings3' #839

Closed PhyxionNL closed 4 years ago

PhyxionNL commented 4 years ago

Describe the bug System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Win32.TaskScheduler.V2Interop.ITaskSettings3'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{0AD9D0D7-0C7F-4EBB-9A5F-D1C648DCA528}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). at Microsoft.Win32.TaskScheduler.TaskSettings..ctor(Microsoft.Win32.TaskScheduler.V2Interop.ITaskSettings iSettings) at offset 36

To Reproduce On Windows 7, ITaskSettings3 interface doesn't exist; this only exists on Windows 8 and higher. If you create a task like this: TaskService.Instance.NewTask(), the above exception is thrown on W7. This is catched here, but this exception can be avoided on W7 by checking whether the system is running on Windows 8 or higher. Otherwise this continues to show up when logging all exceptions.

dahall commented 4 years ago

FIxed in 2.8.17