Maui: [BUG] mct:EventToCommandBehavior not found in xmlns http://schemas.microsoft.com/dotnet/2022/maui/toolkit
Is there an existing issue for this?
- I have searched the existing issues
Did you read the “Reporting a bug” section on Contributing file?
- I have read the “Reporting a bug” section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
Current Behavior
I am using your Samples project from this GitHub repo because I was having issues with every version of MauiComminutyToolkit since 9.0.3
When I run your sample project i get the following error when I click on any of the following Behaviors. I did not test them all. But these are not working.
Position 25:18. Type mct:EventToCommandBehavior not found in xmlns http://schemas.microsoft.com/dotnet/2022/maui/toolkit
AnimationBehavior EventToCommandBehavior MaskedBehavior
In my personal project I’m getting the following error
Type toolkit:StatusBarBehavior not found in xmlns http://schemas.microsoft.com/dotnet/2022/maui/toolkit Type toolkit:TextCaseConverter not found in xmlns http://schemas.microsoft.com/dotnet/2022/maui/toolkit Type toolkit:InvertedBoolConverter not found in xmlns http://schemas.microsoft.com/dotnet/2022/maui/toolkit Type toolkit:EventToCommandBehavior not found in xmlns http://schemas.microsoft.com/dotnet/2022/maui/toolkit Type toolkit:IntToBoolConverter not found in xmlns http://schemas.microsoft.com/dotnet/2022/maui/toolkit Type toolkit:IconTintColorBehavior not found in xmlns http://schemas.microsoft.com/dotnet/2022/maui/toolkit
here is my global.json file
{ “sdk”: { “version”: “9.0.101”, “rollForward”: “latestFeature”, “allowPrerelease”: false } }
Expected Behavior
I would expect the behaviors and converters to reference correctly.
Steps To Reproduce
- Run your samples project from this GitHub repo - i added it below as well
- Click on the Flyout
- Select Behaviors
- Click EventToCommandBehavior
Link to public reproduction project repository
https://github.com/jamesv-7/CommunityToolkit-10.0-Issues
Environment
- .NET MAUI CommunityToolkit:
- OS: MAC Sequoia 15.1
- .NET MAUI: 9.0
- XCode 16.1
Anything else?
No response
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 20 (3 by maintainers)
Got it, it has to be
@jamesingreersc Your issue is not related. Here’s the relevant excerpt from the Release Notes to fix your issue:
This actually fixed the issue. Thanks. I’m hoping this is not a band-aide to a much bigger problem in the future. I hope the dev can look into it.
@brminnick We’re having the same problem here with .NET 8.0.404 with all the MCT converters in debug builds on MacOS, but absolutely fine on Windows. Seems to build fine for MacOS on DevOps in Release with the same SDK and workloads.
EDIT: This is with latest 9.x MCT for .NET 8
EDIT2: Seems to be related to linking - if set to ‘Link Framework SDKs Only’, as our debug project is, we get this error. Disabling linking makes MCT work, but then breaks other stuff in the build. Possibly something changed in the SDK? We were previously using 8.0.101 on MacOS 14.x where this worked, but with 8.0.404 on MacOS 15.x it now fails.
EDIT3: Excluding MCT from trimming resolves the issue (FYI @gmwilhelm & @jamesv-7) - add the following to your csproj then make sure to clear your
binandobjfolders:You have a mismatch between types:
Currently you are setting the behaviors
BindingContextto your page but setting theDataTypeto the view model. TheDataTypeneeds to be set to your page type so I matches the type being assigned toBindingContext@bijington Thank you for your confirmation.
I was able to spent more time on it today and got it working. I found these two comments helpful:
Github thread
Redit
My code looks like that: