Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Realm Database Xamarin.Forms iOS Crash with 4.0 #1871

Closed
CraigTenn opened this issue Jun 18, 2019 · 18 comments · Fixed by #1875
Closed

Realm Database Xamarin.Forms iOS Crash with 4.0 #1871

CraigTenn opened this issue Jun 18, 2019 · 18 comments · Fixed by #1875

Comments

@CraigTenn
Copy link

Goals

Upgrade to Realm 4.0.0 in a Xamarin.Forms app on iOS. Also occurs on a brand new Xamarin.Forms app.

Expected Results

Xamarin.Forms app works on iOS and Android.

Actual Results

Xamarin.Forms app crashes on iOS immediately after launch. This starts as soon as Realm package is added, no RealmObjects or Realms in use. Android and UWP work without issue. The crash reports references a realm-wrappers framework, see below.

{"app_name":"XamBugs.iOS","timestamp":"2019-06-18 15:05:27.81 -0500","app_version":"1.0","slice_uuid":"f2c302d9-67e4-3881-b14d-58c883ba2217","adam_id":0,"build_version":"1.0","bundleID":"com.companyname.XamBugs","share_with_app_devs":false,"is_first_party":false,"bug_type":"109","os_version":"iPhone OS 12.3.1 (16F203)","incident_id":"0107B1B2-ADCC-4B5C-9DCE-CB357E76658D","name":"XamBugs.iOS"}
Incident Identifier: 0107B1B2-ADCC-4B5C-9DCE-CB357E76658D
CrashReporter Key: eb22f76304b129bdefc70e2ea5572154552fc2c7
Hardware Model: iPod7,1
Process: XamBugs.iOS [11244]
Path: /private/var/containers/Bundle/Application/76CD7B97-AD9F-4CEE-A121-59BFBED3E736/XamBugs.iOS.app/XamBugs.iOS
Identifier: com.companyname.XamBugs
Version: 1.0 (1.0)
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.companyname.XamBugs [580]

Date/Time: 2019-06-18 15:05:27.7527 -0500
Launch Time: 2019-06-18 15:05:27.6319 -0500
OS Version: iPhone OS 12.3.1 (16F203)
Baseband Version: n/a
Report Version: 104

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Description: DYLD, Library not loaded: realm-wrappers.framework/realm-wrappers | Referenced from: /var/containers/Bundle/Application/76CD7B97-AD9F-4CEE-A121-59BFBED3E736/XamBugs.iOS.app/XamBugs.iOS | Reason: image not found
Triggered by Thread: 0

Thread 0 Crashed:
0 dyld 0x0000000102696398 0x102654000 + 271256
1 dyld 0x00000001026959d8 0x102654000 + 268760
2 dyld 0x0000000102695a08 0x102654000 + 268808
3 dyld 0x00000001026588f8 0x102654000 + 18680
4 dyld 0x000000010265b6e4 0x102654000 + 30436
5 dyld 0x0000000102655044 0x102654000 + 4164

Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x0000000000000006 x1: 0x0000000000000001 x2: 0x000000016f132920 x3: 0x00000000000000a0
x4: 0x000000016f132520 x5: 0x0000000000000000 x6: 0x0073726570706172 x7: 0x0000000000000430
x8: 0x0000000000000020 x9: 0x0000000000000009 x10: 0x61655220200a534f x11: 0x616d69203a6e6f73
x12: 0x20200a534f692e73 x13: 0x203a6e6f73616552 x14: 0x6f6e206567616d69 x15: 0x00646e756f662074
x16: 0x0000000000000209 x17: 0x0000000000000010 x18: 0x0000000000000000 x19: 0x0000000000000000
x20: 0x000000016f132520 x21: 0x00000000000000a0 x22: 0x000000016f132920 x23: 0x0000000000000001
x24: 0x0000000000000006 x25: 0x000000000000002f x26: 0x00000001026af5e0 x27: 0x00000001026af000
x28: 0x00000001026afa00 fp: 0x000000016f1324f0 lr: 0x00000001026959d8
sp: 0x000000016f1324b0 pc: 0x0000000102696398 cpsr: 0x00000000

Binary Images:
0x100ccc000 - 0x10228bfff XamBugs.iOS arm64 /var/containers/Bundle/Application/76CD7B97-AD9F-4CEE-A121-59BFBED3E736/XamBugs.iOS.app/XamBugs.iOS
0x102654000 - 0x1026abfff dyld arm64 <9c893b6aa3b13d9596326ef6952e7195> /usr/lib/dyld

EOF

