dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.28k stars 1.76k forks source link

Commands do not Properly Enable Buttons in Release Builds (Android) #10825

Open adamjhilton opened 2 years ago

adamjhilton commented 2 years ago

Description

When buttons are bound to an underlying command, everything works fine when compiled for Debug. When compiled for Release, the command's CanExecute() method does not properly redraw the button in accordance with its designated style.

This is an Android specific bug. The behavior is the same when running in an emulator and when sideloaded on a physical device.

When compiling for a Windows Machine, the behavior is as expected.

Steps to Reproduce

  1. Pull the MauiBugs repo with the test app.
  2. Build and run the app in Debug.
  3. Play with the buttons under the 'Button Enabling Visualization Bug' heading.
  4. When the button is enabled, it displays and behaves correctly. image
  5. Build and run the app in Release.
  6. When the button is enabled, it behaves correctly. But it is not displayed correctly. image
  7. The Click Count button's text color is the only thing that changes.

Link to public reproduction project repository

https://github.com/adamjhilton/MauiBugs.git

Version with bug

6.0.400

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 11.0

Did you find any workaround?

I created a second disabled button that draws itself on top of the actual button. I modified the underlying code with an additional flag that the button's IsVisible field is bound to. The command's CanExecute() method always returns true, but the new flag is set appropriately.

Relevant log output

No response

ghost commented 2 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

rachelkang commented 2 years ago

@jonathanpeppers What do you think of this one?

homeyf commented 1 year ago

Verified this issue with Visual Studio Enterprise 17.7.0 Preview 1.0. Not repro on android platform in release mode with above project. https://github.com/adamjhilton/MauiBugs.git image

ghost commented 1 year ago

Hi @adamjhilton. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.

You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

adamjhilton commented 1 year ago

Thanks for the update. This is still broken. Sorry that I commented out the controls for this bug. I thought you were done with it. I've commented them back in. Grab the latest of my repo. See the (#10825) section. Everything behaves in Debug. But when I compile for Release and deploy the app, the button never visibly reenables after it's been disabled and then reenabled.

image

(Side thought: looking at this again, I think that #10825 and #14813 might be the same bug across multiple controls.)

I've updated to the latest version of Visual Studio. Below is the info from the About Microsoft Visual Studio screen:

Microsoft Visual Studio Professional 2022 Version 17.6.2 VisualStudio.17.Release/17.6.2+33723.286 Microsoft .NET Framework Version 4.8.04084

Installed Version: Professional

Visual C++ 2022 00476-80000-00000-AA945 Microsoft Visual C++ 2022

ASP.NET and Web Tools 17.6.326.62524 ASP.NET and Web Tools

Azure App Service Tools v3.0.0 17.6.326.62524 Azure App Service Tools v3.0.0

Azure Functions and Web Jobs Tools 17.6.326.62524 Azure Functions and Web Jobs Tools

C# Tools 4.6.0-3.23259.8+c3cc1d0ceeab1a65da0217e403851a1e8a30086a 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.

Extensibility Message Bus 1.4.21 (main@8f226a8) Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

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

Mono Debugging for Visual Studio 17.6.41 (790a401) Support for debugging Mono processes with Visual Studio.

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

Razor (ASP.NET Core) 17.6.0.2326105+37f2727000f6a964584cafb86e69cf0b39baecb7 Provides languages services for ASP.NET Core Razor.

SQL Server Data Tools 17.6.13.0 Microsoft SQL Server Data Tools

StylerPackage Extension 1.0 StylerPackage Visual Stuido Extension Detailed Info

TypeScript Tools 17.0.20329.2001 TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 4.6.0-3.23259.8+c3cc1d0ceeab1a65da0217e403851a1e8a30086a 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 17.6.0-beta.23174.5+0207bea1afae48d9351ac26fb51afc8260de0a97 Microsoft Visual F# Tools

Visual Studio IntelliCode 2.2 AI-assisted development for Visual Studio.

Visual Studio Spell Check Everywhere VSSpellCheckEverywhere An extension that enables spell checking within any Visual Studio file editor or tool window that uses WPF text boxes. https://GitHub.com/EWSoftware/VSSpellChecker

Visual Studio Spell Checker VSSpellChecker An editor extension that checks the spelling of comments, strings, and plain text as you type or interactively with tool windows. https://GitHub.com/EWSoftware/VSSpellChecker

VisualStudio.DeviceLog 1.0 Information about my package

VisualStudio.Mac 1.0 Mac Extension for Visual Studio

VSPackage Extension 1.0 VSPackage Visual Studio Extension Detailed Info

Xamarin 17.6.0.251 (d17-6@318364c) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 17.6.6.0 (remotes/origin/d17-6@cb430751d1) Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 17.6.32 (98c12a2) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 13.2.0.6 (d17-5/a200af1) Xamarin.Android Reference Assemblies and MSBuild support. Mono: 6dd9def Java.Interop: xamarin/java.interop/d17-5@149d70fe SQLite: xamarin/sqlite/3.40.1@68c69d8 Xamarin.Android Tools: xamarin/xamarin-android-tools/d17-5@9f02d77

Xamarin.iOS and Xamarin.Mac SDK 16.4.0.6 (97731c92c) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

stefanpirkl commented 1 year ago

Still broken on .Net 8 Preview 5.

jenscski commented 1 year ago

Looks like it's fixed in .NET 8 Preview 7

Can this be verified?

stefanpirkl commented 1 year ago

Seems fixed in Preview 7, for the small amount of time I got the release build working. However, Preview 7 introduced new bugs crashing the app on release builds - until I've found workarounds for those, I won't be able to test properly.