Bug 29453 - [Android] Navigation.PopAsync(false) in Entry.Completed handler => System.ArgumentException
Summary: [Android] Navigation.PopAsync(false) in Entry.Completed handler => System.Arg...
Status: VERIFIED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.4.2
Hardware: PC Windows
: Highest normal
Target Milestone: ---
Assignee: Rui Marinho
URL:
Depends on:
Blocks:
 
Reported: 2015-04-28 04:10 UTC by David Catteuw
Modified: 2015-06-16 08:35 UTC (History)
8 users (show)

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


Attachments
Debug log from VS - Running on Nexus 4 (Kitkat) VM (118.93 KB, text/plain)
2015-04-28 04:10 UTC, David Catteuw
Details


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:
VERIFIED FIXED

Description David Catteuw 2015-04-28 04:10:30 UTC
Created attachment 10930 [details]
Debug log from VS - Running on Nexus 4 (Kitkat) VM

Overview:
When trying to pop a page from the navigation stack without animation in the Completed event handler of an Entry, the application crashes with a System.ArgumentException: inputView should be of type EditText, SearchView, or TextView

Steps to Reproduce:
- Create new XF PCL project
- Drop following code in the App() method:

_______________________________________________________________________________________________________

var page1Layout = new StackLayout
{
	Children =
	{
		new Label
		{
			XAlign = TextAlignment.Center,
			Text = "Page 1"
		}
	}
};

var page2Layout = new StackLayout
{
	Children =
	{
		new Label
		{
			XAlign = TextAlignment.Center,
			Text = "Page 2"
		}
	}
};

var page1 = new ContentPage
{
	Content = page1Layout
};

var page2 = new ContentPage
{
	Content = page2Layout
};

var button = new Button {Text = "Go to page 2", Command = new Command(async () => await page1.Navigation.PushAsync(page2))};

var entry = new Entry();
entry.Completed += async (sender, args) =>
{
	await page1.Navigation.PopAsync(false);
};

page1Layout.Children.Add(button);
page2Layout.Children.Add(entry);

MainPage = new NavigationPage(page1);

_______________________________________________________________________________________________________

- Run the application on an Android device
- Click the button on page 1 to go to page 2
- Click the entry to focus it and show the software keyboard
- Click the submit button on the keyboard
- The application crashes

Expected Results:
- Application should navigate back and hide the keyboard

Environment:
Xamarin Forms version: 1.4.2.6355 Stable
Confirmed on: Android (Kitkat (via XAP), Jellybean and Lollipop (both hardware devices)), did not test any other OS.

Extra information:
When not supplying the 'false' parameter to the PopAsync method call, this works fine.
Comment 1 Ram Chandra 2015-04-28 08:47:07 UTC
I have checked this issue with the steps mentioned in bug description and I am able to reproduce the reported behavior. I observed that when we pass 'false' value to the PopAsync method, I am getting following exception on android device.

>   UNHANDLED EXCEPTION:
04-28 08:37:40.070 I/MonoDroid( 8565): System.ArgumentException: inputView should be of type EditText, SearchView, or TextView
04-28 08:37:40.070 I/MonoDroid( 8565): at Xamarin.Forms.Platform.Android.KeyboardManager.HideKeyboard

Application output: https://gist.github.com/RamChBachkheti/fc2c44c1df1200d4acf0
IDE logs : https://gist.github.com/RamChBachkheti/bda2f73b14462d58f1e5
ADB logs: https://gist.github.com/RamChBachkheti/5af0f909a095071f9261

Note: I am not getting any error/exception on windows phone.

Environment Info:

Xamarin.Forms 1.4.3.6358-pre2

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Professional

LightSwitch for Visual Studio 2013   06177-004-0447006-02641
Microsoft LightSwitch for Visual Studio 2013

Team Explorer for Visual Studio 2013   06177-004-0447006-02641
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06177-004-0447006-02641
Microsoft Visual Basic 2013

Visual C# 2013   06177-004-0447006-02641
Microsoft Visual C# 2013

Visual C++ 2013   06177-004-0447006-02641
Microsoft Visual C++ 2013

Visual F# 2013   06177-004-0447006-02641
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06177-004-0447006-02641
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Windows Phone SDK 8.0 - ENU   06177-004-0447006-02641
Windows Phone SDK 8.0 - ENU

Application Insights Tools for Visual Studio Package   1.0
Application Insights Tools for Visual Studio

ASP.NET and Web Tools   12.3.50717.0
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Microsoft Azure Websites
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Microsoft Azure

ASP.NET Web Frameworks and Tools 2012.2   4.1.21001.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.20703.0
For additional information, visit http://www.asp.net/

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

Microsoft Advertising SDK for Windows Phone   
Microsoft Advertising SDK for Windows Phone
Build 

Microsoft Azure Mobile Services Tools   1.2
Microsoft Azure Mobile Services Tools

Multilingual App Toolkit   3.1.1250.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://go.microsoft.com/fwlink?linkid=245767

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

Office Developer Tools for Visual Studio 2013 ENU   12.0.30626
Microsoft Office Developer Tools for Visual Studio 2013 ENU

PowerShell Tools   1.2
Provides file classification services using PowerShell

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools   12.0.30919.1
Microsoft SQL Server Data Tools

Windows Phone 8.1 SDK Integration   1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   3.11.452.0 (d79ce10)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   5.1.0.115 (d23da369e436488f38c8ab8fe8a9ae7d9ea5256b)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.Forms Intellisense   1.0
Provides intellisense for Xamarin.Forms in the XML editor.

Xamarin.iOS   8.10.0.0 (7741cc495ab0baf04ff0405d0604bc27f0ecae2e)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified

Xamarin.TestCloud.Integration   1.0
Early preview of Xamarin Test Cloud integration
Comment 2 Hines Vaughan III 2015-05-06 17:05:50 UTC
I am getting the same error message except that it is happening when:
I have a scrollable view
-> the user clicks into an entry box (which makes the soft keyboard appear)
-> then the user scrolls down (keeping the soft keyboard open)
-> then the user hits the done button on the soft keyboard

Adding true to all of the Pushes and Pops does not seem to make a difference. This does not happen if I remove the following from MainActivity.cs:

WindowSoftInputMode = SoftInput.AdjustPan
Comment 3 Hines Vaughan III 2015-05-07 10:28:37 UTC
*Update to my comment above-  Taking out WindowSoftInputMode does not actually help. The app still crashes after scrolling down and hitting 'Done' on the Android soft keyboard.
Comment 4 Rui Marinho 2015-06-15 14:02:04 UTC
Should be fixed in 1.4.3 final
Comment 5 Parmendra Kumar 2015-06-16 08:35:41 UTC
I have checked this issue with Xamarin.Forms 1.4.3.6364-pre3 and its working
fine at my end.

Hence closing this issue.


Environment info:

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641

Xamarin   3.11.590.0 
Xamarin.Android   5.1.3.1 
Xamarin.iOS   8.10.1.0