RealmSync crash with Progress for small realm file

Hi, I have implemented a simple progress when I download Realm:

config = new SyncConfiguration(partition, user)  {                             
     OnProgress = progress =>  {                              
            Console.WriteLine($"Progress: {progress.TransferredBytes}/{progress.TransferableBytes}");                           
       }                            
 };
                        
realm = await Realm.GetInstanceAsync(config);
Console.WriteLine($"Realm is located at: {realm.Config.DatabasePath}");

With medium/large realm file (up to 5Mb) all is ok

With small realm file (i.e. 2Mb) I have a crash after initial sync and realm not sync any modify in client app:

2021-09-20 23:06:09.355727+0200 Talk.iOS[74660:2669224] 2021-09-20 21:06:09.347 Info: Connection[1]: Session[1]: client_reset_config = false, Realm exists = true, client reset = false
Thread started:  #14
2021-09-20 23:06:09.397488+0200 Talk.iOS[74660:2669224] 2021-09-20 21:06:09.397 Info: Connection[1]: Connected to endpoint '3.124.220.115:443' (from '192.168.1.167:50413')
2021-09-20 23:06:10.476864+0200 Talk.iOS[74660:2668981] Progress: 1334948/1404021
2021-09-20 23:06:10.500245+0200 Talk.iOS[74660:2668979] Progress: 1400540/1404021
2021-09-20 23:06:10.501854+0200 Talk.iOS[74660:2668980] Progress: 1400540/1404021
Thread started: <Thread Pool> #15
2021-09-20 23:06:10.503544+0200 Talk.iOS[74660:2668979] Progress: 1400540/1404021
2021-09-20 23:06:10.505378+0200 Talk.iOS[74660:2668936] Realm is located at: /Users/luigi/Library/Developer/CoreSimulator/Devices/C85ADBD1-80E2-407F-915B-5CC413BF9E11/data/Containers/Data/Application/050FD23B-C697-484E-BA35-B4D2FE733A17/Documents/mongodb-realm/talk-yhycl/614895388a3c034fe301a1bb/s_cs.realm
Thread finished:  #8
Loaded assembly: /Users/luigi/Library/Developer/CoreSimulator/Devices/C85ADBD1-80E2-407F-915B-5CC413BF9E11/data/Containers/Bundle/Application/73E42563-8360-4FA9-99AE-3CEFE281BE06/Talk.iOS.app/System.Buffers.dll [External]
Loaded assembly: /Users/luigi/Library/Developer/CoreSimulator/Devices/C85ADBD1-80E2-407F-915B-5CC413BF9E11/data/Containers/Bundle/Application/73E42563-8360-4FA9-99AE-3CEFE281BE06/Talk.iOS.app/Remotion.Linq.dll [External]
=================================================================
	Native Crash Reporting
=================================================================
Got a segv while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================
=================================================================
	Native stacktrace:
