This project has moved. For the latest updates, please go here.

The task XML contains a value which is incorrectly formatted or out of range

Dec 8, 2011 at 6:44 PM

I am using the TaskScheduler in ASP.Net C# code, Windows 7 64 machine and I have the error above. By chance, can somebody spott what node is missing in the generted xml bellow?

<?xml version="1.0" encoding="utf-16"?><Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
    <RegistrationInfo>
        <Description>Weekly Summary Report for Instaled System 135</Description>
  </RegistrationInfo>  <Triggers>
        <CalendarTrigger>
            <StartBoundary>2011-12-08T03:00:00</StartBoundary>      
            <Enabled>true</Enabled>      
            <ScheduleByWeek>
                <DaysOfWeek>
                    <Monday />
                </DaysOfWeek>        
            <WeeksInterval>1</WeeksInterval>
      </ScheduleByWeek>
    </CalendarTrigger>
  </Triggers>  <Settings>
        <MultipleInstancesPolicy>IgnoreNew</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>    <Priority>7</Priority>
  </Settings>  <Actions>
        <Exec>
            <Command>C:\\AircuityUtility\\VentilationSummariesReportsWeekly\\VentilationSummariesReportsWeekly.exe</Command>
    </Exec>
  </Actions>
</Task>

 

Coordinator
Dec 8, 2011 at 8:45 PM

Yes. ExecutionTimeLimit must be PT3D. You cannot have a value greater than 24 when using H.

Dec 8, 2011 at 9:48 PM

Not sure, it was the default, I changed it to 5 minutes but still the issue is there. I tried to set the Principal to 

                    td.Principal.UserId = "System";
                    td.Principal.LogonType = TaskLogonType.ServiceAccount;

 and I have another error:

[System.AppDomainUnloadedException] = {"Attempted to access an unloaded appdomain. (Exception from HRESULT: 0x80131014)"}

which does not help much.

 

Coordinator
Dec 9, 2011 at 5:26 PM

The way I usually troubleshoot XML is to create the task in the Task Scheduler app (Start Menu | Accessories | System Tools) and then Export it to XML using the menu on the right.