I'm writing a small web interface which goes on the front of a System Center Orchestrator setup. It is supposed to hit the runbook and get some data back - this part is largely unimportant.
The code is attempting to start a runbook job to get some data back using the sample code (and subbing in my requirements) from https://msdn.microsoft.com/en-us/library/hh921685.aspx
The only lines I have changed are the references to my own Orchestrator, the runbook GUID, and the runbook parameters.
This line throws the exception in the title:
context.SaveChanges();
which has this stack trace showing the error seems to be originating somewhere in the OData realm of things which is well beyond my code:
[ArgumentOutOfRangeException: The UTC time represented when the offset is applied must be between year 0 and 10,000.
Parameter name: offset]
System.DateTimeOffset.ValidateDate(DateTime dateTime, TimeSpan offset) +14215620
System.DateTimeOffset..ctor(DateTime dateTime) +56
Microsoft.Data.OData.Atom.EpmSyndicationWriter.CreateDateTimeStringValue(Object propertyValue, ODataWriterBehavior writerBehavior) +144
Microsoft.Data.OData.Atom.EpmSyndicationWriter.WriteEntryEpm(EntryPropertiesValueCache epmValueCache, IEdmEntityTypeReference entityType) +652
Microsoft.Data.OData.Atom.EpmSyndicationWriter.WriteEntryEpm(EpmTargetTree epmTargetTree, EntryPropertiesValueCache epmValueCache, IEdmEntityTypeReference type, ODataAtomOutputContext atomOutputContext) +80
Microsoft.Data.OData.Atom.ODataAtomWriter.EndEntry(ODataEntry entry) +627
Microsoft.Data.OData.ODataWriterCore.<WriteEndImplementation>b__16() +168
Microsoft.Data.OData.ODataWriterCore.InterceptException(Action action) +121
Microsoft.Data.OData.ODataWriterCore.WriteEndImplementation() +69
Microsoft.Data.OData.ODataWriterCore.WriteEnd() +40
System.Data.Services.Client.ODataWriterWrapper.WriteEnd(ODataEntry entry, Object entity) +47
System.Data.Services.Client.Serializer.WriteEntry(EntityDescriptor entityDescriptor, IEnumerable`1 relatedLinks, ODataRequestMessageWrapper requestMessage) +485
System.Data.Services.Client.BaseSaveResult.CreateRequestData(EntityDescriptor entityDescriptor, ODataRequestMessageWrapper requestMessage) +117
System.Data.Services.Client.BaseSaveResult.CreateChangeData(Int32 index, ODataRequestMessageWrapper requestMessage) +136
System.Data.Services.Client.SaveResult.CreateNonBatchChangeData(Int32 index, ODataRequestMessageWrapper requestMessage) +224
System.Data.Services.Client.SaveResult.CreateNextChange() +174
System.Data.Services.Client.DataServiceContext.SaveChanges(SaveChangesOptions options) +178
System.Data.Services.Client.DataServiceContext.SaveChanges() +37
S3Tools.RunbookOperations.GetClusters(String site) in [redacted]\RunbookOps.cs:58
I have looked at The UTC time represented when the offset is applied must be between year 0 and 10,000. Parameter name: offset and UTC time represented when the offset is applied must be between year 0 and 10,000 error and it looks suspiciously like that error (especially the latter) which calls on https://support.microsoft.com/en-us/kb/2346777 but the hotfix provided by MS doesn't apply to Windows 10 (my workstation) or Windows 2012 R2 (the webserver).
I am reluctant to change either my timezone (UTC+10) or the server's to test before seeing if anyone has any ideas or has encountered this before.
I have powershell scripts which are quite capable of generating these jobs (although they can't use service references you have to generate the request manually). So I'm not inclined to believe anything is at fault except the CLR.
Bottom line question: Has anyone encountered this and fixed it?