realm-dotnet: System.TypeInitializationException in iOS share extension
Goals
I’m trying to access my realm database, which is stored in the shared memory using an AppGroup.
Expected Results
Realm.GetInstance(Path)
should return an valid instance of the Realm database.
Actual Results
Realm.GetInstance(Path)
crashes throwing the exception below. It doesn’t make any difference if I’m providing a path or using the instance method without parameters.
System.TypeInitializationException: The type initializer for 'Realms.Realm' threw an exception. ---> System.DllNotFoundException: realm-wrappers
at at (wrapper managed-to-native) Realms.NativeCommon:register_notify_realm_changed (Realms.NativeCommon/NotifyRealmCallback)
at Realms.Realm..cctor () [0x0002a] in <550621f4184f47c0bdfce087c391c293>:0
--- End of inner exception stack trace ---
at TestExtension.ActionViewController.ViewDidLoad () [0x00008] in /Users/christianschafers/Projects/Test/TestExtension/ActionViewController.cs:28
Steps to Reproduce
- Create an empty Xamarin.iOS project
- add a share extension
- install Realm using nuGet
- call
Realm.GetInstance()
inViewDidLoad()
in ActionViewController.cs
The issue first occurred in a bigger project, but I can’t tell exactly when the Extension stopped working. It was working fine for a long time, than after some modifications on the main App, I was unable to get the Share Extension working again.
Code Sample
https://github.com/Schaefers/realm-share-extension
Version of Realm and Tooling
- Realm Object Server Version: ?
- Flavor:
- Developer
- Professional
- Enterprise
- Server OS & Version: ? (e.g. CentOS 6)
- Client SDK Version: Realm 1.2.0
- Client OS & Version: macOS 10.12.4
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 18 (8 by maintainers)
I’d be surprised if you’re getting the same error - it’s specific to iOS because that’s the only application type that we modify the realm assembly for. It would be best to open a new issue and post as much detail as possible (ideally with a repro case).