-
Notifications
You must be signed in to change notification settings - Fork 388
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
[BUG] 2 Projects in a solution gives Cannot resolve type "http://schemas.microsoft.com/dotnet/2022/maui/toolkit:SetFocusOnEntryCompletedBehavior". #991
Comments
This isn't a bug... By design to use the custom schema you need to reference anything on CommunityToolkit using C#. Your
or adding some reference using C# public SamplePage()
{
InitializeComponent();
_ = new CommunityToolkit.Maui.Behaviors.AnimationBehavior();
} You can read more about it here |
@pictos thank you very much for your time and reply your workaround works, but I have to say that this is a big MAUI xml definitions limitation!. In the real world people used shared libraries and they have more than 1 project, this is not a problem in Xamarin. Again thanks Lastly |
Sadly the underlying issue is with the XAML compiler. There has been an ongoing issue for some time to look into it but I think it's considered too difficult or low priority to get fixed. |
@bijington thanks for the extra info.. this maui is really turning into a nightmare .... |
It took a while to find but this was the issue I was referring to It hasn't been open for as long as I thought but I am not expecting too much to happen on it. It does look like some level of compiler or linker ripping out the reference when it doesn't believe any of it is actually used. This is why the workaround suggested by @pictos will tell the compiler that it is used. This is not a new issue to .NET MAUI as we have had to deal with this pain on the Xamarin Community Toolkit also |
hmmm for some reasons I didnt notice in XF but we had most of the converters prior the community toolkit and the main thing we use/used in XF was shimmering and toucheffect |
@gabsamples6 for XCT we used a SourceGenerator to create the C# code for you secretly, on MCT we rely on |
@pictos oh that explains it then... and I guess UseCommunityToolkit might not be as clever... as XCT .. its annoying but your suggestions works.. |
Yeah, the reason is that this package is designed to be in the mobile app project and not in a |
@pictos What do you think about adding a public api like It could basically just be a dummy method that doesn't execute anything but ensures that the Linker doesn't remove CommunityToolkit.Maui when used in a library: namespace CommunityToolkit.Maui;
public static class LibrarySupport
{
public static void Initialize()
{
var date = DateTime.Now;
}
} |
@brminnick I suggest doing anything that can make people feel comfortable about using MCT on libs... Give me some time I'll open a discussion with some scenarios that could be dangerous, that way we can discuss that and see if makes sense to make MCT lib friendly or not |
Hi just to say brilliant. This will be definitely needed as more people embrace maui , and as soon as framework like prism becomes RTM where there is a concept of modules (libs) than it will be very much needed as people will get errors as soon as they trying to use converters etc... Remember lots of big projects are not embracing maui because its reputation and stability at the moment - as soon they do than they will need this workaround embedded. |
@pictos We appreciate if you give a work around to make MCT work on libs. |
Is there an existing issue for this?
Did you read the "Reporting a bug" section on Contributing file?
Current Behavior
Hi I was really excited to start working with the maui toolkit, and I hope is something I have missed.
If you have a single project all works fine and you dont see the issue , but in a real world project where my main projects reference other Maui class libraries with views and models that are shared you get the error,
Expected Behavior
You should be able to use MCT with many projects and not just a single one. You would not be able to use with Prism Modules or any maui class library that has views in it
Steps To Reproduce
Error XFC0000 Cannot resolve type "http://schemas.microsoft.com/dotnet/2022/maui/toolkit:SetFocusOnEntryCompletedBehavior".
Link to public reproduction project repository
https://github.com/gabsamples6/MauiAppSampleMCT
Environment
Anything else?
I really appreciate the work you guys do for FREE.. If you could easily spot where its going wrong and issue a release that would be fantastic.
We cannot use this library till this is sorted
Many thanks
gab
The text was updated successfully, but these errors were encountered: