-
Notifications
You must be signed in to change notification settings - Fork 716
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
x:Bind Pathless Casting (this) references cause source generator error #7893
Comments
Thanks for the report! Would you have the exact type that was bound? We're looking for an exact repro, as previous ones we got were not successful. |
It's my own type implemented in my project: public partial class MyClass : ObservableObject
{ With a couple of simple properties (string and custom enum), nothing more. It is being built using the new MVVM Toolkit source generators (initially V1, now V2), so maybe there's a conflict between the two source generators somehow? (If you're not seeing it with regular types?) Though I tried switching it to a regular If I remove the pathless cast to the whole type, and instead use a specific property, then I don't get the error message. |
Thanks for the update! Yes it may seem that the parser is not handling this very well. Note for contributorsThis is the location of the parser tests: uno/src/SourceGenerators/Uno.UI.SourceGenerators.Tests/Given_XBindRewriter.cs Lines 10 to 31 in bb3f815
|
I think this is for any types of parentheses; so not just pathless casting, but for attached properties as well (i.e. uno only looking for function and casting scenarios):
Hit above in labs trying to use our helpers in the Toolkit for size binding. From the official docs, see https://learn.microsoft.com/windows/uwp/xaml-platform/x-bind-markup-extension#attached-properties
|
…dorner Highlighter example work Hit Uno bug unoplatform/uno#7893 for x:Bind though.
Current behavior
Was using pathless casting in UWP data template to bind to the 'this' object of the data template:
This gave me the following error when trying to run in WASM:
Switching out to old-style
{Binding}
syntax allowed me to compile.Expected behavior
Should accept the pathless casting syntax for x:Bind.
How to reproduce it (as minimally and precisely as possible)
No response
Workaround
Switch x:Bind pathless cast to Binding if only doing direct. Not sure if there's the same issue for function binding which I'm not sure how you'd work around.
Works on UWP/WinUI
Yes
Environment
Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia
NuGet package version(s)
4.0.11
Affected platforms
WebAssembly
IDE
Visual Studio 2022
IDE version
17.0.5
Relevant plugins
No response
Anything else we need to know?
No response
The text was updated successfully, but these errors were encountered: