Realm fails in MAUI iOS and Mac using Visual Studio Mac

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)
            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;

Have you tried wiping the bin/obj folders and rebuilding your project? This sounds like the native library is not being included correctly in the project and typically, the issue is with the tooling. If the problem persists, can you share a simple project that reproduces the issue?

Thank you for a very quick reply.

As I work primarily with Windows I am still a Mac newbie of sorts, though having owned 2 generations of a Mac Mini, the latter being the 2017 Intel version with 256 GB “hard drive”.

Last August I successfully used Realm in my Maui iOS and Catalyst projects of the time, but later found the Mini’s hard drive had become so filled I could no longer update XCode and newer versions of VS for Mac required that update. Thus, just days ago, I restored the Mini to its initial state, but now with Ventura. The only apps since installed have been the latest XCode and VS for Mac, plus Beyond Compare. When I discovered that Realm now fails in my updated solution in a manner similar to how it had failed before August (my reported Type Initialization exception), I prepared both .Net 7 and .Net 6 Test solutions, whose only changes from the default Maui programs VS provides is adding Realm and code added into MainPage.xaml.cs.

Neither runs, although just once the .Net 7 test ran Catalyst without throwing the error. I was not able to repeat the successful run.

I want to attach that .Net 6 project zipped, although you may have to indicate how, as I do not see an obvious way in the forum reply area (Upload only allows pictures.).

A possible (though unlikely) complication is my personal area was moved to an attached portable drive (as I had always done before) to alleviate Mini HD usage. My VS projects are also on that drive.

It would not be that hard to again reset the Mini and keep everything on it alone. If Realm still failed right after such a reset that reinstalled only XCode and VS, it would surely indicate the problem was not with me. But I would like to see if someone else can actually run the test project both for Catalyst and iOS; I have not been able to.

You can send me the project at or if it’s too large, you could upload it to google drive and share the file with me.

Our tests run both on iOS and Catalyst and they work for us on CI running Intel Macs and locally on our M1s. That being said, I’m running Monterey and not Ventura, so it’s possible either the OS or something peculiar about your project to be the issue. In any case, if you’re able to share the project, we can start ruling out some causes.