Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] [iOS] Apps are crashed on iOS 15, NSInvalidArgumentException Reason: removeChildViewController #14750

Open
avorobjovs opened this issue Oct 18, 2021 · 15 comments
Labels
iOS 15 s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/unverified New report that has yet to be verified t/bug 🐛

Comments

@avorobjovs
Copy link

avorobjovs commented Oct 18, 2021

Description

Our app is forcibly closed by iOS 15 from time to time. I never see such an issue on iOS before version 15.
We updated Xamarin.Forms in our app to version 5.0.0.2125.
We use Xamarin.iOS version 15.0.0.6 and Xcode 13.0 for builds.
Some of our users updated iOS to version 15.0.2 (and some of them to version 15.1 beta) on their devices.
But the issue is still here.

We have no crash log reports from our app.
But we have some logs from iPhone devices. And I provide several logs here.

Basic Information

  • Version with issue: 5.0.0.2125
  • Last known good version: 4.4.0.991864
  • Platform Target Frameworks:
    • iOS: 15.0, 15.0.1, 15.0.2, 15.1 beta
  • Affected Devices: many different devices

Environment

Show/Hide Visual Studio info
Microsoft Visual Studio Enterprise 2019
Version 16.11.5
VisualStudio.16.Release/16.11.5+31729.503
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Enterprise

Architecture Diagrams and Analysis Tools   00435-60000-00000-AA972
Microsoft Architecture Diagrams and Analysis Tools

Visual C++ 2019   00435-60000-00000-AA972
Microsoft Visual C++ 2019

ADL Tools Service Provider   1.0
This package contains services used by Data Lake tools

ASA Service Provider   1.0

ASP.NET and Web Tools 2019   16.11.75.64347
ASP.NET and Web Tools 2019

ASP.NET Web Frameworks and Tools 2012   16.11.75.64347
For additional information, visit https://www.asp.net/

ASP.NET Web Frameworks and Tools 2019   16.11.75.64347
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   16.11.75.64347
Azure App Service Tools v3.0.0

Azure Data Lake Node   1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio   2.6.1000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools   16.11.75.64347
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio   2.6.1000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools   3.11.0-4.21403.6+ae1fff344d46976624e68ae17164e0607ab68b10
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

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

Extensibility Message Bus   1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Fabric.DiagnosticEvents   1.0
Fabric Diagnostic Events

GitHub.VisualStudio   2.11.106.19330
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

IntelliCode Extension   1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure HDInsight Azure Node   2.6.1000.0
HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service   2.6.1000.0
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio   16.10
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service   2.6.1000.0
Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node   1.0
Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools for Visual Studio   2.9
Support for Azure Cloud Services projects

Microsoft Continuous Delivery Tools for Visual Studio   0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager   2.1.113+g422d40002e.RR
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards   1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers   1.2
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio   16.10.15 (552afdf)
Support for debugging Mono processes with Visual Studio.

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

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Razor (ASP.NET Core)   16.1.0.2122504+13c05c96ea6bdbe550bd88b0bf6cdddf8cde1725
Provides languages services for ASP.NET Core Razor.

Snapshot Debugging Extension   1.0
Snapshot Debugging Visual Studio Extension Detailed Info

SQL Server Data Tools   16.0.62107.28140
Microsoft SQL Server Data Tools

SQL Server Reporting Services   15.0.19528.0
Microsoft SQL Server Reporting Services Designers 
Version 15.0.19528.0

tangible T4 Editor   2.5.0
tangible engineering GmbH

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript Tools   16.0.30526.2002
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   3.11.0-4.21403.6+ae1fff344d46976624e68ae17164e0607ab68b10
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools   16.11.0-beta.21322.6+488cc578cafcd261d90d748d8aaa7b8b091232dc
Microsoft Visual F# Tools

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions   1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio Tools for Containers   1.0
Visual Studio Tools for Containers

Visual Studio Tools for Kubernetes   1.0
Visual Studio Tools for Kubernetes

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Foo   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

Xamarin   16.11.000.190 (d16-11@2391ed9)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   16.11.0.17 (remotes/origin/11e0001f0b17269345e80b58fb3adf1ba4efe2cd@11e0001f0)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   16.10.5 (355b57a)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   11.4.0.5 (d16-11/7776c9f)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: c633fe9
    Java.Interop: xamarin/java.interop/d16-11@48766c0
    ProGuard: Guardsquare/proguard/v7.0.1@912d149
    SQLite: xamarin/sqlite/3.35.4@85460d3
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-11@683f375


Xamarin.iOS and Xamarin.Mac SDK   15.0.0.8 (0796d78dc)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Build Logs

This ZIP file contains several examples of iOS .ips log files.
iOS_15_issues.zip

@avorobjovs avorobjovs added s/unverified New report that has yet to be verified t/bug 🐛 labels Oct 18, 2021
@avorobjovs avorobjovs changed the title [Bug] [iOS] App are forcibly closed by iOS 15 [Bug] [iOS] Apps are forcibly closed by iOS 15 Oct 18, 2021
@jfversluis
Copy link
Member

Do you have any idea what code triggers this? At what moments in the app is this happening? The logs don't tell me anything unfortunately so without more info this is going to be near impossible to solve.

@jsuarezruiz jsuarezruiz added the s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. label Oct 19, 2021
@avorobjovs
Copy link
Author

avorobjovs commented Oct 19, 2021

Today I updated the app to Xamarin.Forms 5.0.0.2196.
I used Xamarin.iOS 15.0.0.6 and Xcode 13.0 to build the app.
And I have this issue again on my device iPhone 7 Plus, iOS 15.0.2.

But in this case, I have both iOS Crash Report and our app crash report with a Stack Trace.

KCMobilityTechnicianiOS-2021-10-19-182318.ips.zip
KCMobilityTechnicianiOS-2021-10-19-182318_StackTrace.txt.zip

Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: -[UISearchBarTextField removeChildViewController:]: unrecognized selector sent to instance 0x122812000
...

I cannot say what I did at the moment when the app was crashed. As I remember, I was just opening one page from another.

Additionally, I already have a lot of app crash reports with a stack trace from different our users. These crash reports were collected during the last two weeks from different iPhone devices with different iOS 15.x versions. The app from these crash reports was built with Xamarin.Forms 5.0.0.2083, 5.0.0.2125, and 5.0.0.2196.
But all of them have a similar stack trace:

Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSInvalidArgumentException Reason: -[XXXXX removeChildViewController:]: unrecognized selector sent to instance

Where the XXXXX is different in different cases. But the removeChildViewController is the common part.
It looks like the app was crashed at different points.

There is a ZIP file with different examples of stack traces:
KCMobilityTechnicianiOS_StackTraces.zip

We have been already developing our app for 5 years. But I haven't seen such crashes before iOS 15.

@FDDenny
Copy link

FDDenny commented Oct 22, 2021

We are also seeing this issue in two of our applications after a device has been upgraded to use iOS 15. We can see this on both iPhone and iPad. We see this issue occurring sporadically in our application as well with the only thing tying all the crashes (and sometimes freezes/hangs) together to be movement between pages on our navigation stack. We get the same mono errors referencing the removeChildViewController

SIGABRT: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[UISearchBarTextField removeChildViewController:]: unrecognized selector sent to instance

SIGABRT: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[UITableView removeChildViewController:]: unrecognized selector sent to instance

From what we have found in our application it has something to do when we are using custom page renderers for platform specific implementations. One of our applications uses both non custom and custom pages and the issue only occurs after a user has traveled to a page that we have the custom implementation for.

This is severely hurting our customers ability to use our application and we have been researching a solution since iOS15 has come out. Is there any movement on a solution of this issue?

@avorobjovs avorobjovs changed the title [Bug] [iOS] Apps are forcibly closed by iOS 15 [Bug] [iOS] Apps are crashed on iOS 15, NSInvalidArgumentException Reason: removeChildViewController Oct 22, 2021
@nosmalldreams
Copy link

Any plan for resolving this? We are seeing it as well, on various devices running iOS 15.1 and iOS 15.0.2. Not sure if it's related, but we are also seeing some non-crash error logs for removeChildViewController.

I can upload the crash log if you provide an upload URL - this is the start of it:
SIGABRT: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: *** -[NSProxy doesNotRecognizeSelector:removeChildViewController:] called! Native stack trace:

This is the start of the error logged when there isn't a crash:
Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInvalidArgumentException Reason: -[WKNavigation removeChildViewController:]: unrecognized selector sent to instance

This is the Main thread info from the logs. It seems to be the same whether the app crashes or not.

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) Foundation.NSObject.xamarin_release_managed_ref(intptr,bool)
NSObject.ReleaseManagedRef ()
NSObject+NSObject_Disposer.Drain (Foundation.NSObject ctx)
(wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate)
UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName)
Application.Main (System.String[] args)
(wrapper managed-to-native) Foundation.NSObject.xamarin_release_managed_ref(intptr,bool)
NSObject.ReleaseManagedRef ()
NSObject+NSObject_Disposer.Drain (Foundation.NSObject ctx)
(wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate)
UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName)
Application.Main (System.String[] args)

@jfversluis
Copy link
Member

I would love to get rid of this, but I have yet to see some kind of reproduction that will help us pinpoint the exact cause of this :)

@FDDenny
Copy link

FDDenny commented Nov 17, 2021

@jfversluis #14783 (comment) I asked in another ticket if i should link to other ticket but was told it was not needed. That is my comment in another ticket around the exact same issue. It has a reproduction sample for you to look at.

@jfversluis
Copy link
Member

jfversluis commented Nov 30, 2021

@FDDenny I'm not 100% convinced this is the exact same thing. The other issue describes a hang, this describes a direct crash. Also something we can rule out by another repro :)

@TrsThomas
Copy link

Hi, just wondering if there's any news on this issue? We have also been getting lots of crash reports from users who updated their device to iOS15.

@avorobjovs
Copy link
Author

Hi,
I found that if build the app using the latest versions of Xamarin.iOS and Xcode, then the application no longer freezes or crashes.
Currently, we use Xamarin.iOS 15.4 and Xcode 13.2.1. And we have no freezes or crashes.

@TrsThomas
Copy link

Thanks for your reply, will try it out!

@jfversluis
Copy link
Member

Please let us know @TrsThomas !

@TrsThomas
Copy link

Hello,

We built the latest version of our app with Visual Studio 2022 (Xamarin.iOS 15.6.0.3 and Xcode 13.2.1). Unfortunately, the problem has not been solved.
However, during our tests we had lots of freezes and very few crashes. The bug in this issue might be different from ours, so we had another look at ticket #14783 which FDDenny mentioned in his reply on 17 Nov 2021. The (temporary) solution/bugfix from that issue fixed our freezes.

@avorobjovs
Copy link
Author

As I commented in bug #14782, even if our app is built with Xamarin.iOS 15.4 and Xcode 13.2.1, we anyway have hangs and crashes on iOS 15.

@SoggyToastMan
Copy link

@jfversluis Is this fixed in latest Xamarin.Forms or is it being worked on? The workarounds seem to bandaid the hanging / crashing for about 10 minutes of app usage with TabbedPages, but eventually it still crashes on iOS 15 builds.

@Odmar
Copy link

Odmar commented Nov 8, 2022

Hello,

are there an updates regarding this issue?
We had a case of that error in our appcenter:

Code Type: arm64
Parent Process: [1]

Date/Time: 2022-11-04T16:59:48.999Z
Launch Time: 2022-11-04T11:42:15Z
OS Version: iPhone OS 15.6.1 (19G82)
Report Version: 104

Exception Type: SIGABRT
Exception Codes: #0 at 0x205e5cb38
Crashed Thread: 0

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UITableView removeChildViewController:]: unrecognized selector sent to instance 0x122388a00'

Last Exception Backtrace:
0 CoreFoundation 0x00000001ce3b9288 _exceptionPreprocess + 220
1 libobjc.A.dylib 0x00000001e70e9744 objc_exception_throw + 56
2 CoreFoundation 0x00000001ce496fc0 -[NSObject(NSObject) doesNotRecognizeSelector:] + 140
3 UIKitCore 0x00000001d17131f0 -[UIResponder doesNotRecognizeSelector:] + 292
4 CoreFoundation 0x00000001ce34de98 forwarding + 1760
5 CoreFoundation 0x00000001ce34cf70 forwarding_prep_0
+ 92
6 UIKitCore 0x00000001d0966f0c -[UIViewController dealloc] + 856
7 xxx 0x000000010934a808 xamarin_invoke_objc_method_implementation (trampolines.m:644)
8 xxx 0x000000010934a9a8 xamarin_release_trampoline (trampolines.m:742)
9 xxx 0x0000000105cf0448 -[Xamarin_Forms_Platform_iOS_NavigationRenderer_ParentingViewController release] (registrar.m:20483)
10 xxx 0x0000000109347a14 xamarin_release_managed_ref (runtime.m:1972)
11 xxx 0x0000000107029210 wrapper_managed_to_native_Foundation_NSObject_xamarin_release_managed_ref_intptr_bool + 140
12 xxx 0x0000000106f5f190 Foundation_NSObject_ReleaseManagedRef (NSObject2.cs:389)
13 xxx 0x0000000106f62814 Foundation_NSObject_NSObject_Disposer_Drain_Foundation_NSObject (NSObject2.cs:1007)
14 xxx 0x00000001060de800 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 268
15 xxx 0x0000000109192604 mono_jit_runtime_invoke (mini-runtime.c:3190)
16 xxx 0x000000010924c250 mono_runtime_invoke_checked (object.c:3052)
17 xxx 0x000000010924fa90 mono_runtime_invoke (object.c:3107)
18 xxx 0x0000000105ccc908 native_to_managed_trampoline_38(objc_object*, objc_selector*, _MonoMethod**, objc_object*, unsigned int) (registrar.m:2342)
19xxx 0x0000000105ccc774 +[__NSObject_Disposer drain:] (registrar.m:11296)
20 Foundation 0x00000001cfb55f00 __NSThreadPerformPerform + 208
21 CoreFoundation 0x00000001ce3db414 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 24
22 CoreFoundation 0x00000001ce3ec1a0 __CFRunLoopDoSource0 + 204
23 CoreFoundation 0x00000001ce3256f8 __CFRunLoopDoSources0 + 364
24 CoreFoundation 0x00000001ce32b05c CFRunLoopRun + 824
25 CoreFoundation 0x00000001ce33ebc8 CFRunLoopRunSpecific + 596
26 GraphicsServices 0x00000001ea4aa374 GSEventRunModal + 160
27 UIKitCore 0x00000001d0cb2b58 -[UIApplication run] + 1096
28 UIKitCore 0x00000001d0a34090 UIApplicationMain + 360
29 xxx 0x0000000109319634 xamarin_UIApplicationMain (bindings.m:126)
30 xxx 0x000000010703318c wrapper_managed_to_native_UIKit_UIApplication_xamarin_UIApplicationMain_int_string___intptr_intptr_intptr
+ 376
31 xxx 0x0000000106f85b24 UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr (UIApplication.cs:57)
32 xxx 0x0000000106f85c20 UIKit_UIApplication_Main_string___string_string (UIApplication.cs:82)
33 xxx 0x0000000105d021c4 ETA_iOS_Application_Main_string
(Main.cs:32)
34 xxx 0x00000001060de800 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 268
35 xxx 0x0000000109192604 mono_jit_runtime_invoke (mini-runtime.c:3190)
36 xx 0x000000010924c250 mono_runtime_invoke_checked (object.c:3052)
37 xx 0x0000000109252558 mono_runtime_exec_main_checked (object.c:0)
38 xxx 0x000000010917096c mono_jit_exec (driver.c:1383)
39 xxx 0x0000000109357d54 xamarin_main (monotouch-main.m:490)
40 xxx 0x0000000105d01134 main (main.m:210)
41 ??? 0x000000010aff1da4 0x000000010aff1da4

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
iOS 15 s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. s/unverified New report that has yet to be verified t/bug 🐛
Projects
None yet
Development

No branches or pull requests

8 participants