c# - ArgumentOutOfRangeException (The UTC time represented when the offset is applied must be between year 0 and 10,000.) with OData / SC Orchestrator -


i'm writing small web interface goes on front of system center orchestrator setup. supposed hit runbook , data - part largely unimportant.

the code attempting start runbook job data using sample code (and subbing in requirements) https://msdn.microsoft.com/en-us/library/hh921685.aspx

the lines have changed references own orchestrator, runbook guid, , runbook parameters.

this line throws exception in title:

context.savechanges(); 

which has stack trace showing error seems originating somewhere in odata realm of things beyond code:

[argumentoutofrangeexception: utc time represented when offset applied must between year 0 , 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 @ the utc time represented when offset applied must between year 0 , 10,000. parameter name: offset , utc time represented when offset applied must between year 0 , 10,000 error , looks suspiciously error (especially latter) calls on https://support.microsoft.com/en-us/kb/2346777 hotfix provided ms doesn't apply windows 10 (my workstation) or windows 2012 r2 (the webserver).

i reluctant change either timezone (utc+10) or server's test before seeing if has ideas or has encountered before.

i have powershell scripts quite capable of generating these jobs (although can't use service references have generate request manually). i'm not inclined believe @ fault except clr.

bottom line question: has encountered , fixed it?

adding these 2 lines alleviate issue:

job.creationtime = datetime.now; job.lastmodifiedtime = datetime.now; 

or, of course, reasonably valid datetime value.

so seems when using sample code referred in question empty job object doesn't populate creationtime or lastmodifiedtime properties, , result passes through. when times used in calculation result in timespan < 0 or > 10,000 years.

the solution in technet forum thread: https://social.technet.microsoft.com/forums/en-us/e248ecef-9561-4409-8a3f-8299bcc721a4/exception-using-code-sample-in-utc-1-timezone?forum=scoqik

with answer joakimjohansson.


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -