Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Ali Sheikh Taheri 470 posts 1648 karma points c-trib
    Oct 30, 2019 @ 17:31
    Ali Sheikh Taheri

    '1150' is not a valid udi, after content migration from v7.15.3 to 8.2


    I have migrated the content of my site from Umbraco version 7.15.3 to 8.2. During the upgrade, I was getting an error relating to using the unsupported Media Picker Property Editor. In order to complete the upgrade process, I had to delete MediaPicker Property Editor and assign MediaPicker2 to the data type I had on Umbraco version 7.15.3.

    Having removed and then changed the Media Picker the content migration was successful. Then with the new site (v8.2) when I write a simple query like

    var heroImage = content.Value("heroImage")

    getting an error saying "String "1150" is not a valid udi."

    I believe the value that is saved in the database it is still an integer whereas it should be UDI.

    I really appreciate if anyone can help as I might be missing some obvious steps here or there is a possibility that the content migration has forgotten to convert int to UDI.

    Many thank

  • Steve Megson 151 posts 1000 karma points MVP c-trib
    Oct 31, 2019 @ 14:44
    Steve Megson

    Changing the property editor in v7 doesn't change any of the existing data, so you will still have int IDs in the database. Then the migration to v8 will just see that you're using the UDI-based property editor and expect that all the stored data is UDIs.

    There are plans to support the legacy property editors in the migration and convert int IDs to UDIs, but that doesn't help you right now if you've already run the migration.

    I think the easiest solution would be to add a custom version of MediaPickerValueConverter to your site, modifying it to handle both int and UDI values. I haven't tested it, but I think something like this should work:

    public class IntFriendlyMediaPickerValueConverter : Umbraco.Web.PropertyEditors.ValueConverters.MediaPickerValueConverter
        public override object ConvertSourceToIntermediate(IPublishedElement owner, IPublishedPropertyType propertyType,
            object source, bool preview)
            if (source == null) return null;
            var nodeIds = source.ToString()
                .Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries)
                .Select(id =>
                    if (Udi.TryParse(id, out var udi))
                        return udi;
                    else if (Int32.TryParse(id, out var integer))
                        var item = _publishedSnapshotAccessor.PublishedSnapshot.Media.GetById(integer);
                        if (item != null)
                            return new GuidUdi(Constants.UdiEntityType.Media, item.Key);
                    return null;                        
            return nodeIds;
    public class MyComposer : IUserComposer
        public void Compose(Composition composition)

    That should solve any problems rendering templates.

    You may still have problems editing the migrated content, but I think it should only be a problem if you have a multi-valued media picker and add a new item. Removing and re-adding the existing item before adding the new one should get around that.

  • Ali Sheikh Taheri 470 posts 1648 karma points c-trib
    Nov 01, 2019 @ 11:00
    Ali Sheikh Taheri

    Thank you so much Steve, that has resolved the issue.

    I have tried a few approaches to convert the id to UDI without writing any custom code but that wasn't successful.

Please Sign in or register to post replies

Write your reply to: