Error converting value to type 'Octopus.Core.Model.PropertyValue

Hi, everyone.

We recently upgraded from 2.6.5 to 3.0.5 version
And we get error (it seems. that it appear since 3.0.5 version) when deployin.

After deployment one of the Project the next error appeared (Raw log below)

Tasks   Deploy Deploy CurrencyParsing.Console CLONED release 3.9.573 to Live  Raw log Download Refresh
Task ID:       ServerTasks-468
Task status:   Failed
Task queued:   27 июля 2015 г. 12:53
Task started:  27 июля 2015 г. 12:53
Task duration: 46 seconds

                    | == Running: Deploy Deploy CurrencyParsing.Console CLONED release 3.9.573 to Live ==
12:53:25   Verbose  |   Guided failure is enabled for this task
12:54:10   Error    |   Error converting value 27.07.2015 13:24:39 to type 'Octopus.Core.Model.PropertyValue'. Path 'Value', line 1, position 38486.
                    |   Newtonsoft.Json.JsonSerializationException: Error converting value 27.07.2015 13:24:39 to type 'Octopus.Core.Model.PropertyValue'. Path 'Value', line 1, position 38486. ---> System.ArgumentException: Could not cast or convert from System.DateTime to Octopus.Core.Model.PropertyValue.
                    |   at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)
                    |   at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)
                    |   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
                    |   --- End of inner exception stack trace ---
                    |   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
                    |   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
                    |   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType, IDictionary`2& extensionData)
                    |   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
                    |   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
                    |   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
                    |   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
                    |   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
                    |   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
                    |   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType)
                    |   at Newtonsoft.Json.Linq.JToken.ToObject[T]()
                    |   at Octopus.Core.RelationalStorage.VariableConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) in y:\work\refs\heads\master\source\Octopus.Core\RelationalStorage\VariableConverter.cs:line 63
                    |   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
                    |   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
                    |   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
                    |   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
                    |   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
                    |   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
                    |   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
                    |   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
                    |   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
                    |   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
                    |   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
                    |   at Octopus.Core.RelationalStorage.RelationalTransaction.<Stream>d__13`1.MoveNext() in y:\work\refs\heads\master\source\Octopus.Core\RelationalStorage\RelationalTransaction.cs:line 245
                    |   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
                    |   at Octopus.Core.RelationalStorage.RelationalTransaction.LoadRequired[T](String id) in y:\work\refs\heads\master\source\Octopus.Core\RelationalStorage\RelationalTransaction.cs:line 63
                    |   at Octopus.Server.Orchestration.Deploy.DeploymentPlanService.Cleanup(DeploymentPlan plan) in y:\work\refs\heads\master\source\Octopus.Server\Orchestration\Deploy\DeploymentPlanService.cs:line 60
                    |   at Octopus.Server.Orchestration.Deploy.DeploymentTaskController.Execute() in y:\work\refs\heads\master\source\Octopus.Server\Orchestration\Deploy\DeploymentTaskController.cs:line 73
                    |   at Octopus.Shared.Tasks.RunningTask.RunMainThread() in y:\work\refs\heads\master\source\Octopus.Shared\Tasks\RunningTask.cs:line 83
                    |   Octopus.Server version 3.0.5.2124

When this project was cloned and we tried to delete it, we got the next error

Delete project ×
Error converting value 27.07.2015 13:24:39 to type 'Octopus.Core.Model.PropertyValue'. Path 'Value', line 1, position 38486.
Newtonsoft.Json.JsonSerializationException: Error converting value 27.07.2015 13:24:39 to type 'Octopus.Core.Model.PropertyValue'. Path 'Value', line 1, position 38486. ---> System.ArgumentException: Could not cast or convert from System.DateTime to Octopus.Core.Model.PropertyValue.
   at Newtonsoft.Json.Utilities.ConvertUtils.EnsureTypeAssignable(Object value, Type initialType, Type targetType)
   at Newtonsoft.Json.Utilities.ConvertUtils.ConvertOrCast(Object initialValue, CultureInfo culture, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   --- End of inner exception stack trace ---
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.EnsureType(JsonReader reader, Object value, CultureInfo culture, JsonContract contract, Type targetType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType, IDictionary`2& extensionData)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType, JsonSerializer jsonSerializer)
   at Newtonsoft.Json.Linq.JToken.ToObject(Type objectType)
   at Newtonsoft.Json.Linq.JToken.ToObject[T]()
   at Octopus.Core.RelationalStorage.VariableConverter.ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) in y:\work\refs\heads\master\source\Octopus.Core\RelationalStorage\VariableConverter.cs:line 63
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Octopus.Core.RelationalStorage.RelationalTransaction.<Stream>d__13`1.MoveNext() in y:\work\refs\heads\master\source\Octopus.Core\RelationalStorage\RelationalTransaction.cs:line 245
   at Octopus.Core.Persistence.Indexes.DocumentUsageFinder.RelationshipBuilder`2.FindUsages(IRelationalTransaction transaction, Object from, List`1 referencingDocuments) in y:\work\refs\heads\master\source\Octopus.Core\Persistence\Indexes\DocumentUsageFinder.cs:line 258
   at Octopus.Core.Persistence.Indexes.DocumentUsageFinder.FindReferences[TDocument](IRelationalTransaction transaction, TDocument document) in y:\work\refs\heads\master\source\Octopus.Core\Persistence\Indexes\DocumentUsageFinder.cs:line 213
   at Octopus.Core.Persistence.Indexes.DeleteCommand.DeleteRecursive(IRelationalTransaction transaction, IDocument document, ReferenceCollection seenBefore) in y:\work\refs\heads\master\source\Octopus.Core\Persistence\Indexes\DeleteCommand.cs:line 48
   at Octopus.Core.Persistence.Indexes.DeleteCommand.DeleteRecursive(IRelationalTransaction transaction, IDocument document, ReferenceCollection seenBefore) in y:\work\refs\heads\master\source\Octopus.Core\Persistence\Indexes\DeleteCommand.cs:line 63
   at Octopus.Server.Web.Infrastructure.Api.DeleteOnBackgroundResponseDescriptor`2.Responder.Execute() in y:\work\refs\heads\master\source\Octopus.Server\Web\Infrastructure\Api\DeleteOnBackgroundResponseDescriptor.cs:line 73
   at Octopus.Server.Web.Infrastructure.Api.Responder`1.Respond(TDescriptor options, NancyContext context) in y:\work\refs\heads\master\source\Octopus.Server\Web\Infrastructure\Api\Responder.cs:line 162
   at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
   at CallSite.Target(Closure , CallSite , Object , Object , NancyContext )
   at Octopus.Server.Web.Api.OctopusRestApiModule.<>c__DisplayClass5.<.ctor>b__2(Object o) in y:\work\refs\heads\master\source\Octopus.Server\Web\Api\OctopusRestApiModule.cs:line 46
   at CallSite.Target(Closure , CallSite , Func`2 , Object )
   at Nancy.Routing.Route.<>c__DisplayClass4.<Wrap>b__3(Object parameters, CancellationToken context)
Deleting this project is permanent, there is no going back. Do you wish to continue?

Log attach

log.txt (17 KB)

Sorry, I forgot describe, what steps used in Project:

  • Stop Windows Task
  • Deploy package with new task
  • Create new Win Task in Task Scheduler , based on XML (example below)
<?xml version="1.0" encoding="utf-16"?>
<Task version="1.1" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
  <RegistrationInfo>
    <Author>evgeniy.kolupaev</Author>
  </RegistrationInfo>
  <Triggers>
    <CalendarTrigger>
      <Repetition>
        <Interval>PT10800S</Interval>
        <Duration>PT86400S</Duration>
        <StopAtDurationEnd>false</StopAtDurationEnd>
      </Repetition>
      <StartBoundary>2015-07-27T14:14:44</StartBoundary>
      <Enabled>true</Enabled>
      <ScheduleByDay>
        <DaysInterval>1</DaysInterval>
      </ScheduleByDay>
    </CalendarTrigger>
  </Triggers>
  <Principals>
    <Principal id="Author">
      <UserId>domain\USER</UserId>
      <LogonType>InteractiveTokenOrPassword</LogonType>
      <RunLevel>HighestAvailable</RunLevel>
    </Principal>
  </Principals>
  <Settings>
    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
    <StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
    <IdleSettings>
      <Duration>PT600S</Duration>
      <WaitTimeout>PT3600S</WaitTimeout>
      <StopOnIdleEnd>false</StopOnIdleEnd>
      <RestartOnIdle>false</RestartOnIdle>
    </IdleSettings>
    <Enabled>true</Enabled>
    <Hidden>false</Hidden>
    <RunOnlyIfIdle>false</RunOnlyIfIdle>
    <WakeToRun>false</WakeToRun>
    <ExecutionTimeLimit>PT259200S</ExecutionTimeLimit>
    <Priority>5</Priority>
  </Settings>
  <Actions Context="Author">
    <Exec>
      <Command>D:\LiveCurrencyParsing\Sravni.CurrencyParsing.Console.exe</Command>
      <Arguments>live</Arguments>
      <WorkingDirectory>D:\LiveCurrencyParsing</WorkingDirectory>
    </Exec>
  </Actions>
</Task>

Hi Niki,

Thanks so much for the report. I have created an issue which you can track here: https://github.com/OctopusDeploy/Issues/issues/1783
Hopefully it is something we can fix quickly. Please keep an eye on the issue or the downloads page for a fix.

Sorry for the troubles.
Vanessa

Hi Vanessa.

That’s cool )
Thank you

Hi Nik,

I am looking into this issue for you and have a few questions.

Is this error happening for only one project in particular? Are you able to deploy any other projects?

Did you import from a 2.6 backup when you upgraded to 3.0.5? Have you ever been able to deploy that project after upgrading?

Thanks for the extra information.

Cheers,
Shane

Hi, Shane,

Yes, this error is happening only for one particular project. All others projects are deploying OK.

Upgrade was executed from 2.6.5 backup to 3.0.4 version first.
And , as I remember, all the project were deployed fine (on 3.0.4) (we deployed a few projects on Prod at once, so if something was failed, we could report bug early - on 3.0.4 version). But I can’t prove it , because we have very short log retention, and those logs are deleted by Octopus.

Hi Nik,

In your logs the project is called CurrencyParsing.Console CLONED. Is this only happening for a project that has been cloned? Does the original project work ok?

Thanks
Shane

Hi, Shane,

Both of the projects CurrencyParsing.Console CLONED and CurrencyParsing.Console are have the same issues (they fails when deploying and impossible delete either the project or the release of the project).
It’s seems to be the format of the date<StartBoundary>2015-07-27T14:14:44</StartBoundary> isn’t parsed correctly.

Hi Nik,

I’m having a hard time replicating the issue. Would you mind sending an export of that project?

You can export via Octopus Manager and the project should be in the /Projects/CurrencyParsing.Console folder. Send to support@octopusdeploy.com.

Thanks,
Shane

Shane,

We sent exported project to support@octopusdeploy.com

Thanks

Thanks Nik,

This is causing the issue:

# This variables will be used in variable substitution
$Task_Start_Time = ([System.DateTime]::Now.AddMinutes(30).ToString("s"))

# This variables will be used in variable substitution
Set-OctopusVariable -name "Task_Start_Time" -value $Task_Start_Time

I’ll get a fix out for you ASAP. Keep an eye on the GitHub issue for updates.

Cheers,
Shne

Hi Nik,

I just wanted to let you know that this issue will be fixed in the next release. That will be tomorrow (build servers permitting).

Thanks for reporting it and all the information.

Cheers,
Shane

Hi Shane,

That’s cool ), we are waiting for it.
Thank you