RealmException: SetEndOfFile() failed: The requested operation cannot be performed on a file with a user-mapped

cloud

#1

We just struck this error. The C#

Uri dataURI = new Uri($"realms://{server}/~/user");
FullSyncConfiguration config = new FullSyncConfiguration(dataURI, realmUser);
config.EnableSSLValidation = false;
realm = Realm.GetInstance(config);

The stack trace from Microsoft App Center:

Realms.Sync
SharedRealmHandleExtensions.OpenWithSync (Configuration, SyncConfiguration, RealmSchema, Byte[]) + 0x:193
Realms.Sync
SyncConfigurationBase.CreateRealm (RealmSchema) + 0xfd
Realms
Realm.GetInstance (RealmConfigurationBase, RealmSchema) + 0x:253

The full exception is

Realms.Exceptions.RealmException: SetEndOfFile() failed: The requested operation cannot be performed on a file with a user-mapped section open.

We are using Realm 4.2.0 with full sync against Realm Cloud v3.27.2

This error was thrown on App Launch and is the first attempt to return a realm in the app lifecycle.

This configuration is working in production for a couple of years and I haven’t seen this happen before. The error was thrown by an unknown user. I don’t know how to replicate it.

I would appreciate suggestions on how to prevent or mitigate the error.