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

[BUG] Warning when including a ValueConverter starting in .NET MAUI 9 #2205

Closed
2 tasks done
hansmbakker opened this issue Sep 12, 2024 · 11 comments · Fixed by #2215
Closed
2 tasks done

[BUG] Warning when including a ValueConverter starting in .NET MAUI 9 #2205

hansmbakker opened this issue Sep 12, 2024 · 11 comments · Fixed by #2215
Labels
area/converters Issue/Discussion/PR that has to do with Converters bug Something isn't working .NET 9.0 All work required to support .NET 9.0 unverified

Comments

@hansmbakker
Copy link

hansmbakker commented Sep 12, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

Including a Converter from the MAUI Community Toolkit in a .NET MAUI 9 app triggers a warning

When referencing a converter (e.g. from the MAUI Community Toolkit) in XAML, xamlc generates a warning with code XC0103 in .NET 9 RC1. On .NET 8 this warning was not there.

This is especially annoying in projects where TreatWarningsAsErrors is enabled.

⚠️ The warning log below is a sample. However, this is an issue for all converters, not only for this specific IsNullConverter.

XamlC warning XC0103: Consider attributing the markup extension "CommunityToolkit.Maui.Converters.IsNullConverter" with [RequireService] or [AcceptEmptyServiceProvider] if it doesn't require any.

Expected Behavior

ValueConverters from the MAUI Community Toolkit can be included without triggering errors

Steps To Reproduce

  1. Create new MAUI project on .NET 9 RC1
  2. Add a converter to the main page's resources from the MAUI Community Toolkit
  3. Run dotnet build
  4. See the warning

Link to public reproduction project repository

https://github.com/hansmbakker/bugrepro-converter-issue

Environment

- .NET MAUI CommunityToolkit: 9.0.3
- OS:
- .NET MAUI: 9.0 RC1

Anything else?

This is caused by dotnet/maui#19650 / dotnet/maui#19945.

ValueConverters are expected to be attributed by RequireService or AcceptEmptyServiceProvider.

@VladislavAntonyuk
Copy link
Collaborator

We don't currently support .NET 9

@VladislavAntonyuk VladislavAntonyuk closed this as not planned Won't fix, can't repro, duplicate, stale Sep 12, 2024
@bijington
Copy link
Contributor

@VladislavAntonyuk we don't but this might be an issue worth keeping open for when we put in the work? .NET 9 is roughly only 2 months away

@bijington bijington reopened this Sep 12, 2024
@bijington bijington added the .NET 9.0 All work required to support .NET 9.0 label Sep 12, 2024
@daltzctr
Copy link

RC 1 has been out and customers are starting to migrate. This actually seems to break some functionality with converters, so this is pretty critical.

@brminnick
Copy link
Collaborator

Yes, we will provide .NET 9 support when it GAs in November.

@bijington
Copy link
Contributor

RC 1 has been out and customers are starting to migrate. This actually seems to break some functionality with converters, so this is pretty critical.

If you would like to speed things up please feel free to open a branch and submit a draft PR with the required changes

@bijington
Copy link
Contributor

I have created a branch and draft PR here: #2215

There are some errors that I will try to work through but if anyone wants to jump in please feel free

@hansmbakker
Copy link
Author

if anyone wants to jump in please feel free

Good that you started this - can others commit on this branch?

There are some errors

@bijington the SDK being used in the pipeline is the wrong one (it sticks to the .NET 8 one). Please see my comment in the PR for a suggestion.

@bijington
Copy link
Contributor

Non-maintainers probably can't push to this branch but they could open a PR into this branch. That might work well if multiple people get involved.

Thanks for the pointers on the pipeline builds. I'm fighting with getting it compiled locally first 😟

@vhugogarcia vhugogarcia added the area/converters Issue/Discussion/PR that has to do with Converters label Oct 23, 2024
@dhindrik
Copy link

Would be great to have this fixed now when .NET 9 is released.

@DonkeyKongJr
Copy link

Any updates on this? We are almost done with our migration to .NET9 and this is the last stop sign for us.

@bijington
Copy link
Contributor

We are currently blocked by this issue dotnet/maui#25871 although I am hoping to have a look over the weekend

@brminnick brminnick mentioned this issue Nov 22, 2024
6 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Dec 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/converters Issue/Discussion/PR that has to do with Converters bug Something isn't working .NET 9.0 All work required to support .NET 9.0 unverified
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants