I have been developing a program that interacts with a realm cloud database for the past several months now. During this time my code has worked fine until yesterday. Expected behavior: setup config, connect to realm and get instance, retrieve data into preset structure. Actual behavior, connects but retrieves no data, counts are all 0. Code:
IQueryable<ExampleRoute> AllRoutes = null;
IQueryable<ExampleAsset> AllAssets = null;
List<ExampleTestEvent> AllTestEvents = null;
var credentials = Credentials.UsernamePassword("Redacted", "Example", false);
var admin = await Realms.Sync.User.LoginAsync(credentials, new Uri($"Realm URL"));
var u = new Uri("Correct path.");
var config = new QueryBasedSyncConfiguration(u, admin, "c:\\test.file");
using (var realm = Realm.GetInstance(config))
{
AllRoutes = realm.All<ExampleRoute>();
AllAssets = realm.All<ExampleAsset>();
AllTestEvents = realm.All<ExampleTestEvent>().ToList();
int RouteCount = AllRoutes.Count();
int AssetCount = AllAssets.Count();
int TestCount = AllTestEvents.Count();
}
My current hypothesis is that I lost connection mid transaction. Because this code worked exactly as intended until about noon yesterday. I had internet connection issues in my temp office, and this problem started up. It still connects to the realm server, however nothing comes back when I try to assign AllRoutes = realm.All();
Attempting to run the code with no internet connection results in an error, so I know that the code is connecting to the cloud not a local instance. I have tried deleting the test.file and any other files that are created on run. I have tried reverting to an old version of code that worked last month without my recent changes to the rest of the program.
I found a very old bug, Jan 2018, on the github that mentioned a similar problem, but was subsequently fixed in a later version of Realm. I am using the latest version available in Visual studio pro 2019, which is 4.2.0 with .Net Standard 2.0.
Any help would be appreciated as I have tried everything I can think of. I did create a support ticket request, but while waiting for a response there I wanted to see if anyone here knows how to solve this.