Bug 34908 - [WP] Changing MainPage to Page w/ ListView Throws an ArgumentException
Summary: [WP] Changing MainPage to Page w/ ListView Throws an ArgumentException
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 1.5.2
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-10-15 13:29 UTC by Jimmy [MSFT]
Modified: 2016-04-13 18:54 UTC (History)
2 users (show)

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

repro solution (121.95 KB, application/x-zip-compressed)
2015-10-15 13:29 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 Jimmy [MSFT] 2015-10-15 13:29:13 UTC
Created attachment 13347 [details]
repro solution

### Overview
When MainPage is changed to a Page that contains a ListView, a System.ArgumentException: "Value does not fall within the expected range" will be thrown on Windows Phone.

However, it looks like it is an internal exception and will only be seen if "CLR Exceptions" is selected in the Debug > Exceptions window (VS2013). You should be able to continue past the exception.

Also, exception only occurs when the App's MainPage is subsequently changed to a Page that contains a ListView. If using a NavigationPage, navigating to the a Page with a ListView does not cause the exception. The attached solution demonstrates both methods.

This issue was found when using Forms 1.5.1-pre2. Testing previous versions shows that it does not occur in versions < 1.4.0.

Call stack when exception occurs:

>	System.Windows.ni.dll!MS.Internal.XcpImports.MethodEx(System.IntPtr ptr, string name, MS.Internal.CValue[] cvData)
> 	System.Windows.ni.dll!MS.Internal.XcpImports.MethodPack(System.IntPtr objectPtr, string methodName, object[] rawData)
> 	System.Windows.ni.dll!MS.Internal.XcpImports.TouchFrameEventArgs_GetPrimaryTouchPoint(System.Windows.Input.TouchFrameEventArgs args, System.Windows.UIElement relativeTo)
> 	System.Windows.ni.dll!System.Windows.Input.TouchFrameEventArgs.GetPrimaryTouchPoint(System.Windows.UIElement relativeTo)	Unknown
> 	Xamarin.Forms.Platform.WP8.DLL!Xamarin.Forms.Platform.WinPhone.FixedLongListSelector.OnFrameReported(object sender, System.Windows.Input.TouchFrameEventArgs e)
> 	System.Windows.ni.dll!System.Windows.Input.Touch.OnTouch(object sender, System.Windows.Input.TouchFrameEventArgs e)
> 	System.Windows.ni.dll!MS.Internal.JoltHelper.RaiseEvent(System.IntPtr target, uint eventId, System.IntPtr coreEventArgs, uint eventArgsTypeIndex)

### Steps to Reproduce
1. Download and run the attached solution
2. Open the Debug > Exception window (VS2013: Ctrl+Alt+E)
3. Select "Common Language Runtime Exceptions" and click "Okay"
4. In the app, press the "Change MainPage" button
5. Repeat #4 if neccessary until the exception occurs

### Actual Results
The app will throw a System.ArgumentException, but should not crash if you press "Continue".

If you press the "Use Navigation" button instead, no exception will be thrown.

### Expected Results
No exception is thrown. 

### Environment Info
Microsoft Visual Studio Ultimate 2013
Version 12.0.40629.00 Update 5
Microsoft .NET Framework
Version 4.6.01028

Installed Version: Ultimate

Architecture and Modeling Tools   06181-004-0449004-02074
Microsoft Architecture and Modeling Tools
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

Team Explorer for Visual Studio 2013   06181-004-0449004-02074
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06181-004-0449004-02074
Microsoft Visual Basic 2013

Visual C# 2013   06181-004-0449004-02074
Microsoft Visual C# 2013

Visual C++ 2013   06181-004-0449004-02074
Microsoft Visual C++ 2013

Visual F# 2013   06181-004-0449004-02074
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06181-004-0449004-02074
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   06181-004-0449004-02074
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

NuGet Package Manager   2.8.60723.765
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.

SQL Server Data Tools   12.0.41012.0
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.

Xamarin   3.11.1537.0 (a11147b)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (53fce3730830417896a42f365a5ba35f1ee58d9d)
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 (73db6324ad6864caae30bf4010c185598d262e69)
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 1 Jimmy [MSFT] 2015-10-15 13:30:26 UTC
Similar to bug #30397 but this one is occurring when setting the MainPage, not navigating back. It also results in a different call stack.
Comment 2 Rui Marinho 2016-01-26 19:15:28 UTC
I wasn't able to reproduce the error with the provided sample.
Comment 3 Jason Smith [MSFT] 2016-04-13 18:54:00 UTC
Thank you for your bug report. As we have not received the information requested, we cannot properly triage your bug and are marking it resolved.

Warm regards,
Xamarin Forms Team