Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sitecore's "Links" button doesn't work because of a null-reference exception

I am trying to see a certain item's linked items. I am doing this on a client's content management server. When I click on Navigate -> Links, nothing happens. I get this error in the JavaScript console:

http://sitename.local/sitecore/shell/default.aspx?xmlcontrol=Gallery.Links&…de-DE&vs=1&db=master&sc_content=master&ShowEditor=1&Ribbon.RenderTabs=true

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Here's what I see in Sitecore logs:

38424 19:09:30 ERROR Application error.
Exception: System.Web.HttpUnhandledException
Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Source: System.Web
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Nested Exception

Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
   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 Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj)
   at Sitecore.Web.UI.Sheer.ClientPage.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Nested Exception

Exception: System.ArgumentNullException
Message: Value cannot be null.
Parameter name: ownerItem
Source: Sitecore.Kernel
   at Sitecore.Diagnostics.Assert.ArgumentNotNull(Object argument, String argumentName)
   at Sitecore.Data.Fields.Field..ctor(ID fieldID, Item ownerItem)
   at Sitecore.Shell.Applications.ContentManager.Galleries.Links.GalleryLinksForm.GetLinkTooltip(Item reference, ItemLink link)
   at Sitecore.Shell.Applications.ContentManager.Galleries.Links.GalleryLinksForm.RenderReferences(StringBuilder result, List`1 references)
   at Sitecore.Shell.Applications.ContentManager.Galleries.Links.GalleryLinksForm.OnLoad(EventArgs e)

It looks like the ownerItem argument is null when creating an item field.

This happens for several different items—e.g. templates and sublayouts.

What is causing this issue and how do I fix it?

like image 495
Dmytro Shevchenko Avatar asked Mar 12 '23 04:03

Dmytro Shevchenko


1 Answers

This issue was registered as a bug in Sitecore and it was fixed in the Sitecore 8.1 update 2 as a part of the fixes merged from 7.2 update 6: "Includes all relevant fixes from Sitecore 7.2 update-6"

https://dev.sitecore.net/Downloads/Sitecore%20Experience%20Platform/Sitecore%2081/Sitecore%20Experience%20Platform%2081%20Update2/Release%20Notes

"452241: Links dialog fails if cross-database links are present" https://sdn.sitecore.net/Products/Sitecore%20V5/Sitecore%20CMS%207/ReleaseNotes/ChangeLog.aspx

To fix the issue in Sitecore 8.1 update 1, please install the following patch:

  1. Put the attached Sitecore.Support.452241.dll file into the bin folder of your solution.
  2. Replace the following string in the Website\sitecore\shell\Applications\Content Manager\Galleries\Links\Gallery Links.xml dialog:
     <CodeBeside Type="Sitecore.Shell.Applications.ContentManager.Galleries.Links.GalleryLinksForm,Sitecore.Client"/>

with the new one:

     <CodeBeside Type="Sitecore.Support.Shell.Applications.ContentManager.Galleries.Links.GalleryLinksForm,Sitecore.Support.452241"/>

Link of the file you can find it here: https://www.dropbox.com/s/l36zqhwjtahl4q2/Sitecore.Support.452241.dll?dl=0

like image 191
Vlad Iobagiu Avatar answered Apr 06 '23 05:04

Vlad Iobagiu