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

Dec 8, 2011 at 5: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="">
        <Description>Weekly Summary Report for Instaled System 135</Description>
  </RegistrationInfo>  <Triggers>
                    <Monday />
  </Triggers>  <Settings>
    <ExecutionTimeLimit>PT72H</ExecutionTimeLimit>    <Priority>7</Priority>
  </Settings>  <Actions>


Dec 8, 2011 at 7:45 PM

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

Dec 8, 2011 at 8: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.


Dec 9, 2011 at 4: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.