Bug 26233 - Windows phone crashing when going back to page containing listview with Frame inside ViewCell
Summary: Windows phone crashing when going back to page containing listview with Frame...
Alias: None
Product: Forms
Classification: Xamarin
Component: Forms ()
Version: 1.5.0
Hardware: Other Windows
: Normal normal
Target Milestone: ---
Assignee: Rui Marinho
Depends on:
Reported: 2015-01-21 09:04 UTC by lohals
Modified: 2015-10-12 09:00 UTC (History)
10 users (show)

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

repro project (287.88 KB, application/zip)
2015-08-31 17:02 UTC, Jimmy [MSFT]
stack trace (1.65 KB, text/plain)
2015-08-31 17:04 UTC, Jimmy [MSFT]

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:

Description lohals 2015-01-21 09:04:52 UTC
When popping back (using hardware back button) to previous page that contains a listview with a ViewCell ItemTemplate containing a Frame (which contains at least a Label control), the app crashes on windows phone with the following stacktrace:

Message: Value does not fall within the expected range.

   at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
   at MS.Internal.XcpImports.SetValue(IManagedPeerBase obj, DependencyProperty property, DependencyObject doh)
   at System.Windows.DependencyObject.SetValue(DependencyProperty property, DependencyObject doh)
   at System.Windows.Controls.Border.set_Child(UIElement value)
   at Xamarin.Forms.Platform.WinPhone.FrameRenderer.PackChild()
   at Xamarin.Forms.Platform.WinPhone.FrameRenderer.OnElementChanged(ElementChangedEventArgs`1 e)
   at Xamarin.Forms.Platform.WinPhone.VisualElementRenderer`2.SetElement(VisualElement element)
   at Xamarin.Forms.Platform.WinPhone.RendererFactory.GetRenderer(VisualElement view)
   at Xamarin.Forms.Platform.WinPhone.ViewToRendererConverter.WrapperControl..ctor(View view)
   at Xamarin.Forms.Platform.WinPhone.ViewToRendererConverter.Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
   at System.Windows.Data.BindingExpression.ConvertToTarget(Object value)
   at System.Windows.Data.BindingExpression.GetValue(DependencyObject d, DependencyProperty dp)
   at System.Windows.DependencyObject.EvaluateExpression(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry)
   at System.Windows.DependencyObject.EvaluateBaseValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
   at System.Windows.DependencyObject.EvaluateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry newEntry, ValueOperation operation)
   at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
   at System.Windows.DependencyObject.RefreshExpression(DependencyProperty dp)
   at System.Windows.Data.BindingExpression.SendDataToTarget()
   at System.Windows.Data.BindingExpression.SourceAcquired()
   at System.Windows.Data.BindingExpression.System.Windows.IDataContextChangedListener.OnDataContextChanged(Object sender, DataContextChangedEventArgs e)
   at System.Windows.Data.BindingExpression.DataContextChanged(Object sender, DataContextChangedEventArgs e)
   at System.Windows.DataContextChangedEventHandler.Invoke(Object sender, DataContextChangedEventArgs e)
   at System.Windows.FrameworkElement.OnDataContextChanged(DataContextChangedEventArgs e)
   at System.Windows.FrameworkElement.OnTreeParentUpdated(DependencyObject newParent, Boolean bIsNewParentAlive)
   at System.Windows.DependencyObject.UpdateTreeParent(IManagedPeer oldParent, IManagedPeer newParent, Boolean bIsNewParentAlive, Boolean keepReferenceToParent)
   at MS.Internal.FrameworkCallbacks.ManagedPeerTreeUpdate(IntPtr oldParentElement, IntPtr parentElement, IntPtr childElement, Byte bIsParentAlive, Byte bKeepReferenceToParent, Byte bCanCreateParent)
Comment 1 lohals 2015-01-21 09:06:17 UTC
If I outcomment the Frame Control the error goes away.
Comment 2 Andreas 2015-04-17 07:32:33 UTC
I have the same problem, but without poping back to the page. My implementation crashes as soon as the ItemSource is bound to. If I remove the Frame from the ListView DataTemplate, the problem goes away.

Please fix!
Comment 3 Rui Marinho 2015-05-26 13:52:48 UTC
Thank you for taking the time to submit the bug. We tried to reproduce the issue you reported but were unable given the description. If you could please attach a reproduction to the bug by starting with a clean Xamarin.Forms project and adding just the code necessary to demonstrate the issue we would very much appreciate it. We monitor recently touched NEEDS INFO bugs so we’ll notice you attached the reproduction we’ll take it from there. 

Warm regards,
Xamarin Forms Team
Comment 4 Jimmy [MSFT] 2015-08-31 17:02:47 UTC
Created attachment 12696 [details]
repro project

I've added a repro project for this issue. I used Form 1.5.0-pre3 to test this.

*** Steps to Reproduce ***
1. Run WP project
2. Select any list item
3. Press the button to go back

*** Actual Results *** 
The app will crash with 

> System.Windows.Markup.XamlParseException: [Line: 0 Position: 0] 

*** Expected Results ***
App navigates to previous page. Removing the Frame in TestPage.xaml causes the app to navigate back as expected.

*** Environment Info ***
Microsoft Visual Studio Professional 2013
Version 12.0.40629.00 Update 5
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Professional

Team Explorer for Visual Studio 2013   06177-004-0444002-02323
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06177-004-0444002-02323
Microsoft Visual Basic 2013

Visual C# 2013   06177-004-0444002-02323
Microsoft Visual C# 2013

Visual C++ 2013   06177-004-0444002-02323
Microsoft Visual C++ 2013

Visual F# 2013   06177-004-0444002-02323
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06177-004-0444002-02323
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-0444002-02323
Windows Phone SDK 8.0 - ENU

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

Common Azure Tools   1.4
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

Microsoft Azure Mobile Services Tools   1.4
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.60610.756
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

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

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.

Xamarin   3.11.836.0 (ed5c750)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (f98871a95a479f6d71b3067b7e5834d41fcb2118)
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 (6db87c53c073f4af2f5247fb738a27ea08c094fd)
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 5 Jimmy [MSFT] 2015-08-31 17:04:37 UTC
Created attachment 12697 [details]
stack trace

Added the stack trace I sometimes get when the crash occurs
Comment 6 Jimmy [MSFT] 2015-08-31 17:06:14 UTC
Marking as NEW since I've added repro project in comment #4
Comment 7 Rui Marinho 2015-09-21 10:45:09 UTC
Hi Jimmy, this only happens in Windows Phone 8.0 , can you upgrade to Windows Phone 8.1 ?
Comment 8 Jason Smith [MSFT] 2015-09-24 13:40:23 UTC
Should be fixed in 1.5.1-pre1
Comment 9 Parmendra Kumar 2015-10-12 09:00:37 UTC
I have checked this issue with Xamarin.Forms 1.5.1-pre1 and its working fine.

Hence closing this issue.