microsoft / microsoft/microsoft-ui-xaml

Enum DependencyProperties fail in Hot Reload

Open
#9,887 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-HotReload bug team-Core team-Markup
Dominant language
C++
Stars
8.4k
Forks
942
Avg merge
2d 7h
Merged PRs (30d)
105

Description

Describe the bug

When a dependency property is an enum and bound to the UI - during live running of the app, any change made to the enum is accepted correctly, but the UI fails (control assumes that property is now null) and the IDE says it cannot convert the enum to a valid entry.

Error message in logs:
Exception thrown at 0x7598A942 in Heic Viewer.exe: Microsoft C++ exception: Microsoft::VisualStudio::DesignTools::UwpTap::LiveMarkup::LiveMarkupError at memory location 0x0077E4DC

Steps to reproduce the bug

public enum MyEnum
{
OptionOne,
OptionTwo,
OptionThree
}

public class MyCustomControl : Control
{
public static readonly DependencyProperty MyEnumProperty =
DependencyProperty.Register(
nameof(MyEnum),
typeof(MyEnum),
typeof(MyCustomControl),
new PropertyMetadata(MyEnum.OptionOne)
);

public MyEnum MyEnum
{
    get { return (MyEnum)GetValue(MyEnumProperty); }
    set { SetValue(MyEnumProperty, value); }
}

public MyCustomControl()
{
    this.DefaultStyleKey = typeof(MyCustomControl);
}

}

Expected behavior

As we don't have a visual designer, the expected behavour is that the live hot reload works, allowing changes to the code/xaml to not require a "close app", recompile, deploy, and run, to test changes.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.5.5: 1.5.240627000

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository files or tests are named. Start by reproducing the enum DependencyProperty case from the issue in a WinUI 3 app on Windows App SDK 1.5.5, then trace the Hot Reload/live markup path associated with the reported LiveMarkupError. Done means enum edits are applied without the UI treating the property as null or reporting a conversion error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, csharp
Domain
desktop, developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.