Open SongOfYouth opened 7 months ago
Thanks for the report. It seems that the code you're referencing is coming from a Source Generator. This is currently not supported because of https://github.com/unoplatform/uno/issues/12073, which is ultimately caused by https://github.com/dotnet/roslyn/issues/57239.
If you need this to work, you'll need to place your ViewModel classes in a separate library project from the XAML files.
Thanks for the report. It seems that the code you're referencing is coming from a Source Generator. This is currently not supported because of #12073, which is ultimately caused by dotnet/roslyn#57239.
If you need this to work, you'll need to place your ViewModel classes in a separate library project from the XAML files.
I think so too.but problem is the same code which from mvvmtoolkit source generator works well...
[ObeservaleProperty]
string _code;
It works with MVVM Toolkit because Uno has a specific workaround for this library. It does not know about the other generators and can't generate code properly.
Best that can be done here is separating out the ViewModels to a separate project, if possible.
That way, the source generator will be run in the context of a project different than the one XAML generator runs in and things will work. I don't think this is currently fixable.
Another possible workaround is also suggested in https://github.com/unoplatform/uno/issues/12073#issuecomment-1536180900
Current behavior
I have generated the property via![image](https://github.com/unoplatform/uno/assets/30856466/080a4dfe-30ed-42c3-82b3-fbbcbd9f21a4)
IIncrementalGenerator
source generator like this:and bind it in the xaml file:![image](https://github.com/unoplatform/uno/assets/30856466/f739cc99-add9-4095-ba13-5d266d1f6485)
then build, it comes out:
Expected behavior
No response
How to reproduce it (as minimally and precisely as possible)
No response
Workaround
No response
Works on UWP/WinUI
Yes
Environment
No response
NuGet package version(s)
No response
Affected platforms
No response
IDE
Visual Studio 2022
IDE version
No response
Relevant plugins
No response
Anything else we need to know?
What i have bound to the Text of TextBox is property
Code
, but the error points to the ViewModel type converting fail.