I ran into some weird behavior in Glass Mapper on a recent project, and I wonder if anyone has any insights. I’m tasked with upgrading Sitecore from 8.1 (rev. 160519) to 8.2 Update 7 (the latest 8.x version). When the upgrade was complete, I ran into the general link field error mentioned in this article. So I installed the hotfix and got the site up.
When I tested I ran into a peculiar issue with Glass Mapper. Normal links throughout the site work fine, except for those using Glass’s RenderLink or BeginRenderLink. There, for pages located under the \sitecore\Content\Client\home location it’s carving off the initial \home (so a link to \sitecore\Content\Client\home\students would render as \students instead of \home\students).
However, the Sitecore LinkManager works just fine, and the glass code appears to use LinkManager.
I did this in a view to verify:
@{
var id = Guid.Parse("{74466305-2BB4-44D2-9860-57E35DC970E7}"); // the ID of a link that wasn’t rendering correctly.
var item = SitecoreContext.GetItem<Sitecore.Data.Items.Item>(id);
var sitecoreLink = Sitecore.Links.LinkManager.GetItemUrl(item); //using Sitecore’s link gets me the correct /home/student/application
var glassLink = RenderLink(m => m.CompleteApplication); //this comes back as /student/application
}
My initial thought was Glass was confusing \sitecore\Content\Client\home with \sitecore\Content\Home, but renaming the node and rebuilding the link database didn’t fix anything.
I’ve tried several different versions of the 4.x Glass Mapper with no difference. I’ve started to debug through the Glass Mapper code, but that’s slow going.
Does anyone have any thoughts?