I'm getting this exception with this code:
```
Imports Microsoft.Win32.TaskScheduler
Public Sub GetAllTasks()
Using taskService As New TaskService
For Each task As Task In taskService.AllTasks
Using task
Debug.WriteLine(task.Definition.Settings.Priority)
End Using
Next
End Using
End Sub
```
I've tested and this occurs everytime i use the "Settings" namespace, even alone.
Although the property succeeds and no error is thrown back to my code (is handled by the dll) it would be nice for it to be fixed, if it's not intended.
Thanks for reading, searched for this library when P/ Invoke was burning my head.
Comments: ** Comment from web user: dahall **
```
Imports Microsoft.Win32.TaskScheduler
Public Sub GetAllTasks()
Using taskService As New TaskService
For Each task As Task In taskService.AllTasks
Using task
Debug.WriteLine(task.Definition.Settings.Priority)
End Using
Next
End Using
End Sub
```
I've tested and this occurs everytime i use the "Settings" namespace, even alone.
Although the property succeeds and no error is thrown back to my code (is handled by the dll) it would be nice for it to be fixed, if it's not intended.
Thanks for reading, searched for this library when P/ Invoke was burning my head.
Comments: ** Comment from web user: dahall **
So, just to be clear, you're seeing exceptions thrown in the debugger, but they aren't being thrown up into your code when you call the "Settings" property from the TaskDefinition class?
If that is correct, you are seeing the internals of the code trying to determine which version of the Task Scheduler library is available from the OS. There are currently four and each have more properties that they expose. Unfortunately, the only way to determine what is available is to call into the COM library via Interop and _cast_ the object to the different COM interfaces and see which come back. On Windows 8 and Server 2012, you shouldn't see the exceptions as they support all the library versions.