Windows – Task scheduler not logging failure to operational view in event viewer

eventviewertask-schedulerwindowswindows-event-logwindows-server-2012-r2

The task scheduler below clearly errors but it never shows up under the task scheduler operational view as being failed but completed successfully. I want to send an email on a failed task scheduler to myself. I could do this on my old box not this Windows 2012 R2 Server box.

Application: Tournaments.NotificationProcessor.exe Framework Version:
v4.0.30319 Description: The process was terminated due to an unhandled
exception. Exception Info: System.NullReferenceException Stack: at
System.Data.Entity.Core.Common.Internal.Materialization.Coordinator1[[System.__Canon,
mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]].ReadNextElement(System.Data.Entity.Core.Common.Internal.Materialization.Shaper)
at
System.Data.Entity.Core.Common.Internal.Materialization.Shaper1+SimpleEnumerator[[System.__Canon,
mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]].MoveNext() at
System.Linq.Enumerable.FirstOrDefault[System.__Canon, mscorlib,
Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]
at Tournaments.Data.Repositories.Games.GamesRepository.GetGame(Int32,
System.Nullable1) at
Tournaments.NotificationProcessor.Program.Main(System.String[])

Best Answer

There's a difference between the task failing to run and the task itself having an error within the task. The task scheduler just runs the task, it doesn't monitor errors within the task, only if it can run it and close the task properly. So the errors you are receiving within your Tournaments.NotificationProcessor.exe application have to notify you within that app itself...the task scheduler won't know that these errors occurred.

Related Topic