Upgrade from 13 to 16 but RTE loses all data

I’ve been trying to upgrade a database from 13 to 16 but I keep on getting the error :

System.Text.Json.JsonException: JSON deserialization for type 'Umbraco.Cms.Core.RichTextEditorValue' was missing required properties including: 'markup'. at System.Text.Json.ThrowHelper.ThrowJsonException_JsonRequiredPropertyMissing(JsonTypeInfo parent, BitArray requiredPropertiesSet) at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value) at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue) at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, T& value, JsonSerializerOptions options, ReadStack& state) at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 json, JsonTypeInfo`1 jsonTypeInfo) at Umbraco.Cms.Infrastructure.Serialization.SystemTextJsonSerializerBase.Deserialize[T](String input) at Umbraco.Cms.Core.PropertyEditors.RichTextPropertyEditorHelper.TryParseRichTextEditorValue(Object value, IJsonSerializer jsonSerializer, ILogger logger, RichTextEditorValue& richTextEditorValue)

I spotted there was a fix for something similar in 15 but not an exact match. I’ve tried using uSync Content to export and then import the content but unfortunetly I still get the same errors.

The only thing that does seem to fix it is if I open the site in U13 and then click Save and Publish before then doing the upgrade. However, there are 1000s of nodes in this site and going through each one and clicking Save/Publish is a nightmare of a thought. I had tried to do this via code using the ContentService and also tried Publishing with Descendants but there is clearly something different between doing it that way and clicking the green Save/Publish button.

Running out of idea on how to fix this in a way that is efficient and works.

I’ve also tried upgrading from U13 to U17 in the hope that some migrations have been updated or it wouldnt need the missing markup attribute but it still fails with the same errors.

Guessing the migration isn’t working because it thinks the rte is JSON when it isn’t (or is in a odd format). )

do you have an example of an RTE from the usync files, might be able to see what’s wrong with it. (and work out a way to the future fix).

(uSync’s migration stuff is for RTEs is basically a copy of the core , so both a failing the same way i guess)

Hi Kevin,
Ye, the uSync export of the data from the RTE looks like :

“contentData”: [

{

“contentTypeKey”: “4bd8db21-afed-4356-9acb-30539546be5e”,

“mainRTEBlockContent”: {

“Markup”: “REMOVED THE ACTION CONTENT ",

“Blocks”: {

“ContentData”: 
,

“SettingsData”: 


}

},

“udi”: “umb://element/89f3d84cf7194f80a0de1586cd1ac41c”

}

],

Looking at the model in Core, I wonder if the fact that the DataMember Name is markdown but the RTEBlock saves as Markdown could cause a mismatch? Grasping here mind you.

OK,

Quick guess, you have a Globa lJson setting somewhere in the site that is forcing the naming of objects to Default (Its a newtonsoft thing) - most of the umbraco code guards against this with inline attribute stuff, but maybe not here.

so Everyting in the db (and then in the uSync files also) is writing out property names upper case “see Markup vs markup)

– still guessing

this is then failing when the objects are being read out of the new site because it’s looking `markup` not `Markup`


a quick fix might be a search and replace in the files, but i suspect that won’t work as there will be other bits that also have case issues.;

Found it -

var rte = JsonConvert.DeserializeObject(value)!;
rte.Markup = ModifyRTELink(rte.Markup);
savedItem.SetValue(item.PropertyType.Alias, JsonConvert.SerializeObject(rte));

and RTE has

public class RTE
{
public string Markup { get; set; }
public Blocks Blocks { get; set; }
}

Which would set the db to Markup.

Thanks Kevin - now to work out a way of getting the DB in a better state so we can get this upgraded :smiley:

If you don’t care about the target (e.g you can throw it away when it doesn’t work!) .

then if thats the code, i would try mass renaming “Markup” to “markup” (with the quotes) and “Block” to “block” (again with quotes). in the uSync files in the content section.

worst thing that can happen is it doesn’t work.

1 Like

That got the content in! Amazing.
I think then once we get the site running we can slowly get the data to convert back to the correct casing one save/publish of new items. At least this way we have the content back in the site.
Thanks for the pointers Kevin, I owe you a drink the next time I see you :slight_smile:

Edit: Actually, now that this has been fixed, it’s now just a case of fixing the notification handler to make sure it doesn’t change the casing back.

Anyway, thanks @KevinJump appreciate the help, especially since this wasn’t a uSync issue and more an us issue :smiley:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.