{"id":19099469,"url":"https://github.com/TheCodeTraveler/CollectionViewBoundsExceptionRepro","last_synced_at":"2025-09-08T04:31:47.880Z","repository":{"id":68230971,"uuid":"276750430","full_name":"TheCodeTraveler/CollectionViewBoundsExceptionRepro","owner":"TheCodeTraveler","description":"Reproduction Sample for Xamarin.Forms.CollectionView","archived":false,"fork":false,"pushed_at":"2020-07-04T00:00:12.000Z","size":330,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-07T04:39:10.254Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheCodeTraveler.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-07-02T21:40:51.000Z","updated_at":"2021-02-01T20:20:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"af303446-e180-47b7-87d2-4975abf9870a","html_url":"https://github.com/TheCodeTraveler/CollectionViewBoundsExceptionRepro","commit_stats":null,"previous_names":["thecodetraveler/collectionviewboundsexceptionrepro","brminnick/collectionviewboundsexceptionrepro"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TheCodeTraveler/CollectionViewBoundsExceptionRepro","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCodeTraveler%2FCollectionViewBoundsExceptionRepro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCodeTraveler%2FCollectionViewBoundsExceptionRepro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCodeTraveler%2FCollectionViewBoundsExceptionRepro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCodeTraveler%2FCollectionViewBoundsExceptionRepro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheCodeTraveler","download_url":"https://codeload.github.com/TheCodeTraveler/CollectionViewBoundsExceptionRepro/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheCodeTraveler%2FCollectionViewBoundsExceptionRepro/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274134644,"owners_count":25228198,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-08T02:00:09.813Z","response_time":121,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T03:50:17.676Z","updated_at":"2025-09-08T04:31:47.865Z","avatar_url":"https://github.com/TheCodeTraveler.png","language":"C#","readme":"# CollectionViewBoundsExceptionRepro\n\nReproduction Sample for Xamarin.Forms.CollectionView `NSRangeException`:\n\n```bash\nObjective-C exception thrown.  Name: NSRangeException Reason: *** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array\n```\n\n### Reproduction Steps\n\n1. Download / clone this repo\n2. In Visual Studio, open `CollectionViewBoundsExceptionRepro.sln`\n3. In Visual Studio, buld/deploy `CollectionViewBoundsExceptionRepro.iOS` to an iOS Simulator or Device \n4. Confirm `NSRangeException` is thrown on launch\n\n## Work Arounds\n\n#### Option #1. Downgrade Xamarin.Forms\n\nDowngrade to Xamarin.Forms v4.7.0.937-pre4\n\n#### Option #2. Remove CollectionView.Footer\n\nSet `CollectionView.Footer = null`\n\n1. In `CollectionViewPage.cs`, change `Footer = new BoxView { BackgroundColor = Color.Red, HeightRequest = 53 }` to `Footer = null`\n\nhttps://github.com/brminnick/CollectionViewBoundsExceptionRepro/blob/8a6636d7af57f289113e800cfa0d0160cad78d6d/Src/CollectionViewBoundsExceptionRepro/CollectionViewPage.cs#L17\n\n#### Option #3. Replace `IEnumerable\u003cint\u003e` with `ObservableCollection\u003cint\u003e`\n\n1. In `CollectionViewModel.cs`, remove `public IEnumerable\u003cint\u003e ScoreCollectionList`\n2. In `CollectionViewModel.cs`, remove `IEnumerable\u003cint\u003e? _scoreCollectionList;`\n3. In `CollectionViewModel.cs`, add `public ObservableCollection\u003cint\u003e ScoreCollectionList { get; } = new ObservableCollection\u003cint\u003e()`\n4. In `CollectionViewModel.cs`, in `ExecuteRefreshCommand` refactor logic for `ObservableCollection` : \n\nReplace this code:\n\n```csharp\nvoid ExecuteRefreshCommand()\n{\n    ScoreCollectionList = Enumerable.Range(0, 100).ToList();\n    IsRefreshing = false;\n}\n```\n\nwith this code:\n\n```csharp\nvoid ExecuteRefreshCommand()\n{\n    foreach (var number in Enumerable.Range(0, 100))\n        ScoreCollectionList.Add(number);\n\n    IsRefreshing = false;\n}\n```\n\n### Screenshots\n\n![](https://user-images.githubusercontent.com/13558917/86501165-3f467380-bd4b-11ea-9ca6-506a162cac47.gif)\n\n### Environment\n\n=== Visual Studio Enterprise 2019 for Mac (Preview) ===\n\nVersion 8.7 Preview (8.7 build 1802)\nInstallation UUID: ec012746-7bcc-47bc-bba9-e9b5ade4bdc7\n\tGTK+ 2.24.23 (Raleigh theme)\n\tXamarin.Mac 6.18.0.23 (d16-6 / 088c73638)\n\n\tPackage version: 612000074\n\n=== Mono Framework MDK ===\n\nRuntime:\n\tMono 6.12.0.74 (2020-02/e9d3af508e4) (64-bit)\n\tPackage version: 612000074\n\n=== Roslyn (Language Service) ===\n\n3.7.0-3.20312.3+ec4841263590f5456e32728d98097e97c1605e22\n\n=== NuGet ===\n\nVersion: 5.7.0.6653\n\n=== .NET Core SDK ===\n\nSDK: /usr/local/share/dotnet/sdk/5.0.100-preview.6.20318.15/Sdks\nSDK Versions:\n\t5.0.100-preview.6.20318.15\n\t3.1.301\n\t3.1.300\n\t3.1.202\n\t3.1.200\n\t3.1.102\n\t3.0.101\n\t2.1.803\nMSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/Sdks\n\n=== .NET Core Runtime ===\n\nRuntime: /usr/local/share/dotnet/dotnet\nRuntime Versions:\n\t5.0.0-preview.6.20305.6\n\t5.0.0-preview.1.20120.5\n\t3.1.5\n\t3.1.4\n\t3.1.2\n\t3.1.1\n\t3.1.0\n\t3.0.3\n\t3.0.1\n\t2.1.19\n\t2.1.18\n\t2.1.17\n\t2.1.16\n\t2.1.15\n\t2.1.14\n\n=== Xamarin.Profiler ===\n\nVersion: 1.6.13.11\nLocation: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler\n\n=== Updater ===\n\nVersion: 11\n\n=== Apple Developer Tools ===\n\nXcode 11.5 (16139)\nBuild 11E608c\n\n=== Xamarin.Mac ===\n\nVersion: 6.20.1.18 (Visual Studio Enterprise)\nHash: 8ffa3d888\nBranch: d16-7\nBuild date: 2020-06-06 13:34:07-0400\n\n=== Xamarin.iOS ===\n\nVersion: 13.20.1.18 (Visual Studio Enterprise)\nHash: 8ffa3d888\nBranch: d16-7\nBuild date: 2020-06-06 13:34:08-0400\n\n=== Xamarin Designer ===\n\nVersion: 16.7.0.459\nHash: 65d9dd3aa\nBranch: remotes/origin/d16-7\nBuild date: 2020-06-10 03:48:34 UTC\n\n=== Xamarin.Android ===\n\nVersion: 10.4.0.0 (Visual Studio Enterprise)\nCommit: xamarin-android/d16-7/de70286\nAndroid SDK: /Users/bramin/Library/Developer/Xamarin/android-sdk-macosx\n\tSupported Android versions:\n\t\t7.0 (API level 24)\n\t\t8.0 (API level 26)\n\t\t8.1 (API level 27)\n\nSDK Tools Version: 26.1.1\nSDK Platform Tools Version: 30.0.2\nSDK Build Tools Version: 29.0.2\n\nBuild Information: \nMono: 87ef555\nJava.Interop: xamarin/java.interop/d16-7@76d1ac7\nProGuard: Guardsquare/proguard/proguard6.2.2@ebe9000\nSQLite: xamarin/sqlite/3.32.1@1a3276b\nXamarin.Android Tools: xamarin/xamarin-android-tools/d16-7@017078f\n\n=== Microsoft OpenJDK for Mobile ===\n\nJava SDK: /Users/bramin/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25\n1.8.0-25\nAndroid Designer EPL code available here:\nhttps://github.com/xamarin/AndroidDesigner.EPL\n\n=== Android SDK Manager ===\n\nVersion: 16.7.0.8\nHash: 6e20e98\nBranch: remotes/origin/d16-7\nBuild date: 2020-06-11 19:23:34 UTC\n\n=== Android Device Manager ===\n\nVersion: 16.7.0.12\nHash: 51b7059\nBranch: remotes/origin/d16-7\nBuild date: 2020-06-11 19:23:58 UTC\n\n=== Build Information ===\n\nRelease ID: 807001802\nGit revision: 2129f3002481c263b627ea82a6f25349ee5947cb\nBuild date: 2020-06-22 06:15:44-04\nBuild branch: release-8.7\nXamarin extensions: 2129f3002481c263b627ea82a6f25349ee5947cb\n\n=== Operating System ===\n\nMac OS X 10.15.5\nDarwin 19.5.0 Darwin Kernel Version 19.5.0\n    Tue May 26 20:41:44 PDT 2020\n    root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTheCodeTraveler%2FCollectionViewBoundsExceptionRepro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTheCodeTraveler%2FCollectionViewBoundsExceptionRepro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTheCodeTraveler%2FCollectionViewBoundsExceptionRepro/lists"}