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.24k stars 1.76k forks source link

Hot Reload setting a Dynamic Resource does not make it Dynamic #24218

Open chabiss opened 3 months ago

chabiss commented 3 months ago

Description

This is a ported bug from AzDo Hot Reload setting a Dynamic Resource does not make it Dynamic

Steps to Reproduce

Affected Branch: main Affected Build: 17.12 P2 (35207.17)

Steps to reproduce:

  1. New .NET MAUI App

  2. Mainpage.xaml

    Red
  3. Mainpage.xaml.cs private void Button_Clicked(object sender, EventArgs e) { this.Resources.Remove("foo"); this.Resources.Add("foo", Color.FromArgb("#ff00ff")); }

  4. Run the app, click button

Expected / Actual: Button dynamically updates background color to purple

  1. MainPage.xaml - Remove BackgroundColor Property
  2. Debug the app
  3. With Hot Reload Active Ctrl+Z or type BackgroundColor="{DynamicResource foo}"

Expected / Actual: Button changes to Red

  1. Click the button

Expected: Button dynamically updates background color to purple Actual: Button remains Red

Link to public reproduction project repository

No response

Version with bug

8.0.80 SR8

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

8.0.80 SR8

Affected platforms

Windows

Affected platform versions

No response

Did you find any workaround?

No

Relevant log output

N/A
github-actions[bot] commented 3 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

chabiss commented 3 months ago

@StephaneDelcroix , note that if you do you "Full page hot Reload", before step 8, the correct dynamic resource will be applied

RoiChen001 commented 3 months ago

I can repro this issue at Windows platform on the latest 17.12.0 Preview 1.0(8.0.80 &8.0.72).