peass-ng/PEASS-ng · error · ArgumentException
Resources.Error_TriggerEndBeforeStart
Error message
Resources.Error_TriggerEndBeforeStart
What it means
SetV1TriggerData throws ArgumentException with the localized resource Error_TriggerEndBeforeStart when the trigger's EndDate is earlier than or equal to its BeginDate. A v1 trigger must end after it starts, so the library refuses to bind such trigger data.
Source
Thrown at winPEAS/winPEASexe/winPEAS/TaskScheduler/Trigger.cs:2407
v2Trigger.GetType().InvokeMember(key, System.Reflection.BindingFlags.SetProperty, null, v2Trigger, new[] { o });
}
catch (System.Reflection.TargetInvocationException tie) when (tie.InnerException != null) { throw tie.InnerException; }
catch { /* ignored */ }
}
unboundValues.Clear();
unboundValues = null;
repititionPattern = new RepetitionPattern(this);
repititionPattern.Bind();
}
/// <summary>Assigns the unbound TriggerData structure to the V1 trigger instance.</summary>
internal void SetV1TriggerData()
{
if (v1TriggerData.MinutesInterval != 0 && v1TriggerData.MinutesInterval >= v1TriggerData.MinutesDuration)
throw new ArgumentException("Trigger.Repetition.Interval must be less than Trigger.Repetition.Duration under Task Scheduler 1.0.");
if (v1TriggerData.EndDate <= v1TriggerData.BeginDate)
throw new ArgumentException(Resources.Error_TriggerEndBeforeStart);
if (v1TriggerData.BeginDate == DateTime.MinValue)
v1TriggerData.BeginDate = DateTime.Now;
v1Trigger?.SetTrigger(ref v1TriggerData);
System.Diagnostics.Debug.WriteLine(v1TriggerData);
}
/// <summary>Checks the bind value for any conversion.</summary>
/// <param name="key">The key (property) name.</param>
/// <param name="o">The value.</param>
protected virtual void CheckBindValue(string key, ref object o)
{
if (o is TimeSpan ts)
o = Task.TimeSpanToString(ts);
if (o is DateTime dt)
{
if (key == "EndBoundary" && dt == DateTime.MaxValue || key == "StartBoundary" && dt == DateTime.MinValue)
o = null;
elseView on GitHub (pinned to 53fb989abc)
Solutions
- Ensure EndBoundary > StartBoundary before registering the trigger
- Validate parsed DateTime values and culture when building dates from strings
- Clamp/extend EndDate to at least BeginDate + minimal duration
Example fix
// before trigger.StartBoundary = start; trigger.EndBoundary = start; // equals start -> throws // after trigger.StartBoundary = start; trigger.EndBoundary = start > DateTime.Now ? start.AddDays(1) : DateTime.Now.AddDays(1);
Defensive patterns
Strategy: validation
Validate before calling
if (trigger.EndBoundary <= trigger.StartBoundary)
trigger.EndBoundary = trigger.StartBoundary.AddDays(1); Try / catch
try { folder.RegisterTaskDefinition(name, def, ...); }
catch (ArgumentException ex) when (ex.Message == Resources.Error_TriggerEndBeforeStart) { /* fix boundaries and retry */ } Prevention
- Validate EndBoundary > StartBoundary at config load time
- Use culture-invariant parsing (DateTime.TryParseExact/ISO 8601) for schedule strings
- Never allow zero-length schedule windows
When it happens
Trigger: Creating a trigger with StartBoundary after EndBoundary, or both equal; computing dates dynamically where EndDate ends up <= BeginDate (e.g. zero-length window or timezone/locale parsing issues).
Common situations: Dynamic schedules where EndDate = StartDate + duration with duration=0; strings parsed with the wrong culture flipping day/month so EndDate < StartDate.
Related errors
- Trigger.Repetition.Interval must be less than Trigger.Repeti
- Invalid days of the week element.
- Specified argument was out of the range of valid values. (Pa
- Path not found
- NotImplementedException
AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02).
Data as JSON: /api/errors/278dc6bc17aa9f79.
Report an issue: GitHub.