Bug 60399 - Navigating to a Page with a ScrollView logs Error in Console
Summary: Navigating to a Page with a ScrollView logs Error in Console
Status: RESOLVED ANSWERED
Alias: None
Product: Forms
Classification: Xamarin
Component: Android ()
Version: 2.3.4
Hardware: PC Mac OS
: Normal blocker
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-10-26 20:17 UTC by clay.zuvich
Modified: 2018-02-12 18:25 UTC (History)
9 users (show)

Tags: scrollview, layout pass, ac
Is this bug a regression?: Yes
Last known good build:


Attachments
Test Project (133.49 KB, application/zip)
2017-10-26 20:17 UTC, clay.zuvich
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:
RESOLVED ANSWERED

Description clay.zuvich 2017-10-26 20:17:11 UTC
Created attachment 25474 [details]
Test Project

I am seeing the following log in my console on Android applications running Forms 2.3.4.

[View] requestLayout() improperly called by md5b60ffeb829f638581ab2bb9b1a7f4f3f.ScrollViewContainer{c78e7e4 V.E...... ......ID 0,0-1080,1547} during layout: running second layout pass
[View] requestLayout() improperly called by md5270abb39e60627f0f200893b490a1ade.NavigationPageRenderer{b4dada1 V.E...... ......ID 0,0-1080,1704 #1} during second layout pass: posting in next frame

I see this error only when navigating to a page with a ScrollView. I have attached a sample project that duplicates the issue.  I am not sure if this has an impact on anything, but I wasn't seeing this before 2.3.4.  I'm seeing it on both the emulator and device.  I'm running Android 7.0.  Please advise.

Steps to Reproduce.
Launch App
Click "Activate"
Comment 1 Paul DiPietro [MSFT] 2017-10-26 21:03:02 UTC
Will set this to confirmed (the reproduction does what's described) until further investigation can be made.
Comment 2 Jason Brown 2017-10-27 11:41:31 UTC
I'm getting the exact same error when navigating back to a page with a ScrollView. In my case it's not a benign error as it messes up the rendering of sub-controls on my ScrollView.

My version of Xamarin.Forms is 2.4.0.18342.

I'll try and find a workaround and if I do, I'll report back. I've tried rolling back to previous versions of Xamarin.Forms and I was still getting it back to version Xamarin.Forms.2.3.4.270 (but it might be another updated package that's causing the problem). I didn't roll back any further than that, so I can't say which release it started in.

Cheers

Jason
Comment 3 Andrea 2017-11-08 08:36:55 UTC
I have the same problem with Xamarin.Forms 2.4.0.38779 and Android 7.
It messes up the rendering of sub-controls inside Scrollview and the app is fully locked, you must restart it.
In my case the ScrollView is inside a RelativeLayout and it is used together with Rg.Plugins.Popup to create a popup menu with the ability to adapt automatically to a different number of possible actions, inside the ScrollView there is a StackLayout.
I'm trying to revert to a previous version.
Comment 4 Gustavo 2017-11-22 23:35:26 UTC
I has the same problem. Contrlos inside a scrollview are locked and nothing works (commands, scroll)


I've tried Xamarin.Forms version from 2.4.0.38779 to 2.5.0.77107 and the result is the same.

Before this, I was working well with Xamarin.Forms 2.3.4.247.
Comment 5 Fernando 2017-12-06 17:11:56 UTC
I'm having the same problem, some components missing, different behavior in different Android APIs, and so on. I think that the problem is related to the HorizontalOptions of controls inside a Page.Content when this Content is a ScrollView. As commented on #60453, I fixed my solution as described below:

"
...

Upon further analysis, I think that the problem has something involved with the HorizontalOptions of the ScrollView inside a MasterDetailPage. In my tests, I have a MasterDetailPage and my Detail page has a ScrollView setted as the Content of the page, with some StackLayouts inside, besides another components (Labels, Images, etc).

If we redefine the HorizontalOptions from the Page.Content (to any value) and the HorizontalOptions from the ScrollView (to anything diferent from Fill / FillAndExpand, like CenterAndExpand), the content will appear correctly in any API version that I have tested. 

But there is a implication with this workaround, I think that when we add some components inside the Content of the ScrollView or inside the Content of any of its children (like StackLayouts), the widths of them all may be recalculated and the bug comes back (hiding some controls), so its important that you define these HorizontalOptions AFTER you add any components that you need.

In my case, I have a ScrollView and in my constructor I set it as the Content of the Detail page. After that, terminating another method where I add some more controls inside the ScrollView, I have to redefine both the HorizontalOptions:

myScrollView.HorizontalOptions = LayoutOptions.CenterAndExpand;
this.Content.HorizontalOptions = LayoutOptions.FillAndExpand;

Doing this, all controls visibility works as expected in any API version.

Hope that it can help!"
Comment 6 Samantha Houts [MSFT] 2018-02-12 18:25:39 UTC
This issue has been migrated to https://github.com/xamarin/Xamarin.Forms/issues/1332. Please follow that issue for updates. Thanks!