Description
Since updating to Visual Studio 15.5.1 (on Windows 10), Xcode 9.2 and the latest stable channel in Xamarin Studio (on the Mac), I have been receiving random native crashes regarding the UIImpactFeedbackGenerator (which is NOT used by me or any 3rd party library I use).
The app was working perfectly before this update.
Steps to Reproduce
I unfortunately cannot give you steps to reproduce as it happens randomly.
Basic Information
Native stack trace
2017-12-07 16:44:08.489 MyApp.iOS[307:35483] * Assertion failure in -[UIImpactFeedbackGenerator _forceDeactivationForStyle:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3698.33.7/UIFeedbackGenerator.m:545
Unhandled Exception:
Foundation.MonoTouchException:
Thread finished: #41
The thread 0x29 has exited with code 0 (0x0).
2017-12-07 16:44:22.874 MyApp.iOS[307:35483]
Unhandled Exception:
Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Exception raised while auto-deactivating for style 2: force deactivating with style TurnOn which is not active (activationCount = -1)
configuration: <_UIImpactFeedbackGeneratorConfiguration: 0x1c4aba820: isEnabled=1, activationStyle=2, requiredSupportLevel=2>
activationCount: -1, styleActivationCount: -1
engines: {(
<_UIFeedbackHapticOnlyEngine: 0x1c42c3f70: state=4, numberOfClients=1, prewarmCount=0, _isSuspended=0>
)}
Native stack trace:
0 CoreFoundation 0x000000018608a37c + 148
1 libobjc.A.dylib 0x00000001852d0528 objc_exception_throw + 56
2 CoreFoundation 0x000000018608a2ac + 0
3 UIKit 0x000000018f
0x00000001013881fc MyApp.iOS + 11977212
17 MyApp.iOS 0x00000001008b77a0 MyApp.iOS + 636832
18 MyApp.iOS 0x0000000100df33b4 MyApp.iOS + 6124468
19 MyApp.iOS 0x0000000104463678 mono_pmip + 22124
20 MyApp.iOS 0x00000001044cfd28 mono_pmip + 466204
21 MyApp.iOS 0x00000001044d2a08 mono_pmip + 477692
22 MyApp.iOS 0x000000010444bf30 _ZN7plcrash3BIT5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 281464
23 MyApp.iOS 0x000000010458fe84 xamarin_localized_string_format_9 + 22244
24 MyApp.iOS 0x00000001008b64bc MyApp.iOS + 631996
25 libdyld.dylib 0x0000000185a6c56c + 4
at ObjCRuntime.Runtime.ThrowNSException (System.IntPtr ns_exception) [0x00000] in /Users/builder/data/lanes/5489/c4240f3f/source/xamarin-macios/src/Ob
jCRuntime/Runtime.cs:362
at ObjCRuntime.Runtime.throw_ns_exception (System.IntPtr exc) [0x00000] in /Users/builder/data/lanes/5489/c4240f3f/source/xamarin-macios/runtime/Delegates.generated.cs:130
at (wrapper native-to-managed) ObjCRuntime.Runtime:throw_ns_exception (intptr)
--- End of stack trace from previous location where exception was thrown ---
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/5489/c4240f3f/source/xamarin-macios/src/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/5489/c4240f3f/source/xamarin-macios/src/UIKit/UIApplication.cs:63
at MyApp.iOS.Application.Main (System.String[] args) [0x00001] in E:-MobilesrcSharediOSMain.cs:9 0 CoreFoundation
0x000000018608a37c + 148
1 libobjc.A.dylib 0x00000001852d0528 objc_exception_throw + 56
2 CoreFoundation 0x000000018608a2ac + 0
3 UIKit 0x000000018ffb0198 + 224
4 UIKit 0x000000018ffafec8 + 116
5 libdispatch.dylib 0x0000000185a06a14 + 16
6 libdispatch.dylib 0x0000000185a0ef08 + 428
7 libdispatch.dylib 0x0000000185a18848 + 1588
8 libdispatch.dylib 0x0000000185a13570 + 720
9 CoreFoundation 0x0000000186032544 + 12
10 CoreFoundation 0x0000000186030120 + 2012
11 CoreFoundation 0x0000000185f4fe58 CFRunLoopRunSpecific + 436
12 GraphicsServices 0x0000000187dfcf84 GSEventRunModal + 100
13 UIKit
0x000000018f5cf67c UIApplicationMain + 236
14 MyApp.iOS 0x0000000101ab32c0 MyApp.iOS + 19493568
15 MyApp.iOS 0x000000010138833c MyApp.iOS + 11977532
16 MyApp.iOS 0x00000001013881fc MyApp.iOS + 11977212
17 MyApp.iOS 0x00000001008b77a0 MyApp.iOS + 636832
18 MyApp.iOS 0x0000000100df33b4 MyApp.iOS + 6124468
19 MyApp.iOS 0x0000000104463678 mono_pmip + 22124
20 MyApp.iOS 0x00000001044cfd28 mono_pmip + 466204
21 MyApp.iOS 0x00000001044d2a08 mono_pmip + 477692
22 MyApp.iOS 0x000000010444bf30 _ZN7plcrash3BIT5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 281464
23 MyApp.iOS 0x000000010458fe84 xamarin_localized_string_format_9 + 22244
24 MyApp.iOS 0
fb0198 + 224
4 UIKit 0x000000018ffafec8 + 116
5 libdispatch.dylib 0x0000000185a06a14 + 16
6 libdispatch.dylib 0x0000000185a0ef08 + 428
7 libdispatch.dylib 0x0000000185a18848 + 1588
8 libdispatch.dylib 0x0000000185a13570 + 720
9 CoreFoundation 0x0000000186032544 + 12
10 CoreFoundation 0x0000000186030120 + 2012
11 CoreFoundation 0x0000000185f4fe58 CFRunLoopRunSpecific + 436
12 GraphicsServices 0x0000000187dfcf84 GSEventRunModal + 100
13 UIKit 0x000000018f5cf67c UIApplicationMain + 236
14 MyApp.iOS 0x0000000101ab32c0 MyApp.iOS + 19493568
15 MyApp.iOS 0x000000010138833c MyApp.iOS + 11977532
16 MyApp.iOS
x00000001008b64bc MyApp.iOS + 631996
25 libdyld.dylib 0x0000000185a6c56c + 4
2017-12-07 16:44:22.880 MyApp.iOS[307:35483] Unhandled managed exception:
Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Exception raised while auto-deactivating for style 2: force deactivating with style TurnOn which is not active (activationCount = -1)
configuration: <_UIImpactFeedbackGeneratorConfiguration: 0x1c4aba820: isEnabled=1, activationStyle=2, requiredSupportLevel=2>
activationCount: -1, styleActivationCount: -1
engines: {(
<_UIFeedbackHapticOnlyEngine: 0x1c42c3f70: state=4, numberOfClients=1, prewarmCount=0, _isSuspended=0>
)}
Native stack trace:
0 CoreFoundation 0x000000018608a37c + 148
1 libobjc.A.dylib 0x00000001852d0528 objc_exception_throw + 56
2 CoreFoundation 0x000000018608a2ac + 0
3 UIKit 0x000000018ffb0198 + 224
4 UIKit 0x000000018ffafec8 + 116
5 libdispatch.dylib 0x0000000185a06a14 + 16
6 libdispatch.dylib 0x0000000185a0ef08 + 428
7 libdispatch.dylib 0x0000000185a18848 + 1588
8 libdispatch.dylib 0x0000000185a13570 + 720
9 CoreFoundation 0x0000000186032544 + 12
10 CoreFoundation 0x0000000186030120 + 2012
11 CoreFoundation 0x0000000185f4fe58 CFRunLoopRunSpecific + 436
12 GraphicsServices 0x0000000187dfcf84 GSEventRunModal + 100
13 UIKit 0x000000018f5cf67c UIApplicationMain + 236
14 MyApp.iOS 0x0000000101ab32c0 MyApp.iOS + 19493568
15 MyApp.iOS 0x000000010138833c MyApp.iOS + 11977532
16 MyApp.iOS 0x00000001013881fc Bate
leur.iOS + 11977212
17 MyApp.iOS 0x00000001008b77a0 MyApp.iOS + 636832
18 MyApp.iOS 0x0000000100df33b4 MyApp.iOS + 6124468
19 MyApp.iOS 0x0000000104463678 mono_pmip + 22124
20 MyApp.iOS 0x00000001044cfd28 mono_pmip + 466204
21 MyApp.iOS 0x00000001044d2a08 mono_pmip + 477692
22 MyApp.iOS 0x000000010444bf30 _ZN7plcrash3BIT5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 281464
23 MyApp.iOS 0x000000010458fe84 xamarin_localized_string_format_9 + 22244
24 MyApp.iOS 0x00000001008b64bc MyApp.iOS + 631996
25 libdyld.dylib 0x0000000185a6c56c + 4
(Foundation.MonoTouchException)
at ObjCRuntime.Runtime.ThrowNSException (System.IntPtr ns_exception) [0x00000] in /Users/builder/data/lanes/5489/c4240f3f/source/xamarin-macio
s/src/ObjCRuntime/Runtime.cs:362
at ObjCRuntime.Runtime.throw_ns_exception (System.IntPtr exc) [0x00000] in /Users/builder/data/lanes/5489/c4240f3f/source/xamarin-macios/runtime/Delegates.generated.cs:130
at (wrapper native-to-managed) ObjCRuntime.Runtime:throw_ns_exception (intptr)
--- End of stack trace from previous location where exception was thrown ---
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/5489/c4240f3f/source/xamarin-macios/src/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/5489/c4240f3f/source/xamarin-macios/src/UIKit/UIApplication.cs:63
at MyApp.iOS.Application.Main (System.String[] args) [0x00001] in E:-MobilesrcSharediOSMain.cs:9
2017-12-07 16:
44:22.881 MyApp.iOS[307:35483] critical: Stacktrace:
2017-12-07 16:44:22.882 MyApp.iOS[307:35483] critical:
Native stacktrace:
2017-12-07 16:44:22.885 MyApp.iOS[307:35483] critical: 0 MyApp.iOS 0x0000000104455560 _ZN7plcrash3BIT5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 319912
2017-12-07 16:44:22.885 MyApp.iOS[307:35483] critical: 1 libsystem_platform.dylib 0x0000000185cabb50 _sigtramp + 52
2017-12-07 16:44:22.886 MyApp.iOS[307:35483] critical: 2 libsystem_pthread.dylib 0x0000000185cb12f8 + 396
2017-12-07 16:44:22.887 MyApp.iOS[307:35483] critical: 3 libsystem_c.dylib 0x0000000185b0afbc abort + 140
2017-12-07 16:44:22.888 MyApp.iOS[307:35483] critical: 4 MyApp.iOS 0x0000000104581944 xamarin_get_block_descriptor + 8532
2017-12-07 16:44:22.888 MyApp.iOS[307:35483] critical: 5 MyApp.iOS 0x0000000104494114 mono_pmip + 221448
2017-12-07 16:44:22.889 MyApp.iOS[307:35483] critical: 6 MyApp.iOS 0x000000010445535c _ZN7plcrash3BIT5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 319396
2017-12-07 16:44:22.890 MyApp.iOS[307:35483] critical: 7 MyApp.iOS 0x000000010445416c _ZN7plcrash3BIT5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 314804
2017-12-07 16:44:22.890 MyApp.iOS[307:35483] critical: 8 MyApp.iOS 0x000000010444c750 _ZN7plcrash3BIT5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 283544
2017-12-07 16:44:22.891 MyApp.iOS[307:35483] critical: 9 MyApp.iOS 0x0000000100e48908 MyApp.iOS + 6473992
2017-12-07 16:44:22.891 MyApp.iOS[307:35483] critical: 10 MyApp.iOS 0x0000000104581698 xamarin_get_block_descriptor + 7848
2017-12-07 16:44:22.892 MyApp.iOS[307:35483] critical: 11 MyApp.iOS 0x0000000104581518 xamarin_get_block_descriptor + 7464
2017-12-07 16:44:22.893 MyApp.iOS[307:35483] critical: 12 MyApp.iOS 0x00000001045814d4 xamarin_get_block_descriptor + 7396
2017-12-07 16:44:22.893 MyApp.iOS[307:35483] critical: 13 MyApp.iOS 0x0000000101b8efd4 MyApp.iOS + 20393940
2017-12-07 16:44:22.894 MyApp.iOS[307:35483] critical: 14 MyApp.iOS 0x000000010457fa60 xamarin_get_block_descriptor + 624
2017-12-07 16:44:22.894 MyApp.iOS[307:35483] critical: 15 MyApp.iOS 0x0000000104581f1c xamarin_get_block_descriptor + 10028
2017-12-07 16:44:22.895 MyApp.iOS[307:35483] critical: 16 CoreFoundation 0x000000018608a6d8 + 628
2017-12-07 16:44:22.896 MyApp.iOS[307:35483] critical: 17 libobjc.A.dylib 0x00000001852d0804 + 112
2017-12-07 16:44:22.896 MyApp.iOS[307:35483] critical: 18 libc++abi.dylib 0x00000001852c054c + 16
2017-12-07 16:44:22.897 MyApp.iOS[307:35483] critical: 19 libc++abi.dylib 0x00000001852c05b8 _ZSt9terminatev + 60
2017-12-07 16:44:22.898 MyApp.iOS[307:35483] critical: 20 libdispatch.dylib 0x0000000185a06a28 + 36
2017-12-07 16:44:22.898 MyApp.iOS[307:35483] critical: 21 libdispatch.dylib 0x0000000185a0ef08 + 428
2017-12-07 16:44:22.899 MyApp.iOS[307:35483] critical: 22 libdispatch.dylib 0x0000000185a18848 + 1588
2017-12-07 16:44:22.899 MyApp.iOS[307:35483] critical: 23 libdispatch.dylib 0x0000000185a13570 + 720
2017-12-07 16:44:22.900 MyApp.iOS[307:35483] critical: 24 CoreFoundation 0x0000000186032544 + 12
2017-12-07 16:44:22.900 MyApp.iOS[307:35483] critical: 25 CoreFoundation 0x0000000186030120 + 2012
2017-12-07 16:44:22.900 MyApp.iOS[307:35483] critical: 26 CoreFoundation 0x0000000185f4fe58 CFRunLoopRunSpecific + 436
2017-12-07 16:44:22.901 MyApp.iOS[307:35483] critical: 27 GraphicsServices 0x0000000187dfcf84 GSEventRunModal + 100
2017-12-07 16:44:22.901 MyApp.iOS[307:35483] critical: 28 UIKit 0x000000018f5cf67c UIApplicationMain + 236
2017-12-07 16:44:22.902 MyApp.iOS[307:35483] critical: 29 MyApp.iOS 0x0000000101ab32c0 MyApp.iOS + 19493568
2017-12-07 16:44:22.902 MyApp.iOS[307:35483] critical: 30 MyApp.iOS 0x000000010138833c MyApp.iOS + 11977532
2017-12-07 16:44:22.902 MyApp.iOS[307:35483] critical: 31 MyApp.iOS 0x00000001013881fc MyApp.iOS + 11977212
2017-12-07 16:44:22.903 MyApp.iOS[307:35483] critical: 32 MyApp.iOS 0x00000001008b77a0 MyApp.iOS + 636832
2017-12-07 16:44:22.903 MyApp.iOS[307:35483] critical: 33 MyApp.iOS 0x0000000100df33b4 MyApp.iOS + 6124468
2017-12-07 16:44:22.903 MyApp.iOS[307:35483] critical: 34 MyApp.iOS 0x0000000104463678 mono_pmip + 22124
2017-12-07 16:44:22.904 MyApp.iOS[307:35483] critical: 35 MyApp.iOS 0x00000001044cfd28 mono_pmip + 466204
2017-12-07 16:44:22.904 MyApp.iOS[307:35483] critical: 36 MyApp.iOS 0x00000001044d2a08 mono_pmip + 477692
2017-12-07 16:44:22.905 MyApp.iOS[307:35483] critical: 37 MyApp.iOS 0x000000010444bf30 _ZN7plcrash3BIT5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 281464
2017-12-07 16:44:22.905 MyApp.iOS[307:35483] critical: 38 MyApp.iOS 0x000000010458fe84 xamarin_localized_string_format_9 + 22244
2017-12-07 16:44:22.906 MyApp.iOS[307:35483] critical: 39 MyApp.iOS 0x00000001008b64bc MyApp.iOS + 631996
2017-12-07 16:44:22.906 MyApp.iOS[307:35483] critical: 40 libdyld.dylib 0x0000000185a6c56c + 4
2017-12-07 16:44:22.906 MyApp.iOS[307:35483] critical:
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
The app has been terminated.
Failed to Stop app: An error occured on client IDB480752 while executing a reply for topic xvs/idb/4.8.0.752/stop-app
The app has been terminated.
If at all possible could you please update your bug with the template filled out? It really helps is triage and track down issues.
Done.
What is interesting about this crash is we also do not use UIImpactFeedbackGenerator. Something is triggering its use, and it really doesn't like something. Without more information this will be really hard to track down. Can you please give us a listing of all external libraries you are using and if at all possible a reproduction project?
Sometimes it happens when tapping on a button, other times when tapping on a picker, and even sometimes while not tapping on anything... very random unfortunately.
Herewith a list of all the nuget packages I use:
AndHUD.1.2.0
BTProgressHUD.1.2.0.6
Clancey.SimpleAuth.1.0.41
Clancey.SimpleAuth.Google.Droid.1.0.8
Clancey.SimpleAuth.Google.iOS.1.0.1
FluentAssertions.4.19.4
HockeySDK.Xamarin.5.0.0
Newtonsoft.Json.10.0.3
Newtonsoft.Json.8.0.3
NUnit.3.9.0
Plugin.FirebasePushNotification.2.1.1-beta
Portable.Ninject.3.3.1
protobuf-portable-net.2.0.0.668
Xamarin.Android.Support.Animated.Vector.Drawable.25.4.0.2
Xamarin.Android.Support.Annotations.25.4.0.2
Xamarin.Android.Support.Compat.25.4.0.2
Xamarin.Android.Support.Core.UI.25.4.0.2
Xamarin.Android.Support.Core.Utils.25.4.0.2
Xamarin.Android.Support.Design.25.4.0.2
Xamarin.Android.Support.Fragment.25.4.0.2
Xamarin.Android.Support.Media.Compat.25.4.0.2
Xamarin.Android.Support.Transition.25.4.0.2
Xamarin.Android.Support.v4.25.4.0.2
Xamarin.Android.Support.v7.AppCompat.25.4.0.2
Xamarin.Android.Support.v7.CardView.25.4.0.2
Xamarin.Android.Support.v7.MediaRouter.25.4.0.2
Xamarin.Android.Support.v7.Palette.25.4.0.2
Xamarin.Android.Support.v7.RecyclerView.25.4.0.2
Xamarin.Android.Support.Vector.Drawable.25.4.0.2
Xamarin.Build.Download.0.4.7
Xamarin.Controls.SignaturePad.2.3.0
Xamarin.Controls.SignaturePad.Forms.2.3.0
Xamarin.Firebase.Common.42.1021.1
Xamarin.Firebase.Iid.42.1021.1
Xamarin.Firebase.iOS.Analytics.4.0.4
Xamarin.Firebase.iOS.CloudMessaging.2.0.4
Xamarin.Firebase.iOS.Core.4.0.8
Xamarin.Firebase.iOS.InstanceID.2.0.4
Xamarin.Firebase.Messaging.42.1021.1
Xamarin.Forms.2.5.0.121934
Xamarin.Forms.Maps.2.5.0.121934
Xamarin.Google.iOS.Core.3.1.0
Xamarin.Google.iOS.SignIn.4.1.0
Xamarin.GooglePlayServices.Auth.42.1021.1
Xamarin.GooglePlayServices.Auth.Base.42.1021.1
Xamarin.GooglePlayServices.Base.42.1021.1
Xamarin.GooglePlayServices.Basement.42.1021.1
Xamarin.GooglePlayServices.Maps.42.1021.1
Xamarin.GooglePlayServices.Tasks.42.1021.1
Steps to reproduce
Create the following view:
<ScrollView>
<StackLayout VerticalOptions="CenterAndExpand">
<Entry />
<Entry />
<Entry />
<Entry />
<Entry />
<Entry />
<Entry />
<Switch />
</StackLayout>
</ScrollView>
(Sorry for Project spam there)
Anyway after some testing it appears this only happens on device, which makes this extra fun.
@jassmith any updates? I have the same issue
My Test Project and Video of the bug are uploaded.
TestScrollIssue.zip
Video with an issue:https://drive.google.com/open?id=0B0xqDNEqdtjcN1llM0FDZDhrZUVJN1hnY3MteXJUSERKV0xV
Hi @jassmith
This is becoming a real problem for us now, do you know when this will be resolved?
Thanks
@jassmith
We have an app where this is also happening. Our work around right now is to make sure the keyboard is being closed by tapping Return rather than tapping off of the keyboard onto the screen. Another work around is to have the user toggle the switch on a particular page first before entering any other data. Any update world be appreciated. Thanks.
For what it's worth, we're encountering this too. Same setup with a few different fields with different keyboard types. It'd be good to know if this was planning on being worked on, we've got some sales guys and the CEO suffering from the bug wanting to know when we're going to fix it..
I'm moving this up to the top of the priority queue now. I can't give an ETA on a fix because I don't know what is wrong yet.
Thanks @jassmith. Just been looking at some of our crash logs, and this is currently our highest crash. If it helps, here's a breakdown of devices and iOS versions we're seeing it on:
@gstevenson it would help a lot more if we knew you had say iOS 10 users who were never seeing the issue or something like that.
I've used the sample code from @RalphJacobson (https://github.com/xamarin/Xamarin.Forms/issues/1353#issuecomment-350660860) as well as the test project from @aleksandrsmyk (https://github.com/xamarin/Xamarin.Forms/issues/1353#issuecomment-351983335), and I have been unable to reproduce the issue at all. Thinking that this was likely a sporadic issue, I tested the scenario repeatedly for more than an hour and was unable to get a crash.
I'm using XCode 9.2, Xamarin.iOS 11.6.1.4, testing on an iPhone 6 with 11.2.5.
Has anyone here experienced this issue with a build from Xamarin.iOS 11.6.1.4? That seems to be the only variable I can think of that would prevent me from reproducing the issue.
Happened once while doing internal tests on iPhone 7 plus with 11.2.5 - Xamarin.iOS 11.6.1.4
Was not able to reproduce it anymore
NSInternalInconsistencyException: Exception raised while auto-deactivating
Definitely not a sporadic issue, I can replicate this consistently every time on different devices with Xamarin.iOS 11.6.1.4.
Please follow my steps to replicate to the T, especially point 2 "Scroll the view up to make the switch visible (without closing the keyboard.)"
@samhouts just tested it on a Plus and could not replicate the issue. Use any other device that's not a Plus.
Hmm, interesting. I'm not using a Plus, and I believe I did follow the instructions to a T repeatedly. I see every behavior described except for #6. Boom
.
Are you deploying in release mode? There has to be some other variable here that's different; we just need to find it. :)
@samhouts you are using an actual device and not a simulator, correct?
Perhaps @jassmith can show you how to replicate?
@samhouts I've ran into this issue as well. But in release mode only and on a real device (Iphone 7...)
@RalphJacobson I will try to replicate again. Release mode may be required as I recall... I only ever got it to do it once after fucking with it for 20+ minutes.
I am currently having this same issue. If your keyboard is displayed and you touch the switch, the keyboard closes. If you then touch the switch again to change its state, the app will crash after 7 seconds.
If you close the keyboard by any other means it does not seem to crash.
My Layout is basically an image, an Editor and a Switch in a StackLayout in a ScrollView.
Happens in Debug mode, on a real device (iPhone 7)
Hoping this will help you reproduce the issues.
@Corneliuskruger Interesting... I also have a a
<ScrollView>
<StackLayout>
<Entry/>
</Entry>
<StackLayout>
<Label/>
<Switch/>
</StackLayout>
</StackLayout>
</ScrollView>
I don't know how the issue happened in my case since it crashed on a client device. But the scenario you mentionned seams to be real
@drznathou I have almost the exact same layout.
As I said before, it only happened if you touched the switch when the keyboard was open. So I devised a play to "Hide" the switch while the keyboard is open.
I was able to implement a work around for this. Here is the steps:
<Editor Text="{Binding Text}"
Focused="Editor_Focused"
Unfocused="Editor_Unfocused" />
<StackLayout Orientation="Horizontal"
x:Name="switchStack">
<Switch IsToggled="{Binding DidConsent}" />
<Label Text="I Agree" />
</StackLayout>
Add Focused and Unfocused event handlers to Editor control.
In Editor_Focused set InputTransparent on the stackpanel that contains the switch to true.
switchStack.InputTransparent = true;
In Editor_Unfocused set InputTransparent back to fasle.
switchStack.InputTransparent = false;
Hahaha thanks nice work arround! InputTransparent property is perfect for the case
@Corneliuskruger we are desperately struggling to reproduce this issue. We can't repro with the repro from @aleksandrsmyk even though we 100% believe he is experiencing this issue.
Is it possible you could take your app and pare it down to the absolute smallest repro you can (ideally launching directly to the page with the issue)? We recognize this is hurting you, but we cant get our hands around this issue :/
I鈥檒l give this ago tomorrow and see if I can create a small sample .sln if nobody else has by the time I get chance, I haven鈥檛 got an iPhone X with me at home (currently snowed in) but I can try with my 8 plus.
@jassmith Ok, I was able to repo it with a new project. It is the Standard Xamarin forms Master Detail template using a shared project.
The trick seems to be that the switch has to be covered by the keyboard when the keyboard opens, you then have to scroll to see the switch.
If you tap the switch the first time, it should not change state. It should only close the keyboard.
If you tap it the second time, it should change state and then crash 7 seconds later.
Here is the repo: https://github.com/Corneliuskruger/App1
Hope that helps.
@Corneliuskruger thanks will get back to you ASAP.
Good news! We were able to reproduce the issue on our PM's iPhone X reliably. Bad news: he lives in St. Louis so remote debugging is going to be entertaining :)
@jassmith I can reproduce it on my IPhone7 running 11.2.5 every time with the repo I sent. If you need any other info to narrow it down, let me know.
Also had it on an IPhone X with 11.2.6
Well we have discovered the following things:
1) This is not an issue specific to Xamarin.Forms, there are people getting it using obj-c
2) This is specific to controls which generate haptic feedback when touched
3) It only happens if you get a "magic touch" where the control clearly gets tapped but somehow the event gets swallowed causing the UISwitch not to toggle. The keyboard will dismiss automatically as it swallows the event and the UISwitch haptic feedback generator is now in the bad state primed to cause the crash.
4) Preventing input to the controls which generate haptic feedback while the keyboard is visible entirely removes the issue.
5) We believe but have not yet confirmed that the setting of the insets is also related (we auto-inset scrollable regions when the keyboard becomes visible). This simply means we have been unable to crash the repro with this code disabled.
6) Just moving where in the app the switch happens to be when the keyboard is shown will ALSO prevent the crash... for reasons unknown.
Soooooooooo with all that I'm 120% confused. I think there is a bug with insets and touches and I dont know what else. I don't know what, if anything we can do to fix it, I wouldn't even know where to start. So dear community of developers, what have you got for me?
Oh yeah also we know its not something silly like a bad async/await swallowing an exception, that was one of my first guesses.
So in the meantime, will the workaround that @Corneliuskruger created stop the apps from crashing?
Yes simply marking haptic feedback enabled views as input transparent will prevent them from crashing when the keyboard shows. It appears to be a bug down in the iOS implementation of haptic feedback we are triggering, we have been unable to find a workaround.
+1
I'm also seeing this issue specifically on iPhone X devices. Will try the workaround suggested by @Corneliuskruger .
Our first reports came from an X but I've been able to reproduce on my 8+ too. I'm almost finished with the suggested workaround (disabling touch), so that'll hopefully buy us some time.
For the workaround is it enough to set InputTransparent
on the switch itself?
I was able replicate the issue using @RalphJacobson steps. The workaround suggested by @Corneliuskruger is working for me.
Can reproduce the crash as well (iPhone 8 Plus, iOS 11.3, Debug mode).
The same crash also happens if there is a Picker in the scroll view: when the Picker selection window is opened, scrolling to switch and tapping on it twice leads to a crash.
The workaround suggested by @Corneliuskruger does work for a picker as well as for Entries, but would be good to have some centralized solution (now we have to do the workaround on each page where we have entry/picker/switch in scroll view).
We've been experiencing this crash on iOS 11.3 but have had no instances reported for nearly 3 weeks. I'm wondering if 11.4 has fixed it?
The signs are pointing more and more towards this being a quirk in iOS. I am encouraged by @johndbell's experience. We'll leave this issue open a bit longer for awareness, and hopefully we hear more good reports that the issue is resolved in later versions of iOS and that the workaround is effective in 11.3. Thanks, everyone!
Still happening in 11.4. Workaround similar to @Corneliuskruger
Might be related to
https://bugzilla.xamarin.com/show_bug.cgi?id=52166
is there an issue for 52166 on github?
Team,
We haven't heard anything new about this issue in some time. Does that mean that a later version of iOS did, in fact, fix the issue? We hope so! If not, and you're still experiencing this issue, please reopen this issue and let me know what versions you're using.
Thank you!
Team,
We haven't heard anything new about this issue in some time. Does that mean that a later version of iOS did, in fact, fix the issue? We hope so! If not, and you're still experiencing this issue, please reopen this issue and let me know what versions you're using.
Thank you!
Hi. The issue still exists at iOS versions lower than 12.
Are there some known workarounds or planned fixes?
I am not able to cause the issue on iOS 12.1.4 with Xamarin Forms 3.4. I still use the InputTransparent work around in our production apps, and it does not seem to cause any issues. So I would suggest that if you have to support pre 12 devices.
Most helpful comment
@drznathou I have almost the exact same layout.
As I said before, it only happened if you touched the switch when the keyboard was open. So I devised a play to "Hide" the switch while the keyboard is open.
I was able to implement a work around for this. Here is the steps:
Add Focused and Unfocused event handlers to Editor control.
In Editor_Focused set InputTransparent on the stackpanel that contains the switch to true.
switchStack.InputTransparent = true;
In Editor_Unfocused set InputTransparent back to fasle.
switchStack.InputTransparent = false;