xamarin / Xamarin.Forms

Xamarin.Forms is no longer supported. Migrate your apps to .NET MAUI.
https://aka.ms/xamarin-upgrade
Other
5.62k stars 1.87k forks source link

[Bug] VisualStateManager with RadioButton stops responding over time #14126

Open CZEMacLeod opened 3 years ago

CZEMacLeod commented 3 years ago

Description

When using a VisualStateManager to style radio buttons with IsChecked bound, they work at first, but then stop responding to bound value changes.

Steps to Reproduce

Minimal example at CZEMacLeod/RadioButtonIssue Run the example. At first each channel radio button highlights in turn as the model is updated. After some time (30s or more) the buttons slowly stop highlighting when the model changes. They still 'check' in response to UI interaction.

Expected Behavior

The radio buttons continually update their visual state.

Actual Behavior

Over time, the radio buttons stop updating their visual state in response to the bound model.

Basic Information

Microsoft Visual Studio Professional 2019
Version 16.9.3
VisualStudio.16.Release/16.9.3+31129.286
Microsoft .NET Framework
Version 4.8.04161

Installed Version: Professional

Visual C++ 2019   00435-60000-00000-AA650
Microsoft Visual C++ 2019

.ignore   1.2.77
A language service that makes it painless to handle all types of .ignore files such as .gitignore, .tfignore, etc.

.NET Portability Analyzer   1.1.10808.0
Evaluates portability of assemblies across .NET platforms.

ADL Tools Service Provider   1.0
This package contains services used by Data Lake tools

ASA Service Provider   1.0

ASP.NET and Web Tools 2019   16.9.693.2781
ASP.NET and Web Tools 2019

ASP.NET Core Razor Language Services   16.1.0.2112521+5741df381174d72f08e3632bb99f52e8635b6a1a
Provides languages services for ASP.NET Core Razor.

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

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

Azure App Service Tools v3.0.0   16.9.693.2781
Azure App Service Tools v3.0.0

Azure Data Lake Node   1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio   2.6.3000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools   16.9.693.2781
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio   2.6.3000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

Browser Reload on Save   1.1.30
A Visual Studio extension for ASP.NET projects that leverages Browser Link to to reload all connected browsers when files are saved in Visual Studio.

Bundler & Minifier   3.2.467
Adds support for bundling and minifying JavaScript, CSS and HTML files in any project.

C# Tools   3.9.0-6.21160.10+59eedc33d35754759994155ea2f4e1012a9951e3
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Clear MEF Component Cache   1.4
Clears the Visual Studio MEF component cache to fix issues with cache corruption.

Code Converter   1.0
Code Converter Extension Details

Command Explorer   1.0.9999
Provides a tool window to explorer all commands, groups and menus to help extension authors place commands/buttons in the desired location

Command Task Runner   1.3.68
Adds support for command line batch files in Visual Studio 2015's Task Runner Explorer. Supports .cmd, .bat, .ps1 and .psm1 files.

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

CSS Tools 2019   1.1.4
Provides additional features to the CSS editor in Visual Studio.

Developer News   0.6.68
Always stay up to date with developer news from the Visual Studio team and other sources right within Visual Studio or your default browser.

EditorConfig Language Service   1.17.288
Language service for .editorconfig files.

EditorConfig helps developers define and maintain consistent coding styles between different editors and IDEs.

Entity Framework 6 Power Tools   0.9.2
Preview of useful design-time DbContext features, added to the Visual Studio Solution Explorer context menu.

When right-clicking on a file containing a derived DbContext class, the following context menu functions are supported:
1) View Entity Data Model (Read-only) - Displays a read-only view of the Code First model in the Entity Model Designer.
2) View Entity Data Model XML - Displays the EDMX XML representing the underlying Code First model.
3) View Entity Data Model DDL SQL - Displays the DDL SQL corresponding to the SSDL in the underlying EDM Model.
4) Generate Views - Generates pre-compiled views used by the EF runtime to improve start-up performance. Adds the generated views file to the containing project.

When right-clicking on an Entity Data Model (*.edmx) file, the following context menu function is supported:
Generate Views - Generates pre-compiled views used by the EF runtime to improve start-up performance. Adds the generated views file to the containing project.

Entity Framework Core Power Tools   2.5
Adds useful design-time EF Core DbContext features to the Visual Studio Solution Explorer context menu. 

Extensibility Logs   1.5.1
Quickest & easiest way to view extensibility logs!

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

Fabric.DiagnosticEvents   1.0
Fabric Diagnostic Events

File Icons   2.7
Adds icons for files that are not recognized by Solution Explorer

File Nesting   2.6.85
Automatically nest files based on file name and enables developers to nest and unnest any file manually

Fine Code Coverage   fcc-f339fe606-9d51-4fca-895c-d50375137b62
Visualize unit test code coverage easily for free in Visual Studio Community Edition (and other editions too)

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

Image Manifest Tools   1.0.5
Makes it easier to create and maintain .imagemanifest files for Visual Studio extension

Image Optimizer   4.0.132
Uses industry standard tools to optimize any JPEG, PNG and Gifs - including animated Gifs. Can do both lossy and lossless optimization.

Image Sprites   1.4.61
Boost your website's performance by creating image sprites to reduce the amount of HTTP requests needed.

Insert Guid   1.0
Makes it super easy to insert a new GUID into any editor and input field

IntelliCode Extension   1.0
IntelliCode Visual Studio Extension Detailed Info

KnownMonikers Explorer   1.2.34
A tool window for Visual Studio extension authors to explore the KnownMonikers image collection

Linux Core Dump Debugging   1.0.9.31112
Enables debugging of Linux core dumps.

Markdown Editor   1.12.253
A full featured Markdown editor with live preview and syntax highlighting. Supports GitHub flavored Markdown.

Microsoft Azure HDInsight Azure Node   2.6.3000.0
HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service   2.6.3000.0
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio   16.0
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service   2.6.3000.0
Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node   1.0
Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.40218.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.113+g422d40002e.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 C++ Wizards   1.0
Microsoft Visual C++ Wizards

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.

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio   16.9.7 (df23ba6)
Support for debugging Mono processes with Visual Studio.

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

Open Command Line   2.4.233
2.4.233

Package Installer   2.0.103
Makes it easier, faster and more convenient than ever to install Bower, npm, Yarn, JSPM, TSD, Typings and NuGet packages to any project

Package Security Alerts   1.0.22
Identifies npm and Bower packages that contains known security vulnerabilities to ensure your project is always using the most secure package versions.

Productivity Power Tools 2017/2019   16.0
Installs the individual extensions of Productivity Power Tools 2017/2019

ProjectConfigurationManager   1.9.3258.0
Information about my package

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

SQL Server Data Tools   16.0.62103.10080
Microsoft SQL Server Data Tools

SVG Viewer   1.0.9
Makes it much easier to work with SVG files by showing a live preview in the bottom-right corner of the code window

Switch Startup Project   4.1.71
Provides a toolbar dropdown box  to switch between startup projects.

Syntax Visualizer   1.0
An extension for visualizing Roslyn SyntaxTrees.

Test Adapter for Boost.Test   1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test.  The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test   1.0
Enables Visual Studio's testing tools with unit tests written for Google Test.  The use terms and Third Party Notices are available in the extension installation directory.

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript Tools   16.0.30201.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   3.9.0-6.21160.10+59eedc33d35754759994155ea2f4e1012a9951e3
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual C++ for Linux Development   1.0.9.31112
Visual C++ for Linux Development

Visual F# Tools   16.9.0-beta.21102.9+7ce7132f1459095e635194d09d6f73265352029a
Microsoft Visual F# Tools

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   1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio Tools for CMake   1.0
Visual Studio Tools for CMake

Visual Studio Tools for Containers   1.0
Visual Studio Tools for Containers

Visual Studio Tools for Kubernetes   1.0
Visual Studio Tools for Kubernetes

VisualStudio.DeviceLog   1.0
Information about my package

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

VSIX Synchronizer   1.0.23
Provides the ability to generate code-behind files for .vsixmanfiest and .vsct files in managed code to make the information easy to consume from the rest of the extension.

Web Compiler   1.12.394
Compiler for LESS, Sass and CoffeeScript files

Web Essentials 2019   0.5.16
The easiest way to set up Visual Studio for the ultimate web development experience.

Xamarin   16.9.000.273 (d16-9@1bba9e0)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   16.9.0.316 (remotes/origin/d16-9@fdbf64026)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   16.9.68 (8e9b569)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   11.2.2.1 (d16-9/877f572)
Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: 5e9cb6d
    Java.Interop: xamarin/java.interop/d16-9@54f8c24
    ProGuard: Guardsquare/proguard/v7.0.1@912d149
    SQLite: xamarin/sqlite/3.34.1@daff8f4
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-9@d210f11

Xamarin.iOS and Xamarin.Mac SDK   14.14.2.5 (3836759d4)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

ZenCoding   1.2.12
Provides ZenCoding for the HTML Editor - full support for static HTML, Razor and WebForms.

Build Logs

Screenshots

Channel 2 working correctly Screenshot_1617895747

Channel 8 working correctly Screenshot_1617895764

Channel 8 failing after some time Screenshot_1617895788

Channel 8 clicked in row 1 (responds to UI interaction, but bound value in row 2 fails to update) Screenshot_1617895793

Reproduction Link

CZEMacLeod/RadioButtonIssue

Workaround

None

Debug output

Thread started: <Thread Pool> #10
Thread started: <Thread Pool> #11
Thread started: <Thread Pool> #12
Thread started: <Thread Pool> #13
Thread started: <Thread Pool> #14
Thread started: <Thread Pool> #15
...
[Mono] DllImport searching in: '__Internal' ('(null)').
[Mono] Searching for 'java_interop_jnienv_call_float_method_a'.
[Mono] Probing 'java_interop_jnienv_call_float_method_a'.
[Mono] Found as 'java_interop_jnienv_call_float_method_a'.
[adiobuttonissu] Explicit concurrent copying GC freed 2560(182KB) AllocSpace objects, 0(0B) LOS objects, 49% free, 1578KB/3MB, paused 330us total 5.419ms
[Mono] GC_TAR_BRIDGE bridges 163 objects 335 opaque 91 colors 163 colors-bridged 163 colors-visible 163 xref 0 cache-hit 0 cache-semihit 0 cache-miss 0 setup 0.02ms tarjan 0.08ms scc-setup 0.03ms gather-xref 0.01ms xref-setup 0.01ms cleanup 0.21ms
[Mono] GC_BRIDGE: Complete, was running for 7.33ms
[Mono] GC_MINOR: (Nursery full) time 3.41ms, stw 4.28ms promoted 1036K major size: 1968K in use: 1236K los size: 2048K in use: 1726K

I thought at first the adiobuttonissu and Mono GC were related, but having run it a few times, I think it stops working correctly before they appear. There is approximately 40 seconds of nothing in the output where ... appears above.

I have also tried without the RadioButtonGroup.SelectedValue="{Binding Channel}" but it still fails the same way. I also tried implementing my own equality converter in case there was something there, but I have traced that and tried with the XCT version but it doesn't seem to make a difference. I also tried it with directly bound properties without a converter with the same result. Notably it appears to affect the last item in the grid row first, and seems to be exacerbated by UI interactions.

CZEMacLeod commented 3 years ago

@jsuarezruiz I was wondering if there is any progress on this, or are all efforts being focused on MAUI?