question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Realms.Exceptions.RealmFileAccessErrorException: Unable to open a realm at path

See original GitHub issue

Goals

Reliable realm database creation.

Expected Results

Realm instance.

Actual Results

Realms.Exceptions.RealmFileAccessErrorException: ‘Unable to open a realm at path ‘C:\Users\Václav\AppData\Local\Packages\7539ef42-e9e8-4e55-8c45-547c7a6ee489_v1yjhd5ekz562\LocalCache\realmtest.realm.management’: make_dir() failed: No such file or directory.’

Steps to Reproduce

Simple project for bug reproduction: https://1drv.ms/u/s!AlFEHk1e5ZDCoL1NodRClQwLeQdO6A

Code Sample

class RealmEntity : RealmObject {
    [PrimaryKey]
    public long Id { get; set; }
}

readonly static RealmConfiguration config = new RealmConfiguration(Path.Combine(ApplicationData.Current.LocalCacheFolder.Path, "realmtest.realm")) {
    SchemaVersion = 1,
    ObjectClasses = new Type[] { typeof(RealmEntity) },
    ShouldDeleteIfMigrationNeeded = true
};

async void Page_Loaded(object sender, RoutedEventArgs e) {
    using (var realm = await Realm.GetInstanceAsync(config)) {
    }
}

Version of Realm and Tooling

  • Client NuGet package version: 2.2.0
  • Client OS & Version: Windows 10 version 1709 (build 16299.248)

Hint

I think (but I cannot be sure) that instance creation fails because of lack of UTF-8 support. The directory path contains non-ascii characters. I can reproduce this issue only on user accounts with non-ascii characters in the profile directory path.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
nirinchevcommented, Jul 26, 2019

Yes, I was hoping to do a point release this week.

1reaction
juhasunicommented, Apr 23, 2019

This is actually a very serious issue, since realm-dotnet cannot be reliably used with UWP apps that run sandboxed. It is very likely that user’s profile folder contains non-ascii characters. It looks like the issue resides at realm-core’s file.cpp where _mkdir function is used and _wmkdir should be used instead. I’m not experienced in C++, but I assume that it cannot be safely switched to use _wmkdir because the same core is compiled for multiple platforms.

Read more comments on GitHub >

github_iconTop Results From Across the Web

RealmFileException: Unable to open a realm at path #7301
I am running into this issue on Android(The app is ReactNative), iOS works fine. We get the following exception. This is happening mostly...
Read more >
Unable to open a realm at path
I tried to open the realm file using Realm's browser app and the file does not open anymore. It has now new permissions:...
Read more >
Unable to open a realm at path
Realms.Exceptions.RealmFileAccessErrorException: Unable to open a realm at path.
Read more >
Unable to open a realm at path in Xamarin forms
I'm reading data from remote mongodb realm which sync's to my local realm, but it seems I can't read from my local realm...
Read more >
Realm Xamarin 2.0.0
Realm Xamarin is the first database built for mobile. An alternative to SQLite and ORMs that's fast, easy to use, and open source....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found