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
[regression/8.0.0-rc.1.9171] Build error in .NET 8 RC1 - "XamlC error XFC0126: Resources in ResourceDictionary require a x:Key attribute" for resources that have a key #17461
Comments
I get this same issue if I try to use in my App.Xaml file. But it seems to work if I do use a static resource as the value as the following works:
While this does not work and gives the error mentioned before.
Another side note that might be related is that when using a merged resource dictionary another error appears when using namely: So in my App.xaml file I have
and in a separate file MyAppTheme
Im Running on a Mac and compiling for iOS |
I was not able to reproduce this with the given project. It builds and runs with RC1. Is there more required? |
Hi @brunck. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
@samhouts It definitely does not build for me using the latest VS 2022 preview. Just open and try to build the solution in the |
Verified this on Visual Studio Enterprise 17.8.0 Preview 2.0(8.0.0-rc.1.9171). Repro with the given project: |
the |
I can not reproduce this. which platform are you compiling for ? |
This is single-project MAUI…how do you compile for just one platform? Android I guess? |
Oh, that's strange. If I hit F5, it builds and runs successfully. If I just do Build, it fails. Confirmed that this regressed between 8.0.0-preview.7.8842 and 8.0.0-rc.1.9171. #5611 looks sus, @StephaneDelcroix |
That’s very strange! I don’t think I’ve ever seen or heard of this type of thing happening before. |
trying again to produce a unit test... |
As reported in #17461, OnPlatform simplification cause some issues - while used as a Resource (#17461, unable to unit test for now) - doesn't type convert. On nodes shouldn't be replaced by the Value, but an element node (<On Platform="..." Value="Red" /> should generate <Color x:Key="foo">Red</Color>. right now it only generated "Red" - fixes #17461
As reported in #17461, OnPlatform simplification cause some issues - while used as a Resource (#17461, unable to unit test for now) - doesn't type convert. On nodes shouldn't be replaced by the Value, but an element node (<On Platform="..." Value="Red" /> should generate <Color x:Key="foo">Red</Color>. right now it only generated "Red" - fixes #17461
As reported in #17461, OnPlatform simplification cause some issues - while used as a Resource (#17461, unable to unit test for now) - doesn't type convert. On nodes shouldn't be replaced by the Value, but an element node (<On Platform="..." Value="Red" /> should generate <Color x:Key="foo">Red</Color>. right now it only generated "Red" - fixes #17461
As reported in #17461, OnPlatform simplification cause some issues - while used as a Resource (#17461, unable to unit test for now) - doesn't type convert. On nodes shouldn't be replaced by the Value, but an element node (<On Platform="..." Value="Red" /> should generate <Color x:Key="foo">Red</Color>. right now it only generated "Red" - fixes #17461
As reported in #17461, OnPlatform simplification cause some issues - while used as a Resource (#17461, unable to unit test for now) - doesn't type convert. On nodes shouldn't be replaced by the Value, but an element node (<On Platform="..." Value="Red" /> should generate <Color x:Key="foo">Red</Color>. right now it only generated "Red" - fixes #17461
As reported in #17461, OnPlatform simplification cause some issues - while used as a Resource (#17461, unable to unit test for now) - doesn't type convert. On nodes shouldn't be replaced by the Value, but an element node (<On Platform="..." Value="Red" /> should generate <Color x:Key="foo">Red</Color>. right now it only generated "Red" - fixes #17461
As reported in #17461, OnPlatform simplification cause some issues - while used as a Resource (#17461, unable to unit test for now) - doesn't type convert. On nodes shouldn't be replaced by the Value, but an element node (<On Platform="..." Value="Red" /> should generate <Color x:Key="foo">Red</Color>. right now it only generated "Red" - fixes #17461
* [X] revert #5611 As reported in #17461, OnPlatform simplification cause some issues - while used as a Resource (#17461, unable to unit test for now) - doesn't type convert. On nodes shouldn't be replaced by the Value, but an element node (<On Platform="..." Value="Red" /> should generate <Color x:Key="foo">Red</Color>. right now it only generated "Red" - fixes #17461 * disable failing test --------- Co-authored-by: Stephane Delcroix <stephane@delcroix.org>
Description
Using version
8.0.100-rc.1.23455.8
Building a .NET MAUI app created using RC1 and VS 2022 preview via File -> New Project and adding the given lines errors with
XamlC error XFC0126: Resources in ResourceDictionary require a x:Key attribute.
This appears to be a regression; the same code worked in .NET 8 preview 7.
Steps to Reproduce
App.xaml
file:Or, use the solution in the given reproduction repository in the
MauiResourceDictionaryBuildError
folder.Link to public reproduction project repository
https://github.com/brunck/reproductions.git
Version with bug
8.0.0-rc.1.9171
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
8.0.0-preview.7.8842
Affected platforms
I was not able test on other platforms
Affected platform versions
n/a
Did you find any workaround?
Removing the related lines causes the build to pass.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: