Regarding the error you’re getting - considering you’re using PopulateInitialSubscriptions
, my guess would be that you had opened the Realm before, which means that PopulateInitialSubscriptions
wouldn’t have run - it may not be obvious but it runs only once for the lifetime of the Realm. You can try deleting the local realm file and running your app again. Might be worth also logging something inside PopulateInitialSubscriptions
just to verify it actually runs.
Regarding GetInstanceAsync not completing, you increase the log level to Debug
? You can do that by calling Logger.LogLevel = LogLevel.Debug
before you call App.Create
.
I tried plugging your code in a simple console application and it seemed to have worked for me - I didn’t do any writes as I don’t have the local realm with the language entities, but it could successfully synchronize and both GetInstance
and GetInstanceAsync
complete. Here are the debug logs from when I tried it:
2023-01-13 07:21:50.355 Debug: App: log_in_with_credentials: app_id: dosham-lxwuu
2023-01-13 07:21:50.359 Debug: App: version info: platform: Realm .NET version: Realm .NET - sdk version: 10.19.0 - core version: 12.13.0
2023-01-13 07:21:50.639 Debug: App: update_hostname: https://westeurope.azure.realm.mongodb.com | wss://ws.westeurope.azure.realm.mongodb.com
2023-01-13 07:21:51.094 Debug: App: do_authenticated_request: GET https://westeurope.azure.realm.mongodb.com/api/client/v2.0/auth/profile
2023-01-13 07:21:51.178 Debug: Realm sync client ([realm-core-12.13.0])
2023-01-13 07:21:51.178 Debug: Supported protocol versions: 2-7
2023-01-13 07:21:51.178 Debug: Platform: macOS Darwin 21.6.0 Darwin Kernel Version 21.6.0: Sun Nov 6 23:31:13 PST 2022; root:xnu-8020.240.14~1/RELEASE_ARM64_T6000 arm64
2023-01-13 07:21:51.178 Debug: Build mode: Release
2023-01-13 07:21:51.178 Debug: Config param: one_connection_per_session = true
2023-01-13 07:21:51.178 Debug: Config param: connect_timeout = 120000 ms
2023-01-13 07:21:51.178 Debug: Config param: connection_linger_time = 30000 ms
2023-01-13 07:21:51.178 Debug: Config param: ping_keepalive_period = 60000 ms
2023-01-13 07:21:51.178 Debug: Config param: pong_keepalive_timeout = 120000 ms
2023-01-13 07:21:51.178 Debug: Config param: fast_reconnect_limit = 60000 ms
2023-01-13 07:21:51.178 Debug: Config param: disable_upload_compaction = false
2023-01-13 07:21:51.178 Debug: Config param: disable_sync_to_disk = false
2023-01-13 07:21:51.178 Debug: User agent string: 'RealmSync/12.13.0 (macOS Darwin 21.6.0 Darwin Kernel Version 21.6.0: Sun Nov 6 23:31:13 PST 2022; root:xnu-8020.240.14~1/RELEASE_ARM64_T6000 arm64) '
2023-01-13 07:21:51.197 Detail: Connection[1]: Session[1]: Binding '/Users/nikola.irinchev/mongodb-realm/dosham-lxwuu/63c1068fc865975c79e72031/default.realm' to ''
2023-01-13 07:21:51.197 Debug: Connection[1]: Session[1]: Activating
2023-01-13 07:21:51.197 Info: Connection[1]: Session[1]: client_reset_config = false, Realm exists = true, client reset = false
2023-01-13 07:21:51.197 Debug: Connection[1]: Session[1]: client_file_ident = 0, client_file_ident_salt = 0
2023-01-13 07:21:51.197 Debug: Connection[1]: Session[1]: last_version_available = 6
2023-01-13 07:21:51.197 Debug: Connection[1]: Session[1]: progress_server_version = 0
2023-01-13 07:21:51.197 Debug: Connection[1]: Session[1]: progress_client_version = 0
2023-01-13 07:21:51.197 Debug: Connection[1]: Session[1]: Progress handler called, downloaded = 0, downloadable(total) = 0, uploaded = 0, uploadable = 57, reliable_download_progress = false, snapshot version = 6
2023-01-13 07:21:51.197 Debug: Connection[1]: Session[1]: Progress handler called, downloaded = 0, downloadable(total) = 0, uploaded = 0, uploadable = 57, reliable_download_progress = false, snapshot version = 6
2023-01-13 07:21:51.197 Debug: Connection[1]: Session[1]: Progress handler called, downloaded = 0, downloadable(total) = 0, uploaded = 0, uploadable = 57, reliable_download_progress = false, snapshot version = 6
2023-01-13 07:21:51.198 Debug: WebSocket::Websocket()
2023-01-13 07:21:51.198 Detail: Resolving 'ws.westeurope.azure.realm.mongodb.com:443'
2023-01-13 07:21:51.244 Detail: Connecting to endpoint '40.74.36.35:443' (1/1)
2023-01-13 07:21:51.269 Info: Connected to endpoint '40.74.36.35:443' (from '10.46.0.5:58799')
2023-01-13 07:21:51.411 Debug: WebSocket::initiate_client_handshake()
2023-01-13 07:21:51.512 Debug: WebSocket::handle_http_response_received()
2023-01-13 07:21:51.513 Detail: Connection[1]: Negotiated protocol version: 7
2023-01-13 07:21:51.513 Debug: Connection[1]: Will emit a ping in 9396 milliseconds
2023-01-13 07:21:51.856 Debug: Connection[1]: Session[1]: Received: IDENT(client_file_ident=19, client_file_ident_salt=3673400305230201167)
2023-01-13 07:21:51.858 Debug: Connection[1]: Session[1]: Sending: IDENT(client_file_ident=19, client_file_ident_salt=3673400305230201167, scan_server_version=0, scan_client_version=0, latest_server_version=0, latest_server_version_salt=0, query_version: 0 query_size: 2, query: "{}")
2023-01-13 07:21:51.859 Debug: Connection[1]: Session[1]: Sending: MARK(request_ident=1)
2023-01-13 07:21:51.952 Debug: Connection[1]: Received: DOWNLOAD CHANGESET(server_version=18, client_version=0, origin_timestamp=253524112007, origin_file_ident=1, original_changeset_size=1113, changeset_size=1113)
2023-01-13 07:21:51.952 Debug: Connection[1]: Session[1]: Received: DOWNLOAD(download_server_version=18, download_client_version=0, latest_server_version=18, latest_server_version_salt=8495948514551732795, upload_client_version=0, upload_server_version=0, downloadable_bytes=0, last_in_batch=true, query_version=0, num_changesets=1, ...)
2023-01-13 07:21:51.957 Info: Connection[1]: Session[1]: Begin processing pending FLX bootstrap for query version 0. (changesets: 1, original total changeset size: 1113)
2023-01-13 07:21:51.957 Debug: Connection[1]: Session[1]: Finished changeset indexing (incoming: 1 changeset(s) / 95 instructions, local: 1 changeset(s) / 3 instructions, conflict group(s): 3)
2023-01-13 07:21:51.957 Debug: Connection[1]: Session[1]: Finished transforming 1 local changesets through 1 incoming changesets (3 vs 95 instructions, in 3 conflict groups)
2023-01-13 07:21:51.968 Debug: Connection[1]: Session[1]: Integrated 1 changesets out of 1
2023-01-13 07:21:51.968 Info: Connection[1]: Session[1]: Integrated 1 changesets from pending bootstrap for query version 0, producing client version 10 in 11 ms. 0 changesets remaining in bootstrap
2023-01-13 07:21:51.968 Debug: Connection[1]: Session[1]: Progress handler called, downloaded = 1113, downloadable(total) = 1113, uploaded = 0, uploadable = 57, reliable_download_progress = true, snapshot version = 10
2023-01-13 07:21:51.970 Debug: Connection[1]: Session[1]: Received: MARK(request_ident=1)
2023-01-13 07:21:51.970 Debug: Connection[1]: Session[1]: Sending: UPLOAD(progress_client_version=6, progress_server_version=0, locked_server_version=18, num_changesets=1)
2023-01-13 07:21:51.970 Debug: Connection[1]: Session[1]: Fetching changeset for upload (client_version=5, server_version=0, changeset_size=57, origin_timestamp=253524111194, origin_file_ident=0)
2023-01-13 07:21:51.970 Debug: Connection[1]: Session[1]: Sending: QUERY(query_version=1, query_size=30, query="{"Language":"(TRUEPREDICATE)"}"
2023-01-13 07:21:51.970 Debug: Connection[1]: Session[1]: Sending: MARK(request_ident=2)
2023-01-13 07:21:51.970 Debug: Connection[1]: Session[1]: Sending: UPLOAD(progress_client_version=10, progress_server_version=18, locked_server_version=18, num_changesets=0)
2023-01-13 07:21:51.970 Debug: Connection[1]: Session[1]: Progress handler called, downloaded = 1113, downloadable(total) = 1113, uploaded = 0, uploadable = 57, reliable_download_progress = true, snapshot version = 11
2023-01-13 07:21:52.104 Debug: Connection[1]: Session[1]: Received: DOWNLOAD(download_server_version=19, download_client_version=5, latest_server_version=19, latest_server_version_salt=8560354801592955379, upload_client_version=6, upload_server_version=0, downloadable_bytes=0, last_in_batch=true, query_version=0, num_changesets=0, ...)
2023-01-13 07:21:52.106 Debug: Connection[1]: Session[1]: Sending: UPLOAD(progress_client_version=12, progress_server_version=19, locked_server_version=19, num_changesets=0)
2023-01-13 07:21:52.106 Debug: Connection[1]: Session[1]: Progress handler called, downloaded = 1113, downloadable(total) = 1113, uploaded = 57, uploadable = 57, reliable_download_progress = true, snapshot version = 12
2023-01-13 07:21:52.170 Debug: Connection[1]: Received: DOWNLOAD CHANGESET(server_version=20, client_version=5, origin_timestamp=253524112215, origin_file_ident=1, original_changeset_size=0, changeset_size=0)
2023-01-13 07:21:52.170 Debug: Connection[1]: Session[1]: Received: DOWNLOAD(download_server_version=20, download_client_version=5, latest_server_version=20, latest_server_version_salt=0, upload_client_version=6, upload_server_version=0, downloadable_bytes=0, last_in_batch=true, query_version=1, num_changesets=1, ...)
2023-01-13 07:21:52.171 Info: Connection[1]: Session[1]: Begin processing pending FLX bootstrap for query version 1. (changesets: 1, original total changeset size: 0)
2023-01-13 07:21:52.172 Debug: Connection[1]: Session[1]: Integrated 1 changesets out of 1
2023-01-13 07:21:52.172 Info: Connection[1]: Session[1]: Integrated 1 changesets from pending bootstrap for query version 1, producing client version 14 in 1 ms. 0 changesets remaining in bootstrap
2023-01-13 07:21:52.172 Debug: Connection[1]: Session[1]: Sending: UPLOAD(progress_client_version=14, progress_server_version=20, locked_server_version=20, num_changesets=0)
2023-01-13 07:21:52.173 Debug: Connection[1]: Session[1]: Progress handler called, downloaded = 1113, downloadable(total) = 1113, uploaded = 57, uploadable = 57, reliable_download_progress = true, snapshot version = 14
2023-01-13 07:21:52.174 Debug: Connection[1]: Session[1]: Progress handler called, downloaded = 1113, downloadable(total) = 1113, uploaded = 57, uploadable = 57, reliable_download_progress = true, snapshot version = 15
2023-01-13 07:21:52.175 Debug: Connection[1]: Session[1]: Received: MARK(request_ident=2)
2023-01-13 07:21:52.175 Debug: Connection[1]: Session[1]: Marking query version 1 as complete after receiving MARK message