Steps to Reproduce

  1. Create a Xamarin.Forms app in Visual Studio (I'm on VS2019 on Windows and used the MasterDetail template)
  2. Add Realm 4.0.0 using NuGet
  3. Launch/Debug the iOS app and wait for crash.

Version of Realm and Tooling

Realm 4.0.0
Xamarin.Forms 4.0.0.425677 & 4.0.0.497661
iOS 12.3.1

@Dids
Copy link

Dids commented Jun 21, 2019

I'm assuming it works fine for you in simulators, but crashes instantly on devices? That's what I'm seeing anyway.

@kyurkchyan
Copy link

kyurkchyan commented Jun 21, 2019

Thumbs up on this, having the exact same issue. This utterly blocks us from using Realm, and we can't downgrade to 3.4.0 as then we will loose implicit transactions in UWP.

@CraigTenn
Copy link
Author

@Dids Yes I'm seeing the same behavior. Works on the simulator but crashes on devices. Tested a variety of iPhones and iPods.

@Dids
Copy link

Dids commented Jun 23, 2019

@nirinchev Any chance of an ETA on a fix for this? Or should we downgrade back to 3.x for now?

@nirinchev
Copy link
Member

We'll look into that first thing next week. Sorry for the slow reply rate but both Yavor and I were attending Mongo World in New York. I'm hoping it'll turn out to be a misconfiguration of the cmake script, but will know more tomorrow. In any case, I expect to have something by mid next week.

@ideveloperaz
Copy link

ideveloperaz commented Jun 24, 2019

Hello I have the same issue - app crashes on iOS but runs on simulator (I only added realms 4.0.0 and Realm tag to weaver, not actual use of realm)

But I noticed in Build Output the following:

Target FodyTarget:
Fody: Fody (version 5.1.0.0 @ file:///Users/userr/Documents/xProjects/git.company.com/Company.App/packages/Fody.5.1.0/netclassictask/Fody.dll) Executing
Fody/Realm: Executing Weaver
Fody/Realm: Not weaving assembly 'Company.App.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' because it doesn't reference Realm.
Fody: Finished Fody 1328ms.

@Dids
Copy link

Dids commented Jun 25, 2019

@nirinchev Any news? Sorry, just getting a lot of heat from my client about this, as we've been eagerly waiting for the new subscription functionality in 4.0.0.

@Dids
Copy link

Dids commented Jun 25, 2019

Just throwing this out there, but shouldn't it say Library not loaded: @rpath/realm-wrappers.framework/realm-wrappers instead of Library not loaded: realm-wrappers.framework/realm-wrappers? I can see it's there in the app bundle, so it's likely just looking for it at the wrong path?

I even tried replacing @rpath/realm-wrappers.framework/realm-wrappers with @executable_path/../Frameworks/realm-wrappers.framework/realm-wrappers, but the error is the same, so I guess it's not searching where it's supposed to?

@nirinchev nirinchev mentioned this issue Jun 26, 2019
2 tasks
@nirinchev
Copy link
Member

I believe we have a fix and can share a CI build as soon as it's ready. I expect we'll do an official release by the end of the week.

@ryanherman
Copy link

Another issue is when submitting to the App Store. It complains there is no info.plist with realm. Actual message to follow.

@ryanherman
Copy link

ERROR ITMS-90057: "The bundle 'Payload/oneiota.iOS.app/Frameworks/realm-wrappers.framework' is missing plist key. The Info.plist file is missing the required key: CFBundleShortVersionString. Please find more information about CFBundleShortVersionString at https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleshortversionstring"

ERROR ITMS-90056: "This bundle Payload/oneiota.iOS.app/Frameworks/realm-wrappers.framework is invalid. The Info.plist file is missing the required key: CFBundleVersion. Please find more information about CFBundleVersion at https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion"

@nirinchev
Copy link
Member

@ryanherman this has been reported in another issue: #1870

@ideveloperaz
Copy link

@nirinchev thank you! my issue #1874 with ios crash on early startup fixed! Great Job!

@ideveloperaz
Copy link

waiting for official nuget package :-)

@realm-probot
Copy link

realm-probot bot commented Jun 27, 2019

Hey - looks like you forgot to add a T:* label - could you please add one?

@nirinchev nirinchev self-assigned this Jun 27, 2019
@awaescher
Copy link

I just had the same issue with a brand new Xamarin.Forms project. Then I found that I did not install the Realm package to the iOS project. After I did, the error changed a bit from System.DllNotFoundException: realm-wrappers to System.DllNotFoundException: @rpath/realm-wrappers.framework/realm-wrappers. Sigh.

Magically, upgrading the shared Xamarin.Forms project and the native projects to Xamarin.Forms 4.2.0 (was 4.1.0) and Xamarin.Essentials 1.3.0 (was 1.2.0) solved the issue.

Are there any hidden dependencies I should have known about?

@nirinchev
Copy link
Member

There are no dependencies - my best guess is that VS had cached something and upgrading XF forced it to do a proper rebuild which took care of the Realm issue as well.

@awaescher
Copy link

I thought of that as well but cleaning did not help at all. I missed one thing I usually do to eliminate caching bugs: Doing a git clean -fdx. So for the next dev having the same issue ... you might try that one first.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants