Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

iOS bug view not updating correctly when Collection View is bound to an Observable Range Collection and visibility of view is set to true once collection loads #13760

Closed
krmWorkAccnt opened this issue Feb 14, 2021 · 2 comments

Comments

@krmWorkAccnt
Copy link

Description

This issue only exists on iOS and isn't an issue for Android.
Note -- There are a couple of different scenarios illustrating that it's not just one thing that is causing the issue.
The issue is with the View updating correctly when it's visibility is initially set to false in the constructor, then once the CollectionViews item source that is bound to an ObservableRangeCollection is populated and the Views visibility is set back to true, the CollectionViews items are not drawn to the view -- With this scenario, it's only an issue when the ObservableRangeCollection is directly being assigned e.g. Results = new ObservableRangeCollection(await GetData1()); -- However using below technique to populate the ObservableRangeCollection isn't an issue Results.AddRange(await GetData2());.
I have provided a project that replicates the issue and can be downloaded from https://github.com/krmWorkAccnt/iOSBugWithViewUpdatingAfterLoading
When the project loads, it's setup to show the issue with iOS -- To show it's a combination of events causing the issue, comment out the visibility setting in the constructor of the MainViewModel and populating the CollectionView using GetResults1() works correclty.

Steps to Reproduce

  1. Refer to project and download -- created here: https://github.com/krmWorkAccnt/iOSBugWithViewUpdatingAfterLoading
  2. files of interest are: MainViewModel.cs
  3. Set the start up project as Android and run the project -- This will show there isn't an issue -- Set the start up project as iOS and run the project, this will show that there is an issue and after the collection views item source has been populated this isn't updating the view to be redrawn
  4. For this set up, we're just assigning a collection directly to our collection property as per Results = new ObservableRangeCollection(await GetData1()); and setting the visibility to false in the VM constructor, however if you set the visibility to true in the constructor and run the project, the view draws items of the collection view correctly.
  5. Set the visibility in the constructor back to false, then comment out where Results is being populated using GetData1 and uncomment below code where Results is using AddRange to populate the collection view, here the view is redrawn correctly.

Expected Behavior

iOS view draws correctly once the collection views item source has been updated and visibility is set back to true

Actual Behavior

iOS view isn't correctly redrawing once collection views item source is updated and visibility is set back to true

Basic Information

  • Version with issue: 5.0.0.1874
  • Last known good version: Not sure
  • Platform Target Frameworks: iOS -- appears to be an issue for all platforms
    • iOS: 14.1
    • Android: 10 API 29
    • UWP: N/A
  • Android Support Library / AndroidX Version:
  • NuGet Packages: NETStandard.Library v2.0.3 -- Refractored.MvvMHelpers v1.6.2 -- Xamarin.Essentialsv1.5.3.2 -- Xamar.Forms v5.0.0.1874
  • Affected Devices:
    iOS devices regardless of iOS version

Environment

Show/Hide Visual Studio info
Microsoft Visual Studio Enterprise 2019 (2)
Version 16.7.7
VisualStudio.16.Release/16.7.7+30621.155
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Enterprise

ASP.NET and Web Tools 2019   16.7.532.28833
ASP.NET and Web Tools 2019

ASP.NET Core Razor Language Services   16.1.0.2035807+72d099b977d3a85e65fa3b0614ca8cfc803fef02
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2019   16.7.532.28833
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   16.7.532.28833
Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools   16.7.532.28833
Azure Functions and Web Jobs Tools

BusinessObjectEditor   1.0
Information about my package

C# Tools   3.7.0-6.20514.1+600c0dadd199296df3ed07dfabdc014563a77f7c
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

ConvertToDevExtremeCommand Extension   1.0
ConvertToDevExtremeCommand Visual Studio Extension Detailed Info

CreateLayoutWizard   1.0
Create layout wizard.

DevExpress Reporting Extension   1.0
A Visual Studio extension that invokes the Report Designer editor for report definition REPX files.

DevExpress.DeploymentTool   1.0
A useful tool for deploying DevExpress assemblies.

DevExpress.ExpressApp.Design.DynamicPackage   1.0
DevExpress VSIX Package

DevExpress.ExpressApp.DesignPackage   1.0
DevExpress VSIX Package

DevExpress.Win.LayoutAssistant Extension   1.0
DevExpress.Win.LayoutAssistant Visual Studio Extension Detailed Info

Extensibility Message Bus   1.2.6 (master@34d6af2)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

GitHub.VisualStudio   2.11.106.19330
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

IntelliCode Extension   1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.30701.1

Microsoft Continuous Delivery Tools for Visual Studio   0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager   2.1.79+ge3567815aa.RR
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio Tools for Containers   1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Mono Debugging for Visual Studio   16.7.5 (112c7bc)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   5.7.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

SettingsWindow Extension   1.0
SettingsWindow Visual Studio Extension Detailed Info

Snapshot Debugging Extension   1.0
Snapshot Debugging Visual Studio Extension Detailed Info

SQL Server Data Tools   16.0.62008.03130
Microsoft SQL Server Data Tools

TypeScript Tools   16.0.20702.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   3.7.0-6.20514.1+600c0dadd199296df3ed07dfabdc014563a77f7c
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.10.0.0 for F# 4.7   16.7.0-beta.20361.3+3ef6f0b514198c0bfa6c2c09fefe41a740b024d5
Microsoft Visual F# Tools 10.10.0.0 for F# 4.7

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions (Preview)   1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio Tools for Containers   1.0
Visual Studio Tools for Containers

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Foo   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

WiX Toolset Visual Studio Extension   1.0.0.4
WiX Toolset Visual Studio Extension version 1.0.0.4
Copyright (c) .NET Foundation and contributors. All rights reserved.

Xamarin   16.7.000.463 (d16-7@5209782)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   16.7.0.495 (remotes/origin/d16-7@79c0c522c)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   16.7.85 (1bcbbdf)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   11.0.2.0 (d16-7/025fde9)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: 83105ba
    Java.Interop: xamarin/java.interop/d16-7@1f3388a
    ProGuard: Guardsquare/proguard/proguard6.2.2@ebe9000
    SQLite: xamarin/sqlite/3.32.1@1a3276b
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-7@017078f


Xamarin.iOS and Xamarin.Mac SDK   14.2.0.12 (e0ce49680)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Build Logs

Screenshots

Reproduction Link

https://github.com/krmWorkAccnt/iOSBugWithViewUpdatingAfterLoading

Workaround

using AddRange to populate an ObservableRangeCollection that is bound to a collectionView

@krmWorkAccnt krmWorkAccnt added s/unverified New report that has yet to be verified t/bug 🐛 labels Feb 14, 2021
@krmWorkAccnt krmWorkAccnt changed the title iOS bug view not updating correctly when bound to view model and updating view controls after view loads iOS bug view not updating correctly when Collection View is bound to an Observable Range Collection and visibility of view is set to true once collection loads Feb 14, 2021
@hartez hartez removed the s/unverified New report that has yet to be verified label Feb 16, 2021
@hartez hartez self-assigned this Feb 16, 2021
@Deepfreezed
Copy link

Deepfreezed commented Feb 23, 2021

Looks like this is fixed in 5.0.0.2012 but now it's drawing both Empty and Item view #13794

@jfversluis
Copy link
Member

Going to trust this is fixed then, we have a PR open for the other mentioned issue. If it's not, feel free to ping me or open a new issue and reference this one. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants