Copied to clipboard

Flag this post as spam?

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


  • Nathan 11 posts 101 karma points c-trib
    Jul 05, 2023 @ 21:24
    Nathan
    0

    NullReferenceException in ConvertRelatedLinksToMultiUrlPicker during v7.15.10 to v8.18.8 migration

    Hello,

    I'm getting a NullReferenceException while trying to execute the database migration to v8.18.8 on my v.7.15.10 Umbraco project. According to the call stack, this exception is thrown here:

    Umbraco.Core.dll!Umbraco.Core.Migrations.Upgrade.V_8_0_0.ConvertRelatedLinksToMultiUrlPicker.Migrate() Line 63
    

    I have no idea what could be causing this exception. Line 63 in ConvertRelatedLinksToMultiUrlPicker.cs is GuidUdi udi = null; (source), so it is very strange to me that a NullReferenceException is occurring here at all.

    I have a few content documents using empty RelatedLink2 fields, but removing them does not solve this issue. Manually replacing all instances of RelatedLinks2 with MultiUrlPicker before upgrading does seem to fix this issue, but the links themselves are not preserved. I checked the database and there doesn't seem to be any missing values.

    Hopefully someone can provide some insight into this problem. Any help will be greatly appreciated!

  • Nathan 11 posts 101 karma points c-trib
    Jul 06, 2023 @ 20:32
    Nathan
    101

    Update:

    Built a blank Umbraco v8.18.8 site from scratch and it turns out the debugger was slightly off - the NullReferenceException was actually occuring on line 64:

    if (relatedLink.IsInternal) {
      ...
    

    For some unknown reason, some of the relatedLinks were null at this point, so I added a simple check right before this if-statement:

    if (relatedLink == null)
      continue;
    

    In order to use the ProWorks.Umbraco8.Migrations package, I then re-built Umbraco.Core, took src\Umbraco.Core\bin\Release\Umbraco.Core.dll from the custom-built project, and replaced packages\UmbracoCms.Core.8.18.8\lib\net472\Umbraco.Core.dll in my previous blank v8.18.8 project. I've submitted a pull request for this change here.

Please Sign in or register to post replies

Write your reply to:

Draft