The following query works in Debug mode only:
private IQueryable<UserState> UsersOfEmail(string email)
{
return this.realm.All<UserState>()
.Where(u => u.EmailAddress == email);
}
When in Release mode, I get the error:
The rhs of the binary operator 'Equal' should be a constant or closure variable expression
I found a workaround for the error, but it doesn't seem to apply here.
When I check the Enable debugging option for the project (iOS, in this case), it works fine, which is why it was working in Debug mode only in the first place.
Any clue on the relationship between the error and the debugging option?
UPDATE
After further investigation, I found out that this issue has no relation to Realm.
I was misusing the event pub-sub feature of Prism (MVVM framework, among other things), and subscribing multiple times to an event in a view model of a page that would be navigated to and from, without unsubscribing in each interaction.
I thought this was a Realm issue because I didn't realize at first that the email
parameter was null
when in Release mode.
By using the pub-sub correctly, I was able to mitigate the problem. I still don't have an answer as to why it was only happening in Release mode, even though the Linking option was disabled in both build modes.