Glass.Mapper
Glass.Mapper copied to clipboard
Using VersionCountDisabler results in null values when it's disposed
Hello,
In this stackoverflow thread I've shared a problem and a workaround to the issue that we've recently encountered on a project: https://sitecore.stackexchange.com/questions/6581/sitecore-glass-mapper-versioncountdisabler-is-disposed-of-too-early/6582#6582
If you have an item in language X that has droplinks to other items and attempt to do GetItem<T>() through GlassMapper while in language Y, then you'll get all values set to null, which is OK. But if you attempt to enclose the GetItem<T>() method into using(new VersionCountDisabler()) {}, then you'll notice, that the values will be there, but only if you read them at least once within the using clause. If you don't attempt to read any of the values, and the code exists the using clause, then the values will be set back to null.
Is it something I am doing wrong or is it a real issue?
P.S.
I'm using Sitecore 8.1 Update 3 and Sitecore 8.2 Update 4, both with Glass.Mapper 4.3.4.197
Hi
This is an issue we are aware of and will address in the next major version release. This change requires a fundamental change to how the Glass pipelines work and can't be easily fixed in the current version.