Not found yet.
No crashes.
My iOS app occasionally crashes with System.ArgumentOutOfRangeException since the update from Xamarin.Forms 2.4 to 2.5.
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00018] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.214/src/mono/mcs/class/referencesource/mscorlib/system/throwhelper.cs:93
at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.214/src/mono/mcs/class/referencesource/mscorlib/system/throwhelper.cs:56
at System.Collections.Generic.List1[T].get_Item (System.Int32 index) [0x00009] in <1f5960abbfdf4434802d3b8a03ded4fa>:0
at System.Collections.ObjectModel.Collection
1[T].get_Item (System.Int32 index) [0x00000] in <1f5960abbfdf4434802d3b8a03ded4fa>:0
at System.Collections.ObjectModel.ReadOnlyCollection1[T].get_Item (System.Int32 index) [0x00000] in <1f5960abbfdf4434802d3b8a03ded4fa>:0
at Xamarin.Forms.Platform.iOS.RendererPool.UpdateRenderers (Xamarin.Forms.Element newElement) [0x0004e] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\RendererPool.cs:150
at Xamarin.Forms.Platform.iOS.RendererPool.UpdateNewElement (Xamarin.Forms.VisualElement newElement) [0x00080] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\RendererPool.cs:78
at Xamarin.Forms.Platform.iOS.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00050] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:161
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnRendererElementChanged (System.Object sender, Xamarin.Forms.Platform.iOS.VisualElementChangedEventArgs args) [0x0000f] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:144
at Xamarin.Forms.Platform.iOS.VisualElementRenderer
1[TElement].OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs1[TElement] e) [0x0002c] in <f321195339234cc7a2f7f1d5fa08167d>:0
at Xamarin.Forms.Platform.iOS.VisualElementRenderer
1[TElement].SetElement (TElement element) [0x00118] in
at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <f321195339234cc7a2f7f1d5fa08167d>:0
at Xamarin.Forms.Platform.iOS.RendererPool.UpdateRenderers (Xamarin.Forms.Element newElement) [0x0008c] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\RendererPool.cs:157
at Xamarin.Forms.Platform.iOS.RendererPool.UpdateNewElement (Xamarin.Forms.VisualElement newElement) [0x00080] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\RendererPool.cs:78
at Xamarin.Forms.Platform.iOS.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00050] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:161
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnRendererElementChanged (System.Object sender, Xamarin.Forms.Platform.iOS.VisualElementChangedEventArgs args) [0x0000f] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:144
at Xamarin.Forms.Platform.iOS.VisualElementRenderer
1[TElement].OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs1[TElement] e) [0x0002c] in <f321195339234cc7a2f7f1d5fa08167d>:0
at Xamarin.Forms.Platform.iOS.VisualElementRenderer
1[TElement].SetElement (TElement element) [0x00118] in
at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <f321195339234cc7a2f7f1d5fa08167d>:0
at Xamarin.Forms.Platform.iOS.RendererPool.UpdateRenderers (Xamarin.Forms.Element newElement) [0x0008c] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\RendererPool.cs:157
at Xamarin.Forms.Platform.iOS.RendererPool.UpdateNewElement (Xamarin.Forms.VisualElement newElement) [0x00080] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\RendererPool.cs:78
at Xamarin.Forms.Platform.iOS.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00050] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:161
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnRendererElementChanged (System.Object sender, Xamarin.Forms.Platform.iOS.VisualElementChangedEventArgs args) [0x0000f] in D:\agent\_work\1\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:144
at Xamarin.Forms.Platform.iOS.VisualElementRenderer
1[TElement].OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs1[TElement] e) [0x0002c] in <f321195339234cc7a2f7f1d5fa08167d>:0
at Xamarin.Forms.Platform.iOS.VisualElementRenderer
1[TElement].SetElement (TElement element) [0x00118] in
at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in
at Xamarin.Forms.Platform.iOS.ViewCellRenderer+ViewTableCell.UpdateCell (Xamarin.Forms.ViewCell cell) [0x000d9] in D:agent_work1sXamarin.Forms.Platform.iOSCellsViewCellRenderer.cs:173
at Xamarin.Forms.Platform.iOS.ViewCellRenderer+ViewTableCell.set_ViewCell (Xamarin.Forms.ViewCell value) [0x0000a] in D:agent_work1sXamarin.Forms.Platform.iOSCellsViewCellRenderer.cs:68
at Xamarin.Forms.Platform.iOS.ViewCellRenderer.GetCell (Xamarin.Forms.Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv) [0x0004d] in D:agent_work1sXamarin.Forms.Platform.iOSCellsViewCellRenderer.cs:22
at Xamarin.Forms.Platform.iOS.CellTableViewCell.GetNativeCell (UIKit.UITableView tableView, Xamarin.Forms.Cell cell, System.Boolean recycleCells, System.String templateId) [0x00081] in D:agent_work1sXamarin.Forms.Platform.iOSCellsCellTableViewCell.cs:72
at Xamarin.Forms.Platform.iOS.ListViewRenderer+ListViewDataSource.GetCell (UIKit.UITableView tableView, Foundation.NSIndexPath indexPath) [0x00017] in D:agent_work1sXamarin.Forms.Platform.iOSRenderersListViewRenderer.cs:863
at (wrapper managed-to-native) ObjCRuntime.Messaging:void_objc_msgSend_IntPtr_Int64 (intptr,intptr,intptr,long)
at UIKit.UITableView.ReloadRows (Foundation.NSIndexPath[] atIndexPaths, UIKit.UITableViewRowAnimation withRowAnimation) [0x00033] in /Users/builder/data/lanes/5489/c4240f3f/source/xamarin-macios/src/build/ios/native/UIKit/UITableView.g.cs:809
at Xamarin.Forms.Platform.iOS.CellRenderer+<>c__DisplayClass5_0.
at (wrapper delegate-invoke)
at Xamarin.Forms.Cell+
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.214/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:152
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.
at UIKit.UIKitSynchronizationContext+
at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Users/builder/data/lanes/5489/c4240f3f/source/xamarin-macios/src/Foundation/NSAction.cs:163
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/5489/c4240f3f/source/xamarin-macios/src/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/5489/c4240f3f/source/xamarin-macios/src/UIKit/UIApplication.cs:63
at WasteXApp.iOS.Application.Main (System.String[] args) [0x00001] in C:AppsWasteXAppWasteXAppAPMWasteXApp.iOSMain.cs:17
Microsoft Visual Studio Community 2015
Version 14.0.25431.01 Update 3
Microsoft .NET Framework
Version 4.7.02046
Installierte Version: Community
Visual Basic 2015 00322-20000-00000-AA978
Microsoft Visual Basic 2015
Visual C# 2015 00322-20000-00000-AA978
Microsoft Visual C# 2015
Visual C++ 2015 00322-20000-00000-AA978
Microsoft Visual C++ 2015
Windows Phone SDK 8.0 - DEU 00322-20000-00000-AA978
Windows Phone SDK 8.0 - DEU
Allgemeine Azure-Tools 1.8
Bietet allgemeine Dienste für die Verwendung durch Azure Mobile Services und Microsoft Azure-Tools.
Application Insights-Tools für Visual Studio-Paket 7.18.00214.2
Application Insights-Tools für Visual Studio
ASP.NET and Web Tools 2015.1 14.1.21111.0
ASP.NET and Web Tools 2015.1
ASP.NET Web Frameworks and Tools 2012.2 4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563
ASP.NET Web Frameworks and Tools 2013 5.2.40314.0
For additional information, visit http://www.asp.net/
Azure App Service Tools v2.8.1 14.0.11123.0
Azure App Service Tools v2.8.1
JavaScript-Sprachdienst 2.0
JavaScript-Sprachdienst
JavaScript Project System 2.0
JavaScript Project System
JetBrains ReSharper Ultimate 2017.2.2 Build 109.0.20171006.122324
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2017 JetBrains, Inc.
Merq 1.1.17-rc (cba4571)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.
Microsoft .NET Core Tools (Preview 2) 14.1.21111.0
Microsoft .NET Core Tools (Preview 2)
Microsoft Azure Mobile Services Tools 1.4
Microsoft Azure Mobile Services Tools
Mono Debugging for Visual Studio 4.8.4-pre (3fe64e3)
Support for debugging Mono processes with Visual Studio.
MySQL for Visual Studio 1.2.6
Data design and management tools for MySQL. Copyright © 2007-2015 Oracle, Inc.
NuGet-Paket-Manager 3.5.0
NuGet-Paket-Manager in Visual Studio. Weitere Informationen zu NuGet finden Sie unter "http://docs.nuget.org/".
PreEmptive Analytics Visualizer 1.2
Microsoft Visual Studio-Erweiterung zur Visualisierung aggregierter Zusammenfassungen vom PreEmptive Analytics-Produkt.
SQL Server Data Tools 14.0.60519.0
Microsoft SQL Server Data Tools
TypeScript 1.8.36.0
TypeScript-Tools für Visual Studio
Visual Studio Tools für Universelle Windows-Apps 14.0.25527.01
Mit den Visual Studio Tools für Universelle Windows-Apps können Sie eine universelle App-Erfahrung erstellen, die auf jedem Gerät genutzt werden kann, das Windows 10 ausführt: Smartphone, Tablet, PC und viele weitere Geräte. Das Microsoft Windows 10 SDK ist in den Tools enthalten.
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
Xamarin 4.8.0.752 (4a1f0ea)
Visual Studio-Erweiterung, um Entwicklung für Xamarin.iOS und Xamarin.Android zu ermöglichen.
Xamarin Designer 4.8.182 (76aa1723e)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin.Android 8.1.0.13 (f241f51)
Visual Studio-Erweiterung zur Unterstützung von Entwicklung für Xamarin.Android.
Xamarin.Android SDK 8.1.0.23 (HEAD/f65f87747)
Xamarin.Android Reference Assemblies and MSBuild support.
Xamarin.iOS 11.4.0.214 (c4240f3)
Visual Studio-Erweiterung, um Entwicklung für Xamarin.iOS zu ermöglichen.
Xamarin.iOS and Xamarin.Mac SDK 11.4.0.214 (c4240f3)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Is it possible it's related this this issue https://github.com/xamarin/Xamarin.Forms/issues/1322, happens when an ListView bound to an ObservableCollection containing no items. If not directly related there's similarities.
Possibly related to bugzilla 59412, but not sure since this one supposedly only happens occasionally. I get this error consistently when ListView.HasUnevenRows is enabled.
Are you using recycling with the ListView?
@mattclarkie If you're referring to me, then no. I am using the default value, RetainElement.
@mattclarkie I am using ListView with CachingStrategy="RetainElement" and HasUnevenRows="True".
I have the same problem since 2.5. I did not set CachingStrategy and tried to set HasUnevenRows to false, however this did not help.
@ssc4gemos When you upgraded from 2.4 to 2.5 which version of 2.4 were you last using? 2.4-sr6?
@gtbuchanan You mentioned that you're able to consistently reproduce this error. Would you be willing/able to submit a reduced reproduction?
@kingces95 I use version 2.4.0.91020 and have this problem with 2.5.0.121934.
will solve the issue but make the list cells behave differently
Same issue on a TableView. Doing a TableView.Root.Insert() ot TableView.Root.Add() randomly throws an ThrowArgumentOutOfRangeException
at System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) [0x00018] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.214/src/mono/mcs/class/referencesource/mscorlib/system/throwhelper.cs:93
at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.214/src/mono/mcs/class/referencesource/mscorlib/system/throwhelper.cs:56
at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x00009] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.214/src/mono/mcs/class/referencesource/mscorlib/system/collections/generic/list.cs:181
at System.Collections.ObjectModel.Collection`1[T].get_Item (System.Int32 index) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.214/src/mono/mcs/class/referencesource/mscorlib/system/collections/objectmodel/collection.cs:47
at System.Collections.ObjectModel.ReadOnlyCollection`1[T].get_Item (System.Int32 index) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/11.4.0.214/src/mono/mcs/class/referencesource/mscorlib/system/collections/objectmodel/readonlycollection.cs:39
at Xamarin.Forms.Platform.iOS.RendererPool.UpdateRenderers (Xamarin.Forms.Element newElement) [0x0004e] in D:\agent\_work\2\s\Xamarin.Forms.Platform.iOS\RendererPool.cs:150
at Xamarin.Forms.Platform.iOS.RendererPool.UpdateNewElement (Xamarin.Forms.VisualElement newElement) [0x00080] in D:\agent\_work\2\s\Xamarin.Forms.Platform.iOS\RendererPool.cs:78
at Xamarin.Forms.Platform.iOS.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00050] in D:\agent\_work\2\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:161
at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnRendererElementChanged (System.Object sender, Xamarin.Forms.Platform.iOS.VisualElementChangedEventArgs args) [0x0000f] in D:\agent\_work\2\s\Xamarin.Forms.Platform.iOS\VisualElementPackager.cs:144
at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs`1[TElement] e) [0x00020] in D:\agent\_work\2\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:279
at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].SetElement (TElement element) [0x00110] in D:\agent\_work\2\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:189
at Xamarin.Forms.Platform.iOS.VisualElementRenderer`1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in D:\agent\_work\2\s\Xamarin.Forms.Platform.iOS\VisualElementRenderer.cs:140
at Xamarin.Forms.Platform.iOS.ViewCellRenderer+ViewTableCell.UpdateCell (Xamarin.Forms.ViewCell cell) [0x000d9] in D:\agent\_work\2\s\Xamarin.Forms.Platform.iOS\Cells\ViewCellRenderer.cs:173
at Xamarin.Forms.Platform.iOS.ViewCellRenderer+ViewTableCell.set_ViewCell (Xamarin.Forms.ViewCell value) [0x0000a] in D:\agent\_work\2\s\Xamarin.Forms.Platform.iOS\Cells\ViewCellRenderer.cs:68
at Xamarin.Forms.Platform.iOS.ViewCellRenderer.GetCell (Xamarin.Forms.Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv) [0x0004d] in D:\agent\_work\2\s\Xamarin.Forms.Platform.iOS\Cells\ViewCellRenderer.cs:22
at XFGloss.iOS.Renderers.XFGlossViewCellRenderer.GetCell (Xamarin.Forms.Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv) [0x00000] in <eb71ba07dbbc4ee9bd122203c0336d84>:0
at Xamarin.Forms.Platform.iOS.CellTableViewCell.GetNativeCell (UIKit.UITableView tableView, Xamarin.Forms.Cell cell, System.Boolean recycleCells, System.String templateId) [0x00081] in D:\agent\_work\2\s\Xamarin.Forms.Platform.iOS\Cells\CellTableViewCell.cs:72
at Xamarin.Forms.Platform.iOS.TableViewModelRenderer.GetCell (UIKit.UITableView tableView, Foundation.NSIndexPath indexPath) [0x0001d] in D:\agent\_work\2\s\Xamarin.Forms.Platform.iOS\Renderers\TableViewModelRenderer.cs:34
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/5489/c4240f3f/source/xamarin-macios/src/UIKit/UIApplication.cs:79
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/5489/c4240f3f/source/xamarin-macios/src/UIKit/UIApplication.cs:63
at CraftManagement.Mobile.iOS.Application.Main (System.String[] args) [0x00002] in D:\Source Control\HRST\CWST\devs\trobinson\CMM.TRo\Projects\CraftManagement.Mobile.iOS\Main.cs:15
Not convinced this is localised to only iOS, seeing something similar on Android JellyBean but need to poke further.
I am having exactly the same issue with the latest version for xamarin forms, everything was working ok about a month ago, now hard crashes on simulators and devices, I have managed to debug some of the issues but the ListViews are unstable, the issues seem to be something to do with ViewCell bindings for some of the issues, what I have found is any label in a ViewCell that's text property is either null or '' that will produce a hard crash now, just making sure all text properties that are null or '' are now ' ' has stopped a lot of the crashes but not all. Of the errors I can capture this one appears a lot, the code has been stable for about a year so pretty happy with that.
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
If this is a known bug, and it appears to have a fix being merged in, any idea when this would be available for us to update with? I started a new screen around Christmas in which I am building, modifying, and tearing down many dynamic TableSection
and this bug makes the page unusable. I just got back from the break to find that the bug still exists but appears to have work done on it.
Trying to decide if it's worth waiting for a fix for, or scrapping and doing the page differently entirely and coming up with an excuse for why it can't be done that doesn't make Xamarin look bad...
I still have the problem with the very latest builds of everything, app crashes 10 times a day at least, this never happened until 5-6 weeks ago, I am at a dead stop with that app and have moved onto other projects whilst I await a fix.
@alexwhite68 thanks for the heads up that it's not just me still. I think I'll have to put this screen on the backburner for a few weeks and reassess then. Crazy how basic UI functionality is totally busted in a major build like this...
@torrobinson @alexwhite68 can you provide a repo?
Best I can do is zip up the project, email it in and show what needs to be done to make it crash.
@alexwhite68 thanks! My company probably wouldn't be too happy for me to take our project and send externally, and narrowing down to the smallest reproducible example would take a lot of time on my end.
Any help is appreciated @rmarinho ! Just noticed you're on the Xamarin team - we've had meetups with Xamarin team members in Canada to get us set up with the platform, and they were extremely knowledgeable and helpful.
@torrobinson I am happy sending mine in and hopefully it covers your issue too, I know the Xamarin guys will just look for the issue and once done delete the project so I am not concerned with that, but I am a one name band so the buck stops with me, just want the issue fixed ASAP.
We have the same issue but I'm having a hard time reproducing it in a sample.
We tried HasUnevenRows true or false and caching strategy retainelement or recycle element, but nothing avoids the crash. We rolledback to 2.4.0.282. The latest versions of 2.4 were still crashing. (I'm not sure if 2.4.0.282 is exactly the latest that doesn't crash, but it was the version we were on before updating to 2.5)
Xamarin.Forms.3.0.0.296286-pre2
Crashing.
_System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: index_
It used to work fine in Xamarin.Forms.2.5.0.122203. After upgrading, I have this issue.
Only on iOS. Tested on Simulator + Device. (ios 11.2.6) Android is OK.
I have a tabbed view with 3 tabs. When 2nd 'ABC' tab is clicked:
```c#
public partial class PageABC : ContentPage
PageABC_ViewModel ViewModel => BindingContext as PageABC_ViewModel ;
public PageABC(PageABC_ViewModel vm)
{
BindingContext = vm;
}
private void PageABC_Appearing(object sender, EventArgs e)
{
ViewModel.BuildList(); <------------------- CRASHING HERE (at MYList.Clear();)
}
```c#
class PageABC_ViewModel
public ObservableCollection<MyData> MYList{ get; }
public PageABC_ViewModel()
{
MYList= new ObservableCollection<MyData>();
BuildList();
}
internal void BuildList()
{
MYList.Clear();
....fill MYList...
}
PageABC XAML:
<ListView
HasUnevenRows="True"
ItemsSource="{Binding MYList}"
IsGroupingEnabled="True"
>
....
Callstack:
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: index
0xB in Xamarin.Forms.ListProxy.get_Item at D:\agent\_work\6\s\Xamarin.Forms.Core\ListProxy.cs:127,6 C#
0x2 in Xamarin.Forms.ListProxy.System.Collections.IList.get_Item at D:\agent\_work\6\s\Xamarin.Forms.Core\ListProxy.cs:444,10 C#
0x9 in Xamarin.Forms.Internals.TemplatedItemsList<Xamarin.Forms.ItemsView<Xamarin.Forms.Cell>,Xamarin.Forms.Cell>.get_Item at D:\agent\_work\6\s\Xamarin.Forms.Core\TemplatedItemsList.cs:337,10 C#
0x1F in Xamarin.Forms.Platform.iOS.ListViewRenderer.ListViewDataSource.HeaderViewDisplayingEnded at D:\agent\_work\6\s\Xamarin.Forms.Platform.iOS\Renderers\ListViewRenderer.cs:982,5 C#
0xA in ObjCRuntime.Messaging.void_objc_msgSend C#
0x20 in UIKit.UITableView.ReloadData at /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/UIKit/UITableView.g.cs:792,5 C#
0x2B8 in Xamarin.Forms.Platform.iOS.ListViewRenderer.UpdateItems at D:\agent\_work\6\s\Xamarin.Forms.Platform.iOS\Renderers\ListViewRenderer.cs:602,6 C#
0x4 in Xamarin.Forms.Platform.iOS.ListViewRenderer.OnCollectionChanged at D:\agent\_work\6\s\Xamarin.Forms.Platform.iOS\Renderers\ListViewRenderer.cs:310,4 C#
0xD in Xamarin.Forms.Internals.TemplatedItemsList<Xamarin.Forms.ItemsView<Xamarin.Forms.Cell>,Xamarin.Forms.Cell>.OnCollectionChanged at D:\agent\_work\6\s\Xamarin.Forms.Core\TemplatedItemsList.cs:771,5 C#
0xB6 in Xamarin.Forms.Internals.TemplatedItemsList<Xamarin.Forms.ItemsView<Xamarin.Forms.Cell>,Xamarin.Forms.Cell>.GroupedReset at D:\agent\_work\6\s\Xamarin.Forms.Core\TemplatedItemsList.cs:719,4 C#
0x45A in Xamarin.Forms.Internals.TemplatedItemsList<Xamarin.Forms.ItemsView<Xamarin.Forms.Cell>,Xamarin.Forms.Cell>.OnCollectionChangedGrouped at D:\agent\_work\6\s\Xamarin.Forms.Core\TemplatedItemsList.cs:900,6 C#
0xA in Xamarin.Forms.Internals.TemplatedItemsList<Xamarin.Forms.ItemsView<Xamarin.Forms.Cell>,Xamarin.Forms.Cell>.OnProxyCollectionChanged at D:\agent\_work\6\s\Xamarin.Forms.Core\TemplatedItemsList.cs:970,5 C#
0xD in Xamarin.Forms.ListProxy.OnCollectionChanged at D:\agent\_work\6\s\Xamarin.Forms.Core\ListProxy.cs:233,5 C#
0x24 in Xamarin.Forms.ListProxy. at D:\agent\_work\6\s\Xamarin.Forms.Core\ListProxy.cs:206,6 C#
0xA6 in Xamarin.Forms.ListProxy.OnCollectionChanged at D:\agent\_work\6\s\Xamarin.Forms.Core\ListProxy.cs:225,6 C#
0x34 in Xamarin.Forms.ListProxy.WeakNotifyProxy.OnCollectionChanged at D:\agent\_work\6\s\Xamarin.Forms.Core\ListProxy.cs:394,5 C#
0x17 in System.Collections.ObjectModel.ObservableCollection<MyProj.MyData>.OnCollectionChanged at /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:288,21 C#
0x7 in System.Collections.ObjectModel.ObservableCollection<MyProj.MyData>.OnCollectionReset at /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:375,13 C#
0x23 in System.Collections.ObjectModel.ObservableCollection<MyProj.MyData>.ClearItems at /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:189,13 C#
0x15 in System.Collections.ObjectModel.Collection<MyProj.MyData>.Clear at /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/collections/objectmodel/collection.cs:75,13 C#
> 0x19 in MyProj.PageABC_ViewModel.BuildList at D:\Project\Xamarin\MyProj\MyProj\MyProj\PageTab\ABC\PageABCViewModel.cs:51,5 C#
0x24 in MyProj.PageABC.PageABC_Appearing at D:\Project\Xamarin\MyProj\MyProj\MyProj\PageTab\ABC\PageABC.xaml.cs:60,5 C#
0x3B in Xamarin.Forms.Page.SendAppearing at D:\agent\_work\6\s\Xamarin.Forms.Core\Page.cs:316,5 C#
0x25 in Xamarin.Forms.Platform.iOS.PageRenderer.ViewDidAppear at D:\agent\_work\6\s\Xamarin.Forms.Platform.iOS\Renderers\PageRenderer.cs:93,4 C#
0x5C in UIKit.UIApplication.UIApplicationMain C#
0xB in UIKit.UIApplication.Main at /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/UIKit/UIApplication.cs:79,4 C#
0x3B in UIKit.UIApplication.Main at /Library/Frameworks/Xamarin.iOS.framework/Versions/11.8.0.20/src/Xamarin.iOS/UIKit/UIApplication.cs:63,4 C#
0x19 in MyProj.iOS.Application.Main at D:\Project\Xamarin\MyProj\MyProj\MyProj.iOS\Main.cs:17,4 C#
UPDATE:
It's even crashing if I just do:
c#
private void PageABC_Appearing(object sender, EventArgs e)
{
_listView.ItemsSource = null; // <<------------ CRASH
}
Might be related (same?) as https://github.com/xamarin/Xamarin.Forms/issues/2145
I am attaching a sample: run in ios (simulator). You see 3 tabs. Just click on the 2nd tab -> crash:
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: index
Note, this runs fine 2.5.0.280555, but crashes on 3.0.0.296286-pre2.
This might gone wrong in 3.0_pre with this fix: https://github.com/xamarin/Xamarin.Forms/issues/1904
I tested in 3.0.0.427558-pre4
Seems to be FIXED , no more crash.
@ssc4gemos can you confirm if this is fixed for you ?
@rmarinho answering for @ssc4gemos
We changed our implementation to use "RecycleElement" in late December of last year, to successfully workaround the bug. I cannot install a pre-release at this point in time, so I cannot confirm or deny that it has been fixed in 3.0.0.427558-pre4.
Verified no reproduction on master.
Most helpful comment
@torrobinson I am happy sending mine in and hopefully it covers your issue too, I know the Xamarin guys will just look for the issue and once done delete the project so I am not concerned with that, but I am a one name band so the buck stops with me, just want the issue fixed ASAP.