UWP - Unable to load DLL 'realm-wrappers'

0

I have a Xamarin/Realm app that I created using Visual Studio 2017 on Win10. It targets iOS, Android and UWP. I'm trying to build this solution on Windows and macOS.

I added Realm in macOS and successfully tested my app on Android and iOS. Then when I moved back to my windows machine. It's currently targetting UWP. When I run the app on my Local Machine, I see the following runtime exception:

System.TypeInitializationException occurred
  HResult=0x80131534
  Message=The type initializer for 'Realms.Realm' threw an exception.
  Source=<Cannot evaluate the exception source>
  StackTrace:
   at Realms.Realm.GetInstance(RealmConfigurationBase config)
   at MouseDroid.MainPageViewModel..ctor() in C:\Users\hmurphy\Documents\Pittsh\Projects\mouse_droid\MouseDroid\MainPageViewModel.cs:line 20
   at MouseDroid.MainPage..ctor() in C:\Users\hmurphy\Documents\Pittsh\Projects\mouse_droid\MouseDroid\MainPage.xaml.cs:line 28
   at MouseDroid.App..ctor() in C:\Users\hmurphy\Documents\Pittsh\Projects\mouse_droid\MouseDroid\App.xaml.cs:line 17
   at MouseDroid.UWP.MainPage..ctor() in C:\Users\hmurphy\Documents\Pittsh\Projects\mouse_droid\MouseDroid.UWP\MainPage.xaml.cs:line 24
   at MouseDroid.UWP.MouseDroid_UWP_XamlTypeInfo.XamlTypeInfoProvider.Activate_4_MainPage() in C:\Users\hmurphy\Documents\Pittsh\Projects\mouse_droid\MouseDroid.UWP\obj\x64\Debug\XamlTypeInfo.g.cs:line 207
   at MouseDroid.UWP.MouseDroid_UWP_XamlTypeInfo.XamlUserType.ActivateInstance() in C:\Users\hmurphy\Documents\Pittsh\Projects\mouse_droid\MouseDroid.UWP\obj\x64\Debug\XamlTypeInfo.g.cs:line 429

Inner Exception 1:
DllNotFoundException: Unable to load DLL 'realm-wrappers': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

This happens inside my MainPageViewModel with the call to GetInstance:

public class MainPageViewModel
{
    public IEnumerable<Package> Packages { get; private set; }

    public INavigation Navigation { get; set; }

    private Realm _realm;

    public MainPageViewModel() 
    {
        _realm = Realm.GetInstance();

        Packages = _realm.All<Package>();
    }
}

I'm using 1.5.0. According to this commit, it seems like this shouldn't be an issue.

My configuration is using x86 for UWP. UWP is set to build and deploy. I have re-built my solution, just in case FodyWeaver objects were not generated properly. Am I missing something?

visual-studio
xamarin
uwp
xamarin.forms
realm
asked on Stack Overflow Jul 17, 2017 by Mitkins

1 Answer

2

Update Oct '17: As of Realm 2.0.0, syncing for UWP is fully supported and upgrading to the latest version should solve the issue.


For people who want to stick with pre-2.0, here's the previous answer:

You should remove the Realm package on UWP and instead use Realm.Database one. The reason you're getting this error is that the Realm package includes API related to syncing, which is not yet supported on UWP/Windows.

answered on Stack Overflow Jul 17, 2017 by Nikola Irinchev • edited Oct 28, 2017 by Nikola Irinchev

User contributions licensed under CC BY-SA 3.0