=================================================================
	0x109aee035 - /Users/luigi/Library/Developer/CoreSimulator/Devices/C85ADBD1-80E2-407F-915B-5CC413BF9E11/data/Containers/Bundle/Application/73E42563-8360-4FA9-99AE-3CEFE281BE06/Talk.iOS.app/Frameworks/Mono.framework/Mono : mono_dump_native_crash_info
	0x109a8d79e - /Users/luigi/Library/Developer/CoreSimulator/Devices/C85ADBD1-80E2-407F-915B-5CC413BF9E11/data/Containers/Bundle/Application/73E42563-8360-4FA9-99AE-3CEFE281BE06/Talk.iOS.app/Frameworks/Mono.framework/Mono : mono_handle_native_crash
	0x1099ee38b - /Users/luigi/Library/Developer/CoreSimulator/Devices/C85ADBD1-80E2-407F-915B-5CC413BF9E11/data/Containers/Bundle/Application/73E42563-8360-4FA9-99AE-3CEFE281BE06/Talk.iOS.app/Frameworks/Mono.framework/Mono : mono_sigsegv_signal_handler_debug
	0x7fff60335d7d - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_platform.dylib : _sigtramp
	0x7fff8000a160 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_c.dylib : __c_locale
	0x109c4b3f7 - /Users/luigi/Library/Developer/CoreSimulator/Devices/C85ADBD1-80E2-407F-915B-5CC413BF9E11/data/Containers/Bundle/Application/73E42563-8360-4FA9-99AE-3CEFE281BE06/Talk.iOS.app/Frameworks/Mono.framework/Mono : ves_icall_System_GCHandle_CheckCurrentDomain
	0x10d5ede90 - Unknown
	0x10944d0f2 - /Users/luigi/Library/Developer/CoreSimulator/Devices/C85ADBD1-80E2-407F-915B-5CC413BF9E11/data/Containers/Bundle/Application/73E42563-8360-4FA9-99AE-3CEFE281BE06/Talk.iOS.app/Frameworks/realm-wrappers.framework/realm-wrappers : _ZNSt3__110__function6__funcIZN5realm5_impl20SyncProgressNotifier15NotifierPackage17create_invocationERKNS4_8ProgressERbE3$_7NS_9allocatorISA_EEFvvEEclEv
	0x109445003 - /Users/luigi/Library/Developer/CoreSimulator/Devices/C85ADBD1-80E2-407F-915B-5CC413BF9E11/data/Containers/Bundle/Application/73E42563-8360-4FA9-99AE-3CEFE281BE06/Talk.iOS.app/Frameworks/realm-wrappers.framework/realm-wrappers : _ZN5realm5_impl20SyncProgressNotifier6updateEyyyyyy
	0x10944b807 - /Users/luigi/Library/Developer/CoreSimulator/Devices/C85ADBD1-80E2-407F-915B-5CC413BF9E11/data/Containers/Bundle/Application/73E42563-8360-4FA9-99AE-3CEFE281BE06/Talk.iOS.app/Frameworks/realm-wrappers.framework/realm-wrappers : _ZNSt3__110__function6__funcIZN5realm11SyncSession22do_create_sync_sessionEvE3$_3NS_9allocatorIS4_EEFvyyyyyyEEclEOyS9_S9_S9_S9_S9_
	0x1094eb07a - /Users/luigi/Library/Developer/CoreSimulator/Devices/C85ADBD1-80E2-407F-915B-5CC413BF9E11/data/Containers/Bundle/Application/73E42563-8360-4FA9-99AE-3CEFE281BE06/Talk.iOS.app/Frameworks/realm-wrappers.framework/realm-wrappers : _ZN12_GLOBAL__N_114SessionWrapper15report_progressEv
	0x10952205d - /Users/luigi/Library/Developer/CoreSimulator/Devices/C85ADBD1-80E2-407F-915B-5CC413BF9E11/data/Containers/Bundle/Application/73E42563-8360-4FA9-99AE-3CEFE281BE06/Talk.iOS.app/Frameworks/realm-wrappers.framework/realm-wrappers : _ZN5realm5_impl14ClientImplBase7Session24receive_download_messageERKNS_4sync12SyncProgressEyRKNSt3__16vectorINS3_11Transformer15RemoteChangesetENS7_9allocatorISA_EEEE
	0x10951fa43 - /Users/luigi/Library/Developer/CoreSimulator/Devices/C85ADBD1-80E2-407F-915B-5CC413BF9E11/data/Containers/Bundle/Application/73E42563-8360-4FA9-99AE-3CEFE281BE06/Talk.iOS.app/Frameworks/realm-wrappers.framework/realm-wrappers : _ZN5realm5_impl14ClientProtocol22parse_message_receivedINS0_14ClientImplBase10ConnectionEEEvRT_PKcm
	0x10951aa24 - /Users/luigi/Library/Developer/CoreSimulator/Devices/C85ADBD1-80E2-407F-915B-5CC413BF9E11/data/Containers/Bundle/Application/73E42563-8360-4FA9-99AE-3CEFE281BE06/Talk.iOS.app/Frameworks/realm-wrappers.framework/realm-wrappers : _ZN5realm5_impl14ClientImplBase10Connection33websocket_binary_message_receivedEPKcm
	0x10970a0a5 - /Users/luigi/Library/Developer/CoreSimulator/Devices/C85ADBD1-80E2-407F-915B-5CC413BF9E11/data/Containers/Bundle/Application/73E42563-8360-4FA9-99AE-3CEFE281BE06/Talk.iOS.app/Frameworks/realm-wrappers.framework/realm-wrappers : _ZN12_GLOBAL__N_19WebSocket17frame_reader_loopEv
	0x109526b4c - /Users/luigi/Library/Developer/CoreSimulator/Devices/C85ADBD1-80E2-407F-915B-5CC413BF9E11/data/Containers/Bundle/Application/73E42563-8360-4FA9-99AE-3CEFE281BE06/Talk.iOS.app/Frameworks/realm-wrappers.framework/realm-wrappers : _ZN5realm4util7network7Service9AsyncOper22do_recycle_and_executeINSt3__18functionIFvNS5_10error_codeEmEEEJRS7_RmEEEvbRT_DpOT0_
	0x109526614 - /Users/luigi/Library/Developer/CoreSimulator/Devices/C85ADBD1-80E2-407F-915B-5CC413BF9E11/data/Containers/Bundle/Application/73E42563-8360-4FA9-99AE-3CEFE281BE06/Talk.iOS.app/Frameworks/realm-wrappers.framework/realm-wrappers : _ZN5realm4util7network7Service14BasicStreamOpsINS1_3ssl6StreamEE16BufferedReadOperINSt3__18functionIFvNS8_10error_codeEmEEEE19recycle_and_executeEv
	0x109547a94 - /Users/luigi/Library/Developer/CoreSimulator/Devices/C85ADBD1-80E2-407F-915B-5CC413BF9E11/data/Containers/Bundle/Application/73E42563-8360-4FA9-99AE-3CEFE281BE06/Talk.iOS.app/Frameworks/realm-wrappers.framework/realm-wrappers : _ZN5realm4util7network7Service4Impl3runEv
	0x1094e537d - /Users/luigi/Library/Developer/CoreSimulator/Devices/C85ADBD1-80E2-407F-915B-5CC413BF9E11/data/Containers/Bundle/Application/73E42563-8360-4FA9-99AE-3CEFE281BE06/Talk.iOS.app/Frameworks/realm-wrappers.framework/realm-wrappers : _ZN5realm4sync6Client3runEv
	0x109442b5d - /Users/luigi/Library/Developer/CoreSimulator/Devices/C85ADBD1-80E2-407F-915B-5CC413BF9E11/data/Containers/Bundle/Application/73E42563-8360-4FA9-99AE-3CEFE281BE06/Talk.iOS.app/Frameworks/realm-wrappers.framework/realm-wrappers : _ZNSt3__1L14__thread_proxyINS_5tupleIJNS_10unique_ptrINS_15__thread_structENS_14default_deleteIS3_EEEEZN5realm5_impl10SyncClientC1ENS2_INS7_4util6LoggerENS4_ISB_EEEERKNS7_16SyncClientConfigENS_8weak_ptrIKNS7_11SyncManagerEEEEUlvE0_EEEEEPvSN_
	0x7fff603438fc - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_pthread.dylib : _pthread_start
	0x7fff6033f443 - /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/libsystem_pthread.dylib : thread_start
=================================================================
	Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x109c5d6d6):0x109c5d6c6  48 89 f3 e8 82 2f 01 00 8b 93 d4 00 00 00 31 c9  H..../........1.
0x109c5d6d6  3b 90 d4 00 00 00 0f 94 c1 89 c8 48 83 c4 08 5b  ;..........H...[
0x109c5d6e6  5d c3 0f 1f 84 00 00 00 00 00 55 48 89 e5 5d e9  ].........UH..].
0x109c5d6f6  46 30 01 00 66 0f 1f 44 00 00 55 48 89 e5 5d c3  F0..f..D..UH..].
=================================================================
	Managed Stacktrace:
=================================================================
	  at <unknown> <0xffffffff>
	  at System.Runtime.InteropServices.GCHandle:CheckCurrentDomain <0x0008f>
	  at System.Runtime.InteropServices.GCHandle:op_Explicit <0x00162>
	  at System.Runtime.InteropServices.GCHandle:FromIntPtr <0x00072>
	  at Realms.Sync.SessionHandle:HandleSessionProgress <0x00092>
	  at Realms.Sync.SessionHandle:HandleSessionProgress <0x0011a>
=================================================================

That looks like a bug. Can you file a bug report against the .NET repo: Sign in to GitHub · GitHub? Ideally, if you have a simple app that reproduces the issue, that would help us immensely, but even if you don’t, just filling in the questionnaire will be very valuable.

Done. [Bug]: RealmSync crash with Progress for small realm file · Issue #2632 · realm/realm-dotnet · GitHub

With a new App this not appened.

My very app, after connected, loading all data structure and this bug appened.

Thanks, I believe we have all the necessary information to start looking into it and will continue the investigation in the Github issue. In the meantime, the only workaround I can suggest is to temporarily remove the OnProgress callback until we have a fix for the bug.