Bug 59196 - UIKit.UIAccessibility.RequestGuidedAccessSession(true, (obj) => { }); Crash
Summary: UIKit.UIAccessibility.RequestGuidedAccessSession(true, (obj) => { }); Crash
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll (show other bugs)
Version: XI 10.99 (xcode9)
Hardware: PC Mac OS
: --- normal
Target Milestone: 15.6
Assignee: Sebastien Pouliot
URL:
Depends on:
Blocks:
 
Reported: 2017-09-03 07:04 UTC by Michael Williams
Modified: 2017-10-24 20:54 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: No
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Michael Williams 2017-09-03 07:04:06 UTC
Hi,

My name is Michael Williams from Microsoft, I am the Xamarin TSP based in APAC. A customer in Australia has found an issue within the Xamarin.iOS library calling the following line:

UIKit.UIAccessibility.RequestGuidedAccessSession(true, (obj) => { });

They are trying to use the app in Kiosk mode using guided access. Produces the following stack trace:

2017-09-03 16:50:24.649 MVVMArchitecture.iOS[34054:791525] critical: Stacktrace:

2017-09-03 16:50:24.649 MVVMArchitecture.iOS[34054:791525] critical:   at <unknown> <0xffffffff>
2017-09-03 16:50:24.650 MVVMArchitecture.iOS[34054:791525] critical:   at (wrapper managed-to-native) UIKit.UIAccessibility.UIAccessibilityRequestGuidedAccessSession (bool,System.Action`1<bool>) [0x0001c] in <ef46365b0eaf490385df9fbc37d3de31>:0
2017-09-03 16:50:24.651 MVVMArchitecture.iOS[34054:791525] critical:   at UIKit.UIAccessibility.RequestGuidedAccessSession (bool,System.Action`1<bool>) [0x0001c] in /Users/builder/data/lanes/4991/80b8487d/source/xamarin-macios/src/UIKit/UIAccessibility.cs:209
2017-09-03 16:50:24.651 MVVMArchitecture.iOS[34054:791525] critical:   at MVVMArchitecture.iOS.AppDelegate.FinishedLaunching (UIKit.UIApplication,Foundation.NSDictionary) [0x00013] in /Users/mww121/Projects/MVVMArchitecture/iOS/AppDelegate.cs:18
2017-09-03 16:50:24.651 MVVMArchitecture.iOS[34054:791525] critical:   at (wrapper runtime-invoke) <Module>.runtime_invoke_bool__this___object_object (object,intptr,intptr,intptr) [0x00063] in <20bae823e3b64327a3b6e9bb4565cd6a>:0
2017-09-03 16:50:24.651 MVVMArchitecture.iOS[34054:791525] critical:   at <unknown> <0xffffffff>
2017-09-03 16:50:24.652 MVVMArchitecture.iOS[34054:791525] critical:   at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) [0x0005c] in <ef46365b0eaf490385df9fbc37d3de31>:0
2017-09-03 16:50:24.652 MVVMArchitecture.iOS[34054:791525] critical:   at UIKit.UIApplication.Main (string[],intptr,intptr) [0x00005] in /Users/builder/data/lanes/4991/80b8487d/source/xamarin-macios/src/UIKit/UIApplication.cs:79
2017-09-03 16:50:24.652 MVVMArchitecture.iOS[34054:791525] critical:   at UIKit.UIApplication.Main (string[],string,string) [0x00038] in /Users/builder/data/lanes/4991/80b8487d/source/xamarin-macios/src/UIKit/UIApplication.cs:63
2017-09-03 16:50:24.652 MVVMArchitecture.iOS[34054:791525] critical:   at MVVMArchitecture.iOS.Application.Main (string[]) [0x00001] in /Users/mww121/Projects/MVVMArchitecture/iOS/Main.cs:17
2017-09-03 16:50:24.652 MVVMArchitecture.iOS[34054:791525] critical:   at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) [0x00051] in <20bae823e3b64327a3b6e9bb4565cd6a>:0
2017-09-03 16:50:24.652 MVVMArchitecture.iOS[34054:791525] critical: 
Native stacktrace:

