Skip to content

[ .NET Hot Reload / EnC ] A failed Binding Path will always fail even after fixing it by Applying Code Changes  #5177

Open
@spadapet

Description

@spadapet
  • .NET Core Version: 6.0.100-preview.7.21379.14
  • Windows version: 21H1 19043.1165
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
  • Is this bug related specifically to tooling in Visual Studio: Not really

Problem description:

Once a Binding Path fails, it will always fail even when it should succeed after applying code changes (I guess failures are cached).

There is no need to use XAML to repro this, but here is a simple way to explain it using XAML:

  • <Button Content="{Binding MyContent}" />

If that "MyContent" property doesn't exist on the DataContext, the Binding will fail, which makes sense. But if that "MyContent" property gets added using Hot Reload or Edit and Continue, then any new Binding that also uses the path "MyContent" will always fail even when they shouldn't.

REPRO:

  1. Open this project in VS 16.11 or 17 latest builds:
    ConsoleApp4-Binding.zip
  2. Build and debug that app with Edit and Continue enabled (the default)
  3. Notice this dialog:
    image
  4. In VS, in the Program.cs file, uncomment the only commented line to add a property called "BarBindToValue":
    image
  5. Click OK in the dialog to re-run the binding logic

Actual behavior:
No change even though the new Binding("BarBindToValue") should succeed:
image

Expected behavior:
Both bindings should work after applying code changes and clicking OK:
image

Minimal repro:
I'll just show the complete sample code here. The circled Bindings are the important part. The second binding will fail once, then it should succeed after applying code changes. But it will fail again:

image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions