DotNetNuke UserMembership class (as well as some others) hasObjectHydrated property as a flag is object loaded or not.
In my opinion implementation of this pattern is fragile and not reliable.
GetMembership Property of UserInfo tries to load data from UserMembership, which is not good, because Get (read-only) property should not change state of the object.
It can cause different behavior in Debug and Release modes, if any code like Debug.WriteLine(ObjUser.Membership.Email) will be used.
Also assigning any of UserMembership properties (e.g. Email) sets has ObjectHydrated flag to true, even if other properties are not filled.
I’ve noticed a few times that FillUserMembership wasn’t called when expected and properties of UserMembership were null, even if ObjectHydrated flag was true.It caused exceptions, that are not reproducible.