Closed novakj23 closed 4 years ago
@novakj23 Thank you for doing all the work to debug this. I'll do some testing and then release. Prior to that, you can find the latest packages on the NuGet feed at https://ci.appveyor.com/nuget/taskscheduler-prerelease.
I try the example for the watcher. I run the scheduler task during sleep but it does n`t trigger the handler.
I would like to use the library so I spend some time debugging the situation. The problem is converting DateTime to XML. Exactly in this line
StartTime.Value has the time:
DateTime has specific field Kind on value Local. Microsoft documentation for enum "System.Xml.XmlDateTimeSerializationMode.RoundtripKind" says that "Time zone information should be preserved when converting.".
Result of converting is:
The time is not some. It is shifted for 2 hours. I used the .Net Framework 4.5.2
For the example of using TaskEventLog is DateTime in the constructor. But the TaskEventWatcher doesn`t have a parameter for setting StartDate. It is used DateTime.Now for the initializing an object of TaskEventLog. The better way is to use the UTC timezone.
I try to change the code to DateTime.UtcNow :
The DateTime has value:
The date is converted to correct format:
I recommend changing the parameter in the constructor of TaskEventLog inside the TaskEventWatcher and use DateTime.UtcNow .