title: How do I notify Windows Task Scheduler when my application fails?
body: <p>I have a WPF application scheduled in Task Scheduler.</p>
  
  <p>I want to notify the Task Scheduler when the application fails.</p>
  
  <p>In Task Scheduler window, in section <code>Task Status</code> at the column <code>Run Result</code>, I always get <code>Success</code>, even when the app throws an internal exception.</p>
  
  <p>I used <code>Application.Current.Shutdown(1)</code> on an attempt to notify a fail to Task Scheduler, but with I wasn't successful.</p>
  
  <p>How can this be done?</p>