Description
- .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:
- Open this project in VS 16.11 or 17 latest builds:
ConsoleApp4-Binding.zip - Build and debug that app with Edit and Continue enabled (the default)
- Notice this dialog:
- In VS, in the Program.cs file, uncomment the only commented line to add a property called "BarBindToValue":
- Click OK in the dialog to re-run the binding logic
Actual behavior:
No change even though the new Binding("BarBindToValue") should succeed:
Expected behavior:
Both bindings should work after applying code changes and clicking OK:
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: