In latest Mac Ventura (13.2), latest Visual Studio for Mac 2022 (either Stable or Preview), Realm now fails in MAUI (iOS or Catalyst) on “GetInstance” or “GetInstanceAsync” with a TypeInitializerException for Realms.SharedRealmHandle, reporting a System.DllNotFound exception for @rpath/realm-wrappers.framework/realm-wrappers.
Example failing function added into MainPage.xaml.cs in brand new MAUI app (where p is the Realm directory path, already proven to be accessible):
private async void StartRealm(string p)
{
try
{
Dictionary<int, Realm> Databases = new Dictionary<int, Realm>
{
{ 1, await Realm.GetInstanceAsync
(
new RealmConfiguration(Path.Combine(p, "Primary"))
{
ShouldDeleteIfMigrationNeeded = true,
}
)
}
};
}
catch (Exception ex)
{
string e = ex.Message;
}
}