I am running into an issue for a site we are upgrading from 8.1 to 9.0.1. In the process of refactoring and updating the code base, we have upgraded Glass from v3 to v4.5. After doing so, every Glass getitem
(GetCurrentItem
, queries, etc - everything) returns null. I've seen similar posts on StackOverflow that mention language fallback as a likely culprit but the site language is set to "en" in our site configuration and when debugging the Sitecore.Context.Language
is set to "en".
For further context, we've even tried taking DI and other factors out of the equation by setting up a test page on the site. This also returns a null object.
<%
var sitecoreContext = new Glass.Mapper.Sc.SitecoreContext();
var itemId = new Guid("{861C0CDA-FF19-4F1B-BB4C-B65C8E3DA724}");
Sitecore.Context.Language = Sitecore.Data.Managers.LanguageManager.GetLanguage("en");
using (new Sitecore.SecurityModel.SecurityDisabler())
{
var item = sitecoreContext.GetItem<Sitecore.Data.Items.Item>(itemId);
Response.Write(item.Name); //this is null exception b/c item is null
}
%>
(You'll notice that we are trying SecurityDisabler
here as well to make sure that permissions isn't the problem. I'll also note that straight Sitecore API calls work fine.)
Update:
Maybe a clue from FallbackCheckTask
(which I actually don't think we need anymore but that is a different concern):
The args.Result
here is null but scContext.Item
looks correct. Why is the result null? Any ideas on how to dig deeper into that?