CommunityToolkit / CommunityToolkit/dotnet

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

Open
#875 1 comment 0 reactions 0 assignees View on GitHub
bug :bug:
Dominant language
C#
Stars
3.8k
Forks
400
PR merge metrics
No merged PRs in 30d

Description

### 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

```text
.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.



... other xaml


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()
.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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.