Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
NativeCommon.cs assumes Realm.dll is available in folder at runtime #1249
Initiate Realm database instance
App not crashing and Realm running
App crashes at first attempt to call Realm.GetInstance()
Steps & Code to Reproduce
When Realm initiates it tries to add the wrappers to the system path: source.
I use Costura to package all DLLs into a single exe file. It works as expected when running from
It looks like Realm assumes
This setup will probably work nicely using an installer which copies all the right files to all the right locations, but it's not optimal when using Realm in a "stand-alone exe".
var realm = Realm.GetInstance(); // < This throws an exception
Version of Realm and tooling
Realm version(s): 1.0.4
Xamarin/Visual Studio version: VS2017RC (15.0.26206.0 D15REL)
Which operating system version and device: Windows 10 Enterprise 1607
Realm assumes its assemblies are located on disk in this instance, yes. You can use Costura's
Costura looks interesting, and I believe it might be possible to add out-of-the-box support for it. If you'd be interested in that, please open a new issue requesting it so that other users can vote and help us measure interest and prioritize accordingly.
Costura looks really clever, and I'm big Richter fan, but there may be a gotcha using loading without a temporary copy.
I'm not sure if this would apply but in a former life I did quite a bit of consulting in REALbasic. Back in 2008 they ran into issues with a similar single-executable packaging and loading idea. I found a long essay on why which goes through why this fails on a small number of machines:
the operating system simply does not allow for DLLs to be loaded by anything other than the OS loader...application compatibility shims. Microsoft's OS loader handles these shims internally, and there is absolutely, positively, no way for us to mimic the functionality. We must use the system loader to load DLLs in order for them to be loaded properly.
many times Microsoft comes out with a hotfix that includes more compatibility shims. They have an ever-growing database of times when a shim needs to be loaded. And if the shim isn't loaded, the bugs can be spectacular. Sometimes they're subtle crashes at any point during the application's session. Sometimes it's a crash when the app launches, or a big hairy dialog that makes no sense at various times, etc. What's more, something as simple as installing a hotfix could break an application, but only one one particular hardware configuration!
Finally got back after a bit of travelling.
With the suggested config for Costura it worked like a charm. Here's the gist for those coming here from Google: