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

Created on 31 Mar 2018  路  12Comments  路  Source: realm/realm-dotnet

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.

O-Community T-Enhancement

Most helpful comment

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

All 12 comments

Still reproducible in version 3.0.0 of the client NuGet package.

You are correct - non-ascii characters in the path are not supported yet on Windows, sorry about that.

Will it be fixed in the next version? What is expected release date of the next version?

We don't have a timeframe for when this will be addressed.

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.

Correct, we're aware of the problem and are working on finding a path forward. Unfortunately, I still can't provide you with a timeframe other than saying that there are people currently looking at it - if it turns out it's a simple fix, we may ship a fix with the next .NET version (which is planned for mid May). Otherwise, it may have to wait longer.

Is there now any timeframe when this issue would fixed? We also want to use Realm in UWP-Project but we are not able because of the known issue.

Any updates to this?

I think this has been fixed for Windows in realm-core #3293. @nirinchev can you confirm with us here that this Windows fix is part of the latest realm-dotnet release?

It is not part of the latest release unfortunately.

Would it be possible to push this as an update? I am getting a significant amount of crash reports because of this bug

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RealmBot picture RealmBot  路  4Comments

AndyDentFree picture AndyDentFree  路  7Comments

j-hayes picture j-hayes  路  6Comments

tuyen-vuduc picture tuyen-vuduc  路  9Comments

sushihangover picture sushihangover  路  12Comments