Skip to content

Realm.GetInstanceAsync never completes on some Android devices #3690

@hankovich

Description

@hankovich

What happened?

I am working on an SDK for our backend services, which is a .NET Standard 2.1 NuGet package but is used in Unity (via UnityNuGet). So I use a version from NuGet in Unity. I can't use Unity version directly, because my SDK targets .NET Standard, not Unity.

On some Android devices that we test our application (for example Xiaomi Redmi Note 13 Pro, but only on the physical device, not in browserstack or in emulator) GetInstanceAsync returns a task that never completes. GetInstance works perfectly.

Repro steps

var path = Application.persistentDataPath;

using var unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
using var currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");

var pipePath = currentActivity.Call<AndroidJavaObject>("getFilesDir").Call<string>("getAbsolutePath");

var configuration = new RealmConfiguration(Path.Combine(path, "file.realm"))
{
    FallbackPipePath = pipePath, // https://github.com/realm/realm-dotnet/issues/3286
};

return Realm.GetInstanceAsync(configuration); // never completes

Version

20.1.0

What Atlas Services are you using?

Local Database only

What type of application is this?

Unity

Client OS and version

Android 14

Code snippets

No response

Stacktrace of the exception/crash you're getting

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions