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

Closed Unassigned: System.Runtime.InteropServices.COMException (0x80041319): (40,4):EndBoundary: [11961]

$
0
0
Hi,

I try to Schedule a task using the C# 2.0
here is my code:

```
using(TaskService taskService=new TaskService()) {
TaskDefinition taskDefinition=taskService.NewTask();
taskDefinition.RegistrationInfo.Description="Delete Soundeyes IDX";
DateTime dateStart=Helper.DateHelper.DayBegin(DateTime.Now.AddDays(1)).AddHours(4); //4 AM the next day
TimeTrigger trigger=new TimeTrigger(dateStart);
trigger.EndBoundary=DateTime.MaxValue;
taskDefinition.Triggers.Add(trigger);
taskDefinition.Settings.AllowDemandStart=true;
taskDefinition.Settings.AllowHardTerminate=true;
taskDefinition.Settings.DeleteExpiredTaskAfter=new TimeSpan(1, 0, 0);
taskDefinition.Settings.Enabled=true;
taskDefinition.Settings.MultipleInstances=TaskInstancesPolicy.StopExisting;
taskDefinition.Settings.Priority=System.Diagnostics.ProcessPriorityClass.BelowNormal;
taskDefinition.Actions.Add(
new ExecAction(
Application.ExecutablePath
, string.Format(
"/path:\"{0}\" /date:\"{1}\""
, ctrl_srcPath.Text
, Helper.DateHelper.FormatToPath(ctrl_date.Value)
)
, null
)
);
try {
taskService.RootFolder.RegisterTaskDefinition("SeIdxDel", taskDefinition);
}
catch(Exception exception) {
MessageBox.Show(exception.Message, "Error while scheduling task", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
```

Exception raises with "System.Runtime.InteropServices.COMException (0x80041319): (40,4):EndBoundary:" message.
I got the same exception if define or not the endBoundary into the trigger
endBoundary is not added in xmltext of the taskDefinition.

```
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Description>Delete Soundeyes IDX</Description>
</RegistrationInfo>
<Triggers>
<TimeTrigger>
<StartBoundary>2015-01-10T04:00:00</StartBoundary>
<Enabled>true</Enabled>
</TimeTrigger>
</Triggers>
<Settings>
<MultipleInstancesPolicy>StopExisting</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<Duration>PT10M</Duration>
<WaitTimeout>PT1H</WaitTimeout>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT72H</ExecutionTimeLimit>
<DeleteExpiredTaskAfter>PT1H</DeleteExpiredTaskAfter>
<Priority>7</Priority>
</Settings>
<Actions>
<Exec>
<Command>D:\dev\soundeyes\SeIdxDel\bin\Debug\SeIdxDel.EXE</Command>
<Arguments>/path:"D:\SERecord" /date:"2015\01\09"</Arguments>
</Exec>
</Actions>
</Task>
```
0x80041319 COM code, says: SCHED_E_MISSINGNODE - 0x80041319 - The task XML is missing a required element or attribute.
[TEXT](http://msdn.microsoft.com/en-us/library/windows/desktop/aa383604(v=vs.85).aspx)

Can someone can help me ?
Thanx

Viewing all articles
Browse latest Browse all 2206

Trending Articles



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