2017-09-03 16:50:24.684 MVVMArchitecture.iOS[34054:791525] critical: 	0   MVVMArchitecture.iOS                0x000000010fbd31e4 mono_handle_native_crash + 244
2017-09-03 16:50:24.685 MVVMArchitecture.iOS[34054:791525] critical: 	1   MVVMArchitecture.iOS                0x000000010fbe0a70 mono_sigsegv_signal_handler + 288
2017-09-03 16:50:24.685 MVVMArchitecture.iOS[34054:791525] critical: 	2   libsystem_platform.dylib            0x000000011b9d6b3a _sigtramp + 26
2017-09-03 16:50:24.685 MVVMArchitecture.iOS[34054:791525] critical: 	3   libsystem_malloc.dylib              0x000000011b7a5c88 _nano_malloc_check_clear + 583
2017-09-03 16:50:24.685 MVVMArchitecture.iOS[34054:791525] critical: 	4   libsystem_blocks.dylib              0x000000011b60fb20 _Block_object_assign + 98
2017-09-03 16:50:24.685 MVVMArchitecture.iOS[34054:791525] critical: 	5   libsystem_blocks.dylib              0x000000011b60f8f0 _Block_copy + 113
2017-09-03 16:50:24.685 MVVMArchitecture.iOS[34054:791525] critical: 	6   libdispatch.dylib                   0x000000011b55d56d _dispatch_Block_copy + 43
2017-09-03 16:50:24.685 MVVMArchitecture.iOS[34054:791525] critical: 	7   libdispatch.dylib                   0x000000011b562dfe dispatch_async + 67
2017-09-03 16:50:24.686 MVVMArchitecture.iOS[34054:791525] critical: 	8   UIKit                               0x0000000114265145 +[NSObject(UIAccessibilityPrivate) __accessibilityRequestGuidedAccessSession:completion:] + 79
2017-09-03 16:50:24.686 MVVMArchitecture.iOS[34054:791525] critical: 	9   ???                                 0x00000001341c66b7 0x0 + 5169243831
2017-09-03 16:50:24.686 MVVMArchitecture.iOS[34054:791525] critical:
Comment 1 Manuel de la Peña [MSFT] 2017-09-06 10:00:14 UTC
Please include your full build logs, crash reports (if any), test case (to reproduce) and all version information.

To get full build logs just set the log verbosity to diagnostic at the following locations:
- On Visual Studio for Mac: Preferences > Projects > Build
- On Visual Studio for Windows: Tools > Options > Projects and Solutions > Build and Run

On Visual Studio Windows you also want to add `-v -v -v -v` to the mtouch additional arguments by right-clicking the project in the solution explorer and selecting `Properties`.
Note: this is done automatically on Visual Studio for Mac when the log verbosity is set to diagnostic.

Easiest way to get exact version information:
- On Visual Studio for Mac: "Visual Studio" menu, "About Visual Studio" item, "Show Details" button.
- On Visual Studio for Windows: "Help menu", "About Microsoft Visual Studio" item.
Then copy/paste the version information (you can use the "Copy Information" button).

Once we have the information we will try to reproduce the issue an investigate further.
Comment 2 Rolf Bjarne Kvinge [MSFT] 2017-09-06 12:12:07 UTC
This is because the native method is bound (using a P/Invoke) as if the callback was a C method, and not an Objective-C block: https://github.com/xamarin/xamarin-macios/blob/8178ecc5eaa6f7a43f7bf53d5aec44461ffe5cb8/src/UIKit/UIAccessibility.cs#L200
Comment 3 Rolf Bjarne Kvinge [MSFT] 2017-09-06 12:13:21 UTC
Looks like we wrote a test when it was implemented, but it's commented out: https://github.com/xamarin/xamarin-macios/blob/8178ecc5eaa6f7a43f7bf53d5aec44461ffe5cb8/tests/monotouch-test/UIKit/AccessibilityTest.cs#L37
Comment 4 Rolf Bjarne Kvinge [MSFT] 2017-09-06 12:21:46 UTC
Let's try to get this fixed in 15.5.
Comment 5 Sebastien Pouliot 2017-10-24 13:56:27 UTC
PR https://github.com/xamarin/xamarin-macios/pull/2917
Comment 6 Sebastien Pouliot 2017-10-24 20:54:47 UTC
PR merged in master with https://github.com/xamarin/xamarin-macios/commit/584da1da18793cb6c5fc49ecc39dadcbedb591c5