Skip to content
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

Adding version 8.2.2 to existing Maui project breaks xaml file(s) #875

Open
4 tasks
rkreisel opened this issue May 7, 2024 · 1 comment
Open
4 tasks
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior

Comments

@rkreisel
Copy link

rkreisel commented May 7, 2024

Describe the bug

I had a working project using the that was not using the CommunityToolkit.






It built and ran fine.
I added the CommunityToolkit







and now the build throws this error:
"Input string was not in the correct format"
It points to line 1 of the mainpage.xaml file.

Regression

No response

Steps to reproduce

.net 8
Maui project 
VS 2022
Fairly simple app that retrieves information from a web service and formats it on the device.
Ensure it works without the toolkit. 

Add the toolkit and attempt to build.
I get the error noted above.

Add the following to the main page.
<ContentPage
other stuff...
xmlns:mct="http://schemas.microsoft.com/dotnet/2022/maui/toolkit">
    <ContentPage.Behaviors>
        <mct:EventToCommandBehavior Command="{Binding AppearingCommand}" EventName="Appearing" />
    </ContentPage.Behaviors>

... other xaml
</ContentPage>

<ContentPage.Behaviors>
        <mct:EventToCommandBehavior Command="{Binding AppearingCommand}" EventName="Appearing" />
    </ContentPage.Behaviors>

Try the build again to get the message telling you to change the startup.

Change the MauiProgram start to include the toolkit:
	public static MauiApp CreateMauiApp()
	{
		var builder = MauiApp.CreateBuilder();
		builder
			.UseMauiApp<App>()
			.ConfigureFonts(fonts =>
			{
				fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
			});
		builder.Services.Add... blah blah blah other services
        return builder.Build();
	}

Build again - get an error telling you you need implement the target method in the viewmodel.cs
Implement it per the instructions here: https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/behaviors/event-to-command-behavior

Build again and get the original error.

Expected behavior

I was trying to implement loading of the data when the app starts, but cannot get past the xml error. So the expected behavior would have been to load the data when the app started.

Screenshots

No response

IDE and version

VS 2022

IDE version

Version 17.9.6

Nuget packages

  • CommunityToolkit.Common
  • CommunityToolkit.Diagnostics
  • CommunityToolkit.HighPerformance
  • CommunityToolkit.Mvvm (aka MVVM Toolkit)

Nuget package version(s)

see the bug description above where I pasted in the references

Additional context

I have to caveat this problem with telling you that is is my first Maui app outside of a class. So, I quite possibly am missing something very basic.

Help us help you

Yes, but only if others can assist

@rkreisel rkreisel added the bug 🐛 An unexpected issue that highlights incorrect behavior label May 7, 2024
@rkreisel
Copy link
Author

rkreisel commented May 7, 2024

Hmmm, The stuff I pasted into the bug description area does not seem to have been included. I'll try again.

xmlns:mct="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"

<ContentPage.Behaviors>
<mct:EventToCommandBehavior Command="{Binding AppearingCommand}" EventName="Appearing" />
</ContentPage.Behaviors>

PackageReference Include="CommunityToolkit.Maui" Version="9.0.0" />
PackageReference Include="CommunityToolkit.Maui.Core" Version="9.0.0" />
PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
PackageReference Include="Microsoft.Maui.Controls" Version="8.0.21" />
PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.21" />
PackageReference Include="Microsoft.Maui.Essentials" Version="8.0.21" />
PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.5.1" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior
Projects
None yet
Development

No branches or pull requests

1 participant