-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[XC] Fallback to reflection-based bindings for bindings with "invalid" path #24238
Merged
PureWeen
merged 4 commits into
dotnet:net9.0
from
simonrozsival:fallback-for-bindings-with-non-compilable-path
Aug 27, 2024
Merged
[XC] Fallback to reflection-based bindings for bindings with "invalid" path #24238
PureWeen
merged 4 commits into
dotnet:net9.0
from
simonrozsival:fallback-for-bindings-with-non-compilable-path
Aug 27, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StephaneDelcroix
previously approved these changes
Aug 20, 2024
rmarinho
previously requested changes
Aug 22, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/AutomationProperties.xaml(9,4): XamlC warning XC0618: Property, Property setter or BindableProperty "Name" is deprecated. [/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj]
/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/AutomationProperties.xaml(10,4): XamlC warning XC0618: Property, Property setter or BindableProperty "HelpText" is deprecated. [/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj]
/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/AutomationProperties.xaml(12,4): XamlC warning XC0618: Property, Property setter or BindableProperty "LabeledBy" is deprecated. [/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj]
/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Issues/Maui17484.xaml(10,17): XamlC warning XC0618: Property, Property setter or BindableProperty "Name" is deprecated. [/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj]
/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/WarnOnObsolete.xaml(6,25): XamlC warning XC0618: Property, Property setter or BindableProperty "ObsoleteBP" is deprecated. [/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj]
/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/WarnOnObsolete.xaml(6,42): XamlC warning XC0618: Property, Property setter or BindableProperty "ObsoleteProp" is deprecated. [/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj]
/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/WarnOnObsolete.xaml(6,61): XamlC warning XC0618: Property, Property setter or BindableProperty "ObsoletePropSetter" is deprecated. [/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj]
/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/BindingsCompiler.xaml(28,20): XamlC error XC0045: Binding: Property "GlobalText" not found on "System.Object". [/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj]
/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/BindingsCompiler.xaml : XamlC error : Index (zero based) must be greater than or equal to zero and less than the size of the argument list. [/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj]
/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Issues/Gh2517.xaml(6,12): XamlC error XC0045: Binding: Property "MissingProperty" not found on "Microsoft.Maui.Controls.Label". [/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj]
/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Issues/Gh2517.xaml : XamlC error : Index (zero based) must be greater than or equal to zero and less than the size of the argument list. [/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj]
/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Issues/Gh3606.xaml(4,16): XamlC error XC0045: Binding: Property "Content" not found on "System.String". [/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj]
/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Issues/Gh3606.xaml : XamlC error : Index (zero based) must be greater than or equal to zero and less than the size of the argument list. [/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj]
/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Issues/Maui20768.xaml(6,32): XamlC error XC0045: Binding: Property "Title" not found on "Microsoft.Maui.Controls.Xaml.UnitTests.ViewModel20768". [/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj]
/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Issues/Maui20768.xaml : XamlC error : Index (zero based) must be greater than or equal to zero and less than the size of the argument list. [/Users/builder/azdo/_work/2/s/src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj]
7 Warning(s)
8 Error(s)
simonrozsival
force-pushed
the
fallback-for-bindings-with-non-compilable-path
branch
from
August 23, 2024 12:11
1ab6e2c
to
c42cefe
Compare
/rebase |
github-actions
bot
force-pushed
the
fallback-for-bindings-with-non-compilable-path
branch
from
August 24, 2024 22:58
c42cefe
to
7a819a3
Compare
StephaneDelcroix
approved these changes
Aug 27, 2024
samhouts
added
the
fixed-in-net9.0-nightly
This may be available in a nightly release!
label
Aug 27, 2024
samhouts
added
fixed-in-9.0.0-rc.2.24503.2
and removed
fixed-in-net9.0-nightly
This may be available in a nightly release!
labels
Oct 14, 2024
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change
We've improved binding optimizations in .NET 9 and it is now possible to compile all sorts of bindings that weren't supported in .NET 8 and earlier. This change can break existing code though:
Source
but it inherits thex:DataType
from the parent, there can often be a mismatch between thex:DataType
and the type of theSource
{Binding BindingContext.Title Source={x:Reference ...}}
). Since we don't support casting in the path, XamlC won't be able to correctly resolve and build the property chain (in the exampleBindingContext
is of typeobject
and it doesn't have any propertyTitle
).While there are workarounds to these issues, it might be better to just fallback to a reflection-based binding that will resolve the actual properties at runtime in these cases to keep the apps working and produce a warning so that the developer can either choose to ignore it or address it. Feedback is very welcome.
I recommend hiding whitespace changes when looking at the code diff.
Issues Fixed
Fixes #23711