Bug 57924 - app crashes because of AVSpeechSynthesizerDelegate
Summary: app crashes because of AVSpeechSynthesizerDelegate
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 10.10 (d15-2)
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-07-04 11:11 UTC by Ivan Icin
Modified: 2017-07-26 13:45 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
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 NOT_REPRODUCIBLE

Description Ivan Icin 2017-07-04 11:11:22 UTC
The app does not implement AVSpeechSynthesizerDelegate, so this is likely a Xamarin bug (Xamarin had to implement the delegate to expose some events in API).

This is the crash log:

Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[AVFoundation_AVSpeechSynthesizer__AVSpeechSynthesizerDelegate setWasSpeakingBeforeAudioInterruption:]: unrecognized selector sent to instance 0x1c5a334c0 Native stack trace: 0 CoreFoundation 0x000000018243d870 <redacted> + 148 1 libobjc.A.dylib 0x0000000180c14528 objc_exception_throw + 56 2 CoreFoundation 0x000000018244aa6c <redacted> + 0 3 CoreFoundation 0x0000000182442f68 <redacted> + 1380 4 CoreFoundation 0x0000000182324e5c _CF_forwarding_prep_0 + 92 5 AXSpeechImplementation 0x00000001988f5354 <redacted> + 328 6 libAXSpeechManager.dylib 0x000000018f94c948 <redacted> + 100 7 libdispatch.dylib 0x0000000181086458 <redacted> + 24 8 libdispatch.dylib 0x0000000181086418 <redacted> + 16 9 libdispatch.dylib 0x00000001810937c4 <redacted> + 1024 10 CoreFoundation 0x00000001823e41b0 <redacted> + 12 11 CoreFoundation 0x00000001823e1cc8 <redacted> + 1796 12 CoreFoundation 0x0000000182300280 CFRunLoopRunSpecific + 436 13 GraphicsServices 0x0000000183e11f94 GSEventRunModal + 100 14 UIKit 0x0000000188caf0f0 UIApplicationMain + 208 15 SharetoSpeechiOS 0x0000000103150e84 _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 9981820 16 SharetoSpeechiOS 0x00000001031a47e4 _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 10324188 17 SharetoSpeechiOS 0x00000001028f9124 _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 1233436 18 SharetoSpeechiOS 0x0000000102a40144 _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 2572860 19 Mono 0x0000000103de04fc mono_jit_runtime_invoke + 836 20 Mono 0x0000000103e5afe4 do_runtime_invoke + 112 21 Mono 0x0000000103e5e208 do_exec_main_checked + 152 22 Mono 0x0000000103dc4134 mono_jit_exec + 268 23 SharetoSpeechiOS 0x0000000103b4fb88 xamarin_GetFolderPath + 3300 24 SharetoSpeechiOS 0x0000000103b2421c _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 20284180 25 libdyld.dylib 0x00000001810f1e40 <redacted> + 4

Runtime.ThrowNSException (System.IntPtr ns_exception)
Runtime.throw_ns_exception (System.IntPtr exc)
(wrapper native-to-managed) ObjCRuntime.Runtime:throw_ns_exception (intptr)
(wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName)
Application.Main (System.String[] args)
Comment 1 Timothy Risi 2017-07-05 18:39:51 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).
Comment 2 Ivan Icin 2017-07-06 12:30:07 UTC
The crash log is above. I can't reproduce it, I've seen that as a report in the Mobile Center.

This is Visual Studio info:
Microsoft Visual Studio Community 2017 
Version 15.2 (26430.14) Release
VisualStudio.15.Release/15.2.0+26430.14
Microsoft .NET Framework
Version 4.7.02046

Installed Version: Community

Visual Basic 2017   00369-60000-00001-AA505
Microsoft Visual Basic 2017

Visual C# 2017   00369-60000-00001-AA505
Microsoft Visual C# 2017

Visual C++ 2017   00369-60000-00001-AA505
Microsoft Visual C++ 2017

Visual F# 4.1   00369-60000-00001-AA505
Microsoft Visual F# 4.1

Application Insights Tools for Visual Studio Package   8.6.00404.2
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017   15.0.30503.0
ASP.NET and Web Tools 2017

Common Azure Tools   1.9
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

JavaScript UWP Project System   2.0
JavaScript UWP Project System

Merq   1.1.17-rc (cba4571)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio   Mono.Debugging.VisualStudio
Support for debugging Mono processes with Visual Studio.

Multilingual App Toolkit   4.0
Multilingual App Toolkit helps you localize your Windows Store app by providing file management, pseudo and machine translation, translation editor, and build integration. http://aka.ms/matinstall

NuGet Package Manager   4.2.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

TypeScript   2.2.2.0
TypeScript tools for Visual Studio

Visual Studio Tools for Universal Windows Apps   15.0.26430.06
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

Xamarin   4.5.0.486 (fec6f88)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android SDK   7.3.1.2 (9dbc4c5)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK   10.10.0.37 (ad35de4)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Comment 3 Ivan Icin 2017-07-06 12:31:48 UTC
This is the build log made according to your instructions:
https://pastebin.com/3S1ADiRX
Comment 4 Timothy Risi 2017-07-06 18:46:19 UTC
It's going to be hard to track down without a repro case.  Can you provide what kind of device you are trying to run it on and what version of iOS?
Comment 5 Ivan Icin 2017-07-06 23:07:10 UTC
According to the bug report this has happened on iPhone 7 and iOS 11.

I do understand that it is much easier to fix the problem if you have the reproducible issue, but what you said above basically questions that Microsoft's product Mobile Center has any value, so I think at the very best it wasn't a wise thing to say even if you think that.
Comment 6 Ivan Icin 2017-07-06 23:07:41 UTC
Not bug report but crash report.
Comment 7 Rolf Bjarne Kvinge [MSFT] 2017-07-07 11:00:36 UTC
Better formatted crash report:

Objective-C exception thrown. Name: NSInvalidArgumentException Reason: 
-[AVFoundation_AVSpeechSynthesizer__AVSpeechSynthesizerDelegate setWasSpeakingBeforeAudioInterruption:]: unrecognized selector sent to instance 0x1c5a334c0 
Native stack trace: 
0 CoreFoundation 0x000000018243d870 <redacted> + 148 
1 libobjc.A.dylib 0x0000000180c14528 objc_exception_throw + 56 
2 CoreFoundation 0x000000018244aa6c <redacted> + 0 
3 CoreFoundation 0x0000000182442f68 <redacted> + 1380 
4 CoreFoundation 0x0000000182324e5c _CF_forwarding_prep_0 + 92 
5 AXSpeechImplementation 0x00000001988f5354 <redacted> + 328 
6 libAXSpeechManager.dylib 0x000000018f94c948 <redacted> + 100 
7 libdispatch.dylib 0x0000000181086458 <redacted> + 24 
8 libdispatch.dylib 0x0000000181086418 <redacted> + 16 
9 libdispatch.dylib 0x00000001810937c4 <redacted> + 1024 
10 CoreFoundation 0x00000001823e41b0 <redacted> + 12 
11 CoreFoundation 0x00000001823e1cc8 <redacted> + 1796 
12 CoreFoundation 0x0000000182300280 CFRunLoopRunSpecific + 436 
13 GraphicsServices 0x0000000183e11f94 GSEventRunModal + 100 
14 UIKit 0x0000000188caf0f0 UIApplicationMain + 208 
15 SharetoSpeechiOS 0x0000000103150e84 _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 9981820 
16 SharetoSpeechiOS 0x00000001031a47e4 _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 10324188 
17 SharetoSpeechiOS 0x00000001028f9124 _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 1233436 
18 SharetoSpeechiOS 0x0000000102a40144 _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 2572860 
19 Mono 0x0000000103de04fc mono_jit_runtime_invoke + 836 
20 Mono 0x0000000103e5afe4 do_runtime_invoke + 112 
21 Mono 0x0000000103e5e208 do_exec_main_checked + 152 
22 Mono 0x0000000103dc4134 mono_jit_exec + 268 
23 SharetoSpeechiOS 0x0000000103b4fb88 xamarin_GetFolderPath + 3300 
24 SharetoSpeechiOS 0x0000000103b2421c _ZN7plcrash2MS5async24dwarf_cfa_state_iteratorIyxE4nextEPjPNS1_28plcrash_dwarf_cfa_reg_rule_tEPy + 20284180 
25 libdyld.dylib 0x00000001810f1e40 <redacted> + 4

which unfortunately doesn't help much.

It seems that iOS somehow called an internal AVSpeechSynthesizer selector on an AVSpeechSynthesizerDelegate subclass.

This should not happen, but finding out why might be complicated, in particular because it's unlikely the crash report is showing anything directly related to the underlying cause. It might be a bug in your code, it might be a bug in Xamarin.iOS, or it might even be an iOS bug (I see it happened on iOS 11, which is in beta, so it wouldn't surprise me if this is an iOS bug).

This basically means that we needs as much information as possible to at least narrow it down.

* Was this crash reported multiple times, or only once?
* If multiple times, is there anything in common with the iOS devices / versions it occurred on? Could you get statistics here? For instance: if happens on iOS 10 or earlier, it won't be a bug in iOS 11.
Comment 8 Ivan Icin 2017-07-07 11:18:22 UTC
Unfortunately, for now the crash was reported only once. If new data appears I'll post it here.

I would rule out that the problem is in my app as I said that it doesn't implement AVSpeechSynthesizerDelegate and the problem clearly happens there. Xamarin does implement that and I believe that it shouldn't be too big code to audit and check whether it can cause the problem like this. Not to say that it does just I think it would be some standard quality procedure to do a reasonable effort to try to find the cause of the crash.
Comment 9 Rolf Bjarne Kvinge [MSFT] 2017-07-07 11:27:53 UTC
I've already looked at our AVSpeechSynthesizerDelegate implementation, and there's nothing there that gives any idea why this crash is occurring.
Comment 10 Adam Hartley [MSFT] 2017-07-26 13:45:12 UTC
Thanks so much for taking the time to submit this report! Unfortunately we do not have enough information to proceed at this time - for cases such as these we need as much information as possible to investigate the extent of the issue. If this issue is still occurring for you, please feel free to reopen this report and attach a project that reproduces the issue with any relevant steps that might help trigger the issue.