Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeInitializationException on initialization #3624

Closed
sledderGIT opened this issue Jun 17, 2024 · 3 comments
Closed

TypeInitializationException on initialization #3624

sledderGIT opened this issue Jun 17, 2024 · 3 comments

Comments

@sledderGIT
Copy link

sledderGIT commented Jun 17, 2024

What happened?

Trying to init realm launching the app on ios simulator using:
var config = new RealmConfiguration("AAA0aAB8AAA3NDUzZmM1ZGY0YmEwMDY5MjExAAA5")
{
SchemaVersion = RealmVersion,
ShouldDeleteIfMigrationNeeded = true
};
await Realm.GetInstanceAsync(config);

Getting an exception:
System.TypeInitializationException: The type initializer for 'Realms.SharedRealmHandle' threw an exception.

Repro steps

  1. await Realm.GetInstanceAsync(config);
  2. Crash

Version

.NET 8, iOS Simulator 17.2, Mac M1 chip, Sonoma 14.1.2 (23B92)

What Atlas Services are you using?

Local Database only

What type of application is this?

Xamarin

Client OS and version

iOS simulator 17.2 Realm 12.2

Code snippets

var config = new RealmConfiguration("AAA0aAB8AAA3NDUzZmM1ZGY0YmEwMDY5MjExAAA5")
{
SchemaVersion = RealmVersion,
ShouldDeleteIfMigrationNeeded = true
};
await Realm.GetInstanceAsync(config);

Stacktrace of the exception/crash you're getting

System.TypeInitializationException: The type initializer for 'Realms.SharedRealmHandle' threw an exception.
 ---> System.EntryPointNotFoundException: realm_syncuser_install_callbacks
   at Realms.Sync.SyncUserHandle.Initialize()
   at Realms.NativeCommon.Initialize()
   at Realms.SharedRealmHandle..cctor()
   --- End of inner exception stack trace ---
   at Realms.RealmConfiguration.CreateHandle(Configuration& configuration)
   at Realms.RealmConfiguration.<>c__DisplayClass29_0.<CreateHandleAsync>b__0()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__281_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread , ExecutionContext , ContextCallback , Object )
--- End of stack trace from previous location ---
   at Realms.RealmConfiguration.CreateHandle(Configuration& configuration)
   at Realms.RealmConfiguration.<>c__DisplayClass29_0.<CreateHandleAsync>b__1(Task _)
   at System.Threading.Tasks.ContinuationResultTaskFromTask`1[[Realms.SharedRealmHandle, Realm, Version=12.2.0.0, Culture=neutral, PublicKeyToken=null]].InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__281_0(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext , ContextCallback , Object )
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext , ContextCallback , Object )
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& , Thread )
--- End of stack trace from previous location ---
   at Realms.RealmConfigurationBase.CreateRealmAsync(CancellationToken cancellationToken)
   at CTeleport.Mobile.Core.RealmStore.RealmConfigurator.GetRealmInstance(String id) in /Users/alexeyshavrukov/projects/cteleport/mobile/src/CTeleport.Mobile.Core/RealmStore/RealmConfigurator.cs:line 24
   at CTeleport.Mobile.Core.RealmStore.StorageManager.<GetStorage>d__7`1[[CTeleport.Mobile.Core.RealmStore.Models.ISettingsStorage, CTeleport.Mobile.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
   at Realms.RealmConfiguration.CreateHandle(Configuration& configuration)
   at Realms.RealmConfiguration.<>c__DisplayClass29_0.<CreateHandleAsync>b__1(Task _)
   at System.Threading.Tasks.ContinuationResultTaskFromTask`1[[Realms.SharedRealmHandle, Realm, Version=12.2.0.0, Culture=neutral, PublicKeyToken=null]].InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__281_0(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext , ContextCallback , Object )
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext , ContextCallback , Object )
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& , Thread )
--- End of stack trace from previous location ---
   at Realms.RealmConfigurationBase.CreateRealmAsync(CancellationToken cancellationToken)
   at Realms.RealmConfiguration.CreateHandle(Configuration& configuration)
   at Realms.RealmConfiguration.<>c__DisplayClass29_0.<CreateHandleAsync>b__0()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__281_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread , ExecutionContext , ContextCallback , Object )
--- End of stack trace from previous location ---
   at Realms.RealmConfiguration.CreateHandle(Configuration& configuration)
   at Realms.RealmConfiguration.<>c__DisplayClass29_0.<CreateHandleAsync>b__1(Task _)
   at System.Threading.Tasks.ContinuationResultTaskFromTask`1[[Realms.SharedRealmHandle, Realm, Version=12.2.0.0, Culture=neutral, PublicKeyToken=null]].InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__281_0(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext , ContextCallback , Object )
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext , ContextCallback , Object )
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& , Thread )
--- End of stack trace from previous location ---
   at Realms.RealmConfigurationBase.CreateRealmAsync(CancellationToken cancellationToken)
   at CTeleport.Mobile.Core.RealmStore.RealmConfigurator.GetRealmInstance(String id) in /Users/alexeyshavrukov/projects/cteleport/mobile/src/CTeleport.Mobile.Core/RealmStore/RealmConfigurator.cs:line 24
   at CTeleport.Mobile.Core.RealmStore.StorageManager.<GetStorage>d__7`1[[CTeleport.Mobile.Core.RealmStore.Models.ISettingsStorage, CTeleport.Mobile.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
   at Realms.RealmConfiguration.CreateHandle(Configuration& configuration)
   at Realms.RealmConfiguration.<>c__DisplayClass29_0.<CreateHandleAsync>b__0()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__281_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread , ExecutionContext , ContextCallback , Object )
--- End of stack trace from previous location ---
   at Realms.RealmConfiguration.CreateHandle(Configuration& configuration)
   at Realms.RealmConfiguration.<>c__DisplayClass29_0.<CreateHandleAsync>b__1(Task _)
   at System.Threading.Tasks.ContinuationResultTaskFromTask`1[[Realms.SharedRealmHandle, Realm, Version=12.2.0.0, Culture=neutral, PublicKeyToken=null]].InnerInvoke()
   at System.Threading.Tasks.Task.<>c.<.cctor>b__281_0(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext , ContextCallback , Object )
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext , ContextCallback , Object )
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& , Thread )
--- End of stack trace from previous location ---
   at Realms.RealmConfigurationBase.CreateRealmAsync(CancellationToken cancellationToken)
   at CTeleport.Mobile.Core.RealmStore.RealmConfigurator.GetRealmInstance(String id) in /Users/alexeyshavrukov/projects/cteleport/mobile/src/CTeleport.Mobile.Core/RealmStore/RealmConfigurator.cs:line 24
   at CTeleport.Mobile.Core.RealmStore.StorageManager.<GetStorage>d__7`1[[CTeleport.Mobile.Core.RealmStore.Trips.ITripsStorage, CTeleport.Mobile.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
   at CTeleport.Mobile.Core.Services.Archive.BookingArchiveService.GetAllActiveTripsFromStorageAsync() in /Users/alexeyshavrukov/projects/cteleport/mobile/src/CTeleport.Mobile.Core/Services/Archive/BookingArchiveService.cs:line 102
   at CTeleport.Mobile.Core.ViewModels.Archive.ArchiveViewModel.LoadCachedBookings() in /Users/alexeyshavrukov/projects/cteleport/mobile/src/CTeleport.Mobile.Core/ViewModels/Archive/ArchiveViewModel.cs:line 391

Relevant log output

No response

Copy link

sync-by-unito bot commented Jun 17, 2024

➤ PM Bot commented:

Jira ticket: RNET-1157

@nirinchev
Copy link
Member

This appears to be an issue with the native binary not being available/being corrupt when we try to access it at runtime. Is this a Xamarin or a Maui app? Also, can you try to rebuild/reinstall the app just in case.

@sledderGIT
Copy link
Author

Ok cleaned everything and it worked.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants