Quantcast
Channel: Task Scheduler Managed Wrapper
Viewing all articles
Browse latest Browse all 2206

New Post: Encounter WnfStateChangeTrigger error

$
0
0
Hi,

I am able to open the task in the system "Task Scheduler" and run as Administrator.

I actually has a windows service which run this line of code.

foreach (Task task in source) //source is TaskCollection
        {
           //process Task's information
           myObject.Author = task.Definition.RegistrationInfo.Author; //problem arise here
        }
The windows service is running using Local System account. I have tried to change it to Administrator account but the problem still persist.

Below is the result from my immediate window when I'm trying to access task.Definition or task.IsActive

task.Definition
'task.Definition' threw an exception of type 'System.Runtime.InteropServices.COMException'
Data: {System.Collections.ListDictionaryInternal}
ErrorCode: -2147216618
HResult: -2147216618
HelpLink: null
InnerException: null
Message: "(1,1148):WnfStateChangeTrigger:"
Source: ""
StackTrace: "   at Microsoft.Win32.TaskScheduler.V2Interop.ITaskDefinition.set_XmlText(String value)\r\n   at Microsoft.Win32.TaskScheduler.Task.GetV2Definition(TaskService svc, IRegisteredTask iTask, Boolean throwError)\r\n   at Microsoft.Win32.TaskScheduler.Task.get_Definition()"
TargetSite: {Void set_XmlText(System.String)}
task.IsActive
'task.IsActive' threw an exception of type 'System.Runtime.InteropServices.COMException'
Data: {System.Collections.ListDictionaryInternal}
ErrorCode: -2147216618
HResult: -2147216618
HelpLink: null
InnerException: null
Message: "(1,1148):WnfStateChangeTrigger:"
Source: ""
StackTrace: "   at Microsoft.Win32.TaskScheduler.V2Interop.ITaskDefinition.set_XmlText(String value)\r\n   at Microsoft.Win32.TaskScheduler.Task.GetV2Definition(TaskService svc, IRegisteredTask iTask, Boolean throwError)\r\n   at Microsoft.Win32.TaskScheduler.Task.get_Definition()\r\n   at Microsoft.Win32.TaskScheduler.Task.get_IsActive()"
TargetSite: {Void set_XmlText(System.String)}
Kindly advise.

Thanks.

Viewing all articles
Browse latest Browse all 2206

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>