umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.45k stars 2.68k forks source link

Error Cannot deserialize the current JSON object while upgrading database 7.15.5 to 8.9.1 #9379

Closed Trobeloo closed 2 years ago

Trobeloo commented 3 years ago

I am following the upgrade guide from here: https://our.umbraco.com/documentation/getting-started/setup/upgrading/migrating-to-v8

Upgrade starts but fails with an error message: Cannot deserialize the current JSON object

I am seeing this issue on Umbraco version: 8.9.1

Reproduction

Start Umbraco with a v7.15.5 database connexion string and agree to the conversion process. Upgrade starts but fails with an error message: Cannot deserialize the current JSON object

Bug summary

Error log is attached

Steps to reproduce

Follow the upgrade guide from here: https://our.umbraco.com/documentation/getting-started/setup/upgrading/migrating-to-v8

Expected result

Conversion succeed.

Actual result

Error UmbracoTraceLog.JACQUES-DELL.20201111.zip

nul800sebastiaan commented 3 years ago

Thanks @Trobeloo - looks like it can't deserialize one or more of your RelatedLink objects, the full error is:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Umbraco.Web.Install.InstallException: The database failed to upgrade. ERROR: The database configuration failed with the following message: Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Collections.Generic.List`1[Umbraco.Core.Migrations.Upgrade.V_8_0_0.RelatedLink]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.
To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
Path 'type', line 2, position 9.
 Please check log file for additional information (can be found in '/App_Data/Logs/')
   at Umbraco.Web.Install.InstallSteps.DatabaseUpgradeStep.ExecuteAsync(Object model) in D:\a\1\s\src\Umbraco.Web\Install\InstallSteps\DatabaseUpgradeStep.cs:line 47
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Umbraco.Web.Install.Controllers.InstallApiController.<ExecuteStepAsync>d__14.MoveNext() in D:\a\1\s\src\Umbraco.Web\Install\Controllers\InstallApiController.cs:line 236
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Umbraco.Web.Install.Controllers.InstallApiController.<PostPerformInstall>d__11.MoveNext() in D:\a\1\s\src\Umbraco.Web\Install\Controllers\InstallApiController.cs:line 104

Seems like the error might be coming from here: https://github.com/umbraco/Umbraco-CMS/blob/v8/contrib/src/Umbraco.Core/Migrations/Upgrade/V_8_0_0/ConvertRelatedLinksToMultiUrlPicker.cs#L59

We'd love some help getting this one fixed!

umbrabot commented 3 years ago

Hi @Trobeloo,

We're writing to let you know that we would love some help with this issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know.

For more information about issues and states, have a look at this blog post

Thanks muchly, from your friendly Umbraco GitHub bot :-)

Trobeloo commented 3 years ago

Hi,

Yes the errors is from that particular line. I was able to bypass the error by embedding a try catch in the for each loop. What can I do to help you solve this?

umbrabot commented 2 years ago

Hiya @Trobeloo,

Just wanted to let you know that we noticed that this issue got a bit stale and might not be relevant any more.

We will close this issue for now but we're happy to open it up again if you think it's still relevant (for example: it's a feature request that's not yet implemented, or it's a bug that's not yet been fixed).

To open it this issue up again, you can write @umbrabot still relevant in a new comment as the first line. It would be super helpful for us if on the next line you could let us know why you think it's still relevant.

For example:

@umbrabot still relevant This bug can still be reproduced in version x.y.z

This will reopen the issue in the next few hours.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face: