Bug 27651 - Tabbed Page in Navigation Page causes exception in iPad but nothing else
Summary: Tabbed Page in Navigation Page causes exception in iPad but nothing else
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.3.5
Hardware: Other Other
: Normal normal
Target Milestone: ---
Assignee: Jason Smith [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2015-03-04 11:43 UTC by Andrew Page
Modified: 2016-12-13 22:52 UTC (History)
9 users (show)

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


Attachments
Sample Project Demonstrating issue. Cleaned, packages removed (163.61 KB, application/x-bzip2)
2015-03-04 11:43 UTC, Andrew Page
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 FIXED

Description Andrew Page 2015-03-04 11:43:49 UTC
Created attachment 10152 [details]
Sample Project Demonstrating issue.   Cleaned, packages removed

To duplicate the issue, 

open attached solution
select ipadTabbs.ios as startup project
Select an iPad simulator or hardware as a debug target
Debug the program
The following below exception should be produced
Change the target to an iPhone, launch again, app operates normally.  
Change startup project Droid version, debug against simulator or hardware, app operates normally



System.InvalidOperationException: Sequence contains no elements
  at System.Linq.Enumerable.Last[UIViewController] (IEnumerable`1 source) [0x0001e] in ///Library/Frameworks/Xamarin.iOS.framework/Versions/8.6.2.26/src/mono/mcs/class/System.Core/System.Linq/Enumerable.cs:1216
  at Xamarin.Forms.Platform.iOS.NavigationRenderer.<.ctor>b__0 (Xamarin.Forms.Platform.iOS.TabletMasterDetailRenderer sender) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.MessagingCenter+<>c__DisplayClass4`1[Xamarin.Forms.Platform.iOS.TabletMasterDetailRenderer].<Subscribe>b__3 (System.Object sender, System.Object args) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.MessagingCenter.InnerSend (System.String message, System.Type senderType, System.Type argType, System.Object sender, System.Object args) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.MessagingCenter.Send[TabletMasterDetailRenderer] (Xamarin.Forms.Platform.iOS.TabletMasterDetailRenderer sender, System.String message) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Platform.iOS.TabletMasterDetailRenderer.HandlePropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs e) [0x00000] in <filename unknown>:0
  at at (wrapper delegate-invoke) <Module>:invoke_void_object_PropertyChangedEventArgs (object,System.ComponentModel.PropertyChangedEventArgs)
  at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindablePropertyContext context, System.Object value, Boolean currentlyApplying, SetValueFlags attributes, Boolean silent) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value, Boolean fromStyle, Boolean checkAccess) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.BindableObject.SetValue (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Platform.iOS.Platform.SetRenderer (Xamarin.Forms.BindableObject bindable, IVisualElementRenderer value) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Platform.iOS.TabbedRenderer.SetupPage (Xamarin.Forms.Page page, Int32 index) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Platform.iOS.TabbedRenderer.Reset () [0x00000] in <filename unknown>:0
  at Xamarin.Forms.NotifyCollectionChangedEventArgsExtensions.Apply (System.Collections.Specialized.NotifyCollectionChangedEventArgs self, System.Action`3 insert, System.Action`2 removeAt, System.Action reset) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Platform.iOS.TabbedRenderer.OnPagesChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Platform.iOS.TabbedRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Platform.iOS.RendererFactory.GetRenderer (Xamarin.Forms.VisualElement view) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Platform.iOS.NavigationRenderer.CreateViewControllerForPage (Xamarin.Forms.Page page) [0x00000] in <filename unknown>:0
  at Xamarin.Forms.Platform.iOS.NavigationRenderer+<OnPushAsync>d__19.MoveNext () [0x00000] in <filename unknown>:0
  at --- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:62
  at System.Runtime.CompilerServices.TaskAwaiter`1[System.Boolean].GetResult () [0x00034] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Runtime.CompilerServices/TaskAwaiter_T.cs:59
  at Xamarin.Forms.Platform.iOS.NavigationRenderer+<<ViewDidLoad>b__3>d__4.MoveNext () [0x00000] in <filename unknown>:0
Comment 1 Danish Akhtar 2015-03-05 00:12:43 UTC
I am also getting this issue after following the steps mentioned in Bug description, application gets throws exception as soon as launch on iPad simulator. Hence marking this as Confirmed.

Supplement info:
Exception details: https://gist.github.com/saurabh360/d1b83b89c442dda4df57
Application output: https://gist.github.com/saurabh360/a584478384300373008b
ide logs: https://gist.github.com/saurabh360/97c9acb12e42952ae99e

Environment info:=== Xamarin Studio ===

Version 5.7.2 (build 8)
Installation UUID: 3dbf10c4-ed30-4e55-8a8b-1704777c7b5f
Runtime:
	Mono 3.12.0 ((detached/6235202)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000080

=== Apple Developer Tools ===

Xcode 5.1.1 (5085)
Build 5B1008

=== Xamarin.iOS ===

Version: 8.6.2.22 (Business Edition)
Hash: 862702c
Branch: 
Build date: 2015-02-18 15:19:23-0500

=== Xamarin.Android ===

Version: 5.1.0.7 (Business Edition)
Android SDK: /Users/apprpject/Desktop/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin.Mac ===

Version: 1.12.0.11 (Business Edition)

=== Build Information ===

Release ID: 507020008
Git revision: 64a4266f0a82f7558472383d8ae66a526b3b881d
Build date: 2015-02-25 11:22:12-05
Xamarin addins: 1cb443ca2dddd9933d748e035560f06cf9c246bd

=== Operating System ===

Mac OS X 10.8.5
Darwin localhost 12.5.0 Darwin Kernel Version 12.5.0
    Sun Sep 29 13:33:47 PDT 2013
    root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64
Comment 2 Kent 2015-06-14 04:59:04 UTC
Reported early March and no progress on this? Seems massively debilitating to me. I got the same thing just putting together the simplest of samples to play around with MasterDetailPage inside a NavigationPage. XF 1.4.2.6359.
Comment 3 vhnatyk 2015-07-09 11:11:14 UTC
Anything with this??? :( it destroys my navigation strategy for tablets due to nasty crash (on iPad only - latest tools as of date of the post: Xamarin.Forms 1.4.3.6374 and the rest )
Comment 4 vhnatyk 2015-07-14 09:11:28 UTC
Again this bug on iPad when !!! trying to create custom webview renderer

[assembly: ExportRenderer(typeof(WebViewBase), typeof(WebViewBaseRenderer))]
namespace Derm101.Mobile.iOS
{
    public class WebViewBaseRenderer : WebViewRenderer
    {
        protected override void OnElementChanged(VisualElementChangedEventArgs e)
        {
            base.OnElementChanged(e);
            if (e.OldElement == null && e.NewElement is WebViewBase)
            {
                var webViewBase = e.NewElement as WebViewBase;

                if (webViewBase != null && webViewBase.ExpandToContentHeight)
                {
                    var webView = this;

                    Frame = new CoreGraphics.CGRect(0, 0, (UIScreen.MainScreen.Bounds.Width - 10), 1);

                    webView.ScrollView.ScrollEnabled = false;

                    webView.LoadFinished += (sender, f) =>
                    {
                        webView.SizeToFit();
                        var height = webView.ScrollView.ContentSize.Height;
                        Frame = new CoreGraphics.CGRect(0, 0, UIScreen.MainScreen.Bounds.Width - 10, height);
                    };
                }
            }
        }
    }
}


It somehow throws only when webView.LoadFinished is touched - even if only 

                    webView.LoadFinished += (sender, f) => {  };
Comment 5 Jimmy [MSFT] 2016-12-13 22:52:00 UTC
Cannot reproduce this crash anymore with Forms 2.3.3.175