diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs
index 8574002436..8dbb338980 100644
--- a/osu.Game/Database/RealmAccess.cs
+++ b/osu.Game/Database/RealmAccess.cs
@@ -13,6 +13,7 @@
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
+using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Development;
using osu.Framework.Input.Bindings;
@@ -293,7 +294,18 @@ private void cleanupPendingDeletions()
/// Compact this realm.
///
///
- public bool Compact() => Realm.Compact(getConfiguration());
+ public bool Compact()
+ {
+ try
+ {
+ return Realm.Compact(getConfiguration());
+ }
+ // Catch can be removed along with entity framework. Is specifically to allow a failure message to arrive to the user (see similar catches in EFToRealmMigrator).
+ catch (AggregateException ae) when (RuntimeInfo.OS == RuntimeInfo.Platform.macOS && ae.Flatten().InnerException is TypeInitializationException)
+ {
+ return true;
+ }
+ }
///
/// Run work on realm with a return value.
@@ -542,6 +554,11 @@ private Realm getRealmInstance()
return Realm.GetInstance(getConfiguration());
}
+ // Catch can be removed along with entity framework. Is specifically to allow a failure message to arrive to the user (see similar catches in EFToRealmMigrator).
+ catch (AggregateException ae) when (RuntimeInfo.OS == RuntimeInfo.Platform.macOS && ae.Flatten().InnerException is TypeInitializationException)
+ {
+ return Realm.GetInstance();
+ }
finally
{
if (tookSemaphoreLock)