-
Notifications
You must be signed in to change notification settings - Fork 513
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
iOS regression - crash when parsing JSON #4347
Comments
I can reproduce this on my iPhone 6s. It works OK in the simulator. |
I'm removing the regression label because I can reproduce the issue with Xamarin.iOS 11.10 and Xcode 9.3.1 shown in the build output linked as iOS 11.2. I can also reproduce this with Xamarin.iOS 11.12 and Xcode 9.4.1 which is the versions linked as iOS 11.4. |
This sounds like a linker issue, i.e. it's off by default for the simulator (which works) and enabled by default open device. Serialization (like JSON) is usually done using reflection and types/members must be preserved to work (if they are not directly used by the code). To test this you can:
It the results switch (exception on simulator & working on device) it means the linker needs to be told which extraneous types to preserve, |
@spouliot, I should have mentioned that I tested that... The issue reproduces on a device with Don't Link. The stacktrace is:
|
Yes, I work with @SamsonCodeHeroes. We should have mentioned that we tried disabling the linker first (we've been bitten by that enough before!). We also suspected all sorts of things in terms of what the underlying cause was - immutable collections being the primary candidate. However, changing one thing would change the end result in confounding ways. At one point we even suspected a byte alignment issue with the compiler and tried injecting empty byte arrays to check whether that would cause the issue to go away (it didn't for us). |
hmm... weird
does hint to some reflection code, e.g. where I'll investigate this further using the attached sample. Thanks both for replying with extra information - the obvious is not always the culprit :-) |
@spouliot I work with @kentcb and @SamsonCodeHeroes, I was just wondering if you'd made any progress resolving this issue. It's currently blocking a release for an important client of ours and the app has a significant active user base. |
@spouliot @therealjohn, I'm following up on the above. Are we able to get an update? Thanks |
So, the issue is not related to the (managed) linker. The issue only shows up on ARM64 (both mono and LLVM AOT backends). It works correctly when AOT'ed on ARMv7 (32bits). Very likely it's not a real Going back in time...
@vargaz can you have a look at this ? thanks! |
@vargaz have you been able to make any progress. Our client needs a release out ASAP and this issue is blocking that. |
As a workaround, try to change the order of the parameters to the ServiceDto constructor: |
Thanks for fixing this. Whilst we made some progress by re-ordering parameters, it seems like the crash is manifesting in other ways. For example:
Our hope is that these other crashes we're experiencing have the same underlying cause. Is there an ETA as to when the fix will hit the alpha channel? |
Can someone answer that ? |
Here's another more complete example, showing the hard mono crash too:
We really need some help getting past this issue for our client. Can we get access to early bits with the above fix? Can we get access to older bits before this bug was introduced? |
@kentcb Can you try this package: xamarin.ios-11.17.0.92.pkg and see if it fixes the problem? It contains the fix for this bug. You may run into other issues with this package, but if anything shows up we'll help you get through them since it would be nice to at the very least get a confirmation that the fix actually works for your app. |
Thanks @rolfbjarne! ❤️ My preliminary testing indicates that this fixes both issues (I rolled back our workaround to be sure). This is looking positive, but we'll conduct more in-depth testing and get back to you shortly. |
@rolfbjarne We've done quite extensive testing now and have been unable to reproduce the crash. We're now in discussions around the best path forward with respect to the release. We are cognizant of the risk of a compiler-induced bug being caught after the release, after which we would have no recourse (again). One thing that would help us in our decision making is to have a rough understanding of when this fix will hit the alpha channel. Are you able to provide a rough date, or even an indicative "days", "weeks" or "months"? |
My personal guess would be that it should get into the Alpha channel within a couple of months (in an upcoming (but not the first) preview of our |
Bumps to mono/llvm:release_60@117a508c Bumps to xamarin/xamarin-android-api-compatibility:master@7ccb4802 $ git diff --shortstat e1af6ea..ab3c897d # mono 1443 files changed, 66049 insertions(+), 45745 deletions(-) $ git diff --shortstat bdb3a116..117a508c # llvm 26794 files changed, 4110589 insertions(+), 754376 deletions(-) $ git diff --shortstat c550d1bd..7ccb4802 # xamarin-android-api-compatibility 2 files changed, 16260 insertions(+), 12347 deletions(-) Incomplete summary of easily `grep`able fixes: Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=11199 Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=19436 Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=23668 Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=26983 Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=33728 Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=46917 fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=60065 Fixes: mono/mono#6173 Fixes: mono/mono#6466 Fixes: mono/mono#6647 Fixes: mono/mono#6834 Fixes: mono/mono#7058 Fixes: mono/mono#7137 Fixes: mono/mono#7260 Fixes: mono/mono#7305 Fixes: mono/mono#7402 Fixes: mono/mono#7525 Fixes: mono/mono#7610 Fixes: mono/mono#7649 Fixes: mono/mono#7655 Fixes: mono/mono#7683 Fixes: mono/mono#7685 Fixes: mono/mono#7716 Fixes: mono/mono#7731 Fixes: mono/mono#7785 Fixes: mono/mono#7828 Fixes: mono/mono#7944 Fixes: mono/mono#7947 Fixes: mono/mono#8036 Fixes: mono/mono#8074 Fixes: mono/mono#8089 Fixes: mono/mono#8112 Fixes: mono/mono#8122 Fixes: mono/mono#8143 Fixes: mono/mono#8149 Fixes: mono/mono#8152 Fixes: mono/mono#8175 Fixes: mono/mono#8177 Fixes: mono/mono#8250 Fixes: mono/mono#8267 Fixes: mono/mono#8273 Fixes: mono/mono#8282 Fixes: mono/mono#8310 Fixes: mono/mono#8311 Fixes: mono/mono#8329 Fixes: mono/mono#8340 Fixes: mono/mono#8372 Fixes: mono/mono#8407 Fixes: mono/mono#8409 Fixes: mono/mono#8422 Fixes: mono/mono#8430 Fixes: mono/mono#8439 fixes: mono/mono#8447 Fixes: mono/mono#8469 Fixes: mono/mono#8504 Fixes: mono/mono#8575 Fixes: mono/mono#8597 Fixes: mono/mono#8623 Fixes: mono/mono#8627 Fixes: mono/mono#8698 Fixes: mono/mono#8701 Fixes: mono/mono#8712 Fixes: mono/mono#8721 Fixes: mono/mono#8726 Fixes: mono/mono#8759 Fixes: mono/mono#8787 Fixes: mono/mono#8820 Fixes: mono/mono#8848 Fixes: mono/mono#8866 Fixes: mono/mono#8897 Fixes: mono/mono#8915 Fixes: mono/mono#8970 Fixes: mono/mono#8979 Fixes: mono/mono#9023 Fixes: mono/mono#9031 Fixes: mono/mono#9033 Fixes: mono/mono#9179 Fixes: mono/mono#9234 Fixes: mono/mono#9262 Fixes: mono/mono#9277 Fixes: mono/mono#9318 Fixes: mono/mono#9542 Fixes: mono/mono#9753 Fixes: mono/mono#9839 Fixes: mono/mono#9869 Fixes: mono/mono#9870 Fixes: mono/mono#9943 Fixes: mono/mono#9996 Fixes: mono/mono#10000 Fixes: mono/mono#10303 Fixes: mono/mono#10447 Fixes: mono/mono#10483 Fixes: mono/mono#10488 Fixes: xamarin/maccore#628 Fixes: xamarin/maccore#673 Fixes: #1561 (comment) Fixes: #1845 Fixes: xamarin/xamarin-macios#4347 Fixes: xamarin/xamarin-macios#4617 Fixes: xamarin/xamarin-macios#4618
@rolfbjarne I see that the fix has been merged a while back, but I don't know how to see which channel it has been released in. Is this fix out and available yet? |
@cainunable the first preview release with this fix should come out in a couple of weeks. |
@rolfbjarne I'm getting a similar error as kentcb's so I am hoping this might be a possible solution. If I just install the .pkg above to test that theory, how difficult is it to restore my current working environment? |
@cainunable it should be just a matter of checking for updates in Visual Studio for Mac, and install the offered Xamarin.iOS update. If that doesn't work, you can force the update by switching to a different channel and then switch back again. |
Bumps to mono/api-snapshot@b99fc87c. Bumps to mono/bockbuild@5af573e7. Bumps to mono/boringssl@41221b45. Bumps to mono/corefx@23d0b584. Bumps to mono/corert@af496fc1. Bumps to dotnet/linker@7af03ce0. Bumps to mono/NUnitLite@00e259a4. Bumps to mono/reference-assemblies@93258263. Bumps to mono/roslyn-binaries@249709fa. Bumps to mono/xunit-binaries@bb583470. $ git diff --shortstat b63e5378..23f2024a # mono 1630 files changed, 50926 insertions(+), 92212 deletions(-) Fixes: mono/mono#6352 Fixes: mono/mono#6947 Fixes: mono/mono#6992 Fixes: mono/mono#7615 Fixes: mono/mono#8340 Fixes: mono/mono#8407 Fixes: mono/mono#8575 Fixes: mono/mono#8627 Fixes: mono/mono#8707 Fixes: mono/mono#8766 Fixes: mono/mono#8848 Fixes: mono/mono#8866 Fixes: mono/mono#8935 Fixes: mono/mono#9010 Fixes: mono/mono#9023 Fixes: mono/mono#9031 Fixes: mono/mono#9033 Fixes: mono/mono#9106 Fixes: mono/mono#9109 Fixes: mono/mono#9155 Fixes: mono/mono#9179 Fixes: mono/mono#9232 Fixes: mono/mono#9234 Fixes: mono/mono#9262 Fixes: mono/mono#9277 Fixes: mono/mono#9292 Fixes: mono/mono#9318 Fixes: mono/mono#9318 Fixes: mono/mono#9332 Fixes: mono/mono#9407 Fixes: mono/mono#9421 Fixes: mono/mono#9505 Fixes: mono/mono#9542 Fixes: mono/mono#9581 Fixes: mono/mono#9623 Fixes: mono/mono#9684 Fixes: mono/mono#9750 Fixes: mono/mono#9753 Fixes: mono/mono#9772 Fixes: mono/mono#9839 Fixes: mono/mono#9869 Fixes: mono/mono#9921 Fixes: mono/mono#9943 Fixes: mono/mono#9947 Fixes: mono/mono#9973 Fixes: mono/mono#9996 Fixes: mono/mono#10000 Fixes: mono/mono#10031 Fixes: mono/mono#10035 Fixes: mono/mono#10227 Fixes: mono/mono#10243 Fixes: mono/mono#10303 Fixes: mono/mono#10448 Fixes: mono/mono#10483 Fixes: mono/mono#10488 Fixes: mono/mono#10863 Fixes: mono/mono#11123 Fixes: mono/mono#11138 Fixes? mono/mono#11146 Fixes: mono/mono#11202 Fixes: mono/mono#11378 Fixes: mono/mono#11479 Fixes: mono/mono#11613 Fixes: #1951 Fixes: xamarin/xamarin-macios#4347 Fixes: xamarin/xamarin-macios#4617 Fixes: xamarin/xamarin-macios#4984
…types on IOS. (mono/mono#10525) Fixes xamarin/xamarin-macios#4347. Commit migrated from mono/mono@49cd56f
Since the recent Xamarin iOS tooling update, I am seeing a crash that appears to be related to JSON serialization and
ImmutableArray
(see repro attached below).The following doesn't happen when using the iOS SDK 11.2, but does happen using 11.4. Strangely, commenting out an unrelated property prevents the error.
Steps to Reproduce
Title
property inServiceDto
(other properties should also work).Expected Behavior
JSON string should be logged to output.
Actual Behavior
Null reference exception.
Environment
Error appears to be iPhone-only. Replicated on:
The crash doesn't seem to happen on all devices. The initial error report wasn't replicated on an old iPad2 running iOS 9.3.5, though I haven't been able to re-test this.
IDE:
Example Project
Repro.zip
The text was updated successfully, but these errors were encountered: