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

XAMLC error in .NET 9 Preview 5 #22975

Closed
davidortinau opened this issue Jun 11, 2024 · 12 comments
Closed

XAMLC error in .NET 9 Preview 5 #22975

davidortinau opened this issue Jun 11, 2024 · 12 comments
Assignees
Labels
area-xaml XAML, CSS, Triggers, Behaviors fixed-in-9.0.0-preview.6.24327.7 high It doesn't work at all, crashes or has a big impact. platform/android 🤖 platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst potential-regression This issue described a possible regression on a currently supported version., verification pending Priority:0 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@davidortinau
Copy link
Contributor

Description

https://github.com/davidortinau/AllTheLists

    /Users/davidortinau/work/AllTheLists/src/Pages/VirtualizedListViewPage.xaml(13,14): XamlC error XC0009: No property, BindableProperty, or event found for "ItemTemplate", or mismatching type between value and property.
    /Users/davidortinau/work/AllTheLists/src/Pages/VirtualListViewPage.xaml(12,14): XamlC error XC0009: No property, BindableProperty, or event found for "ItemTemplate", or mismatching type between value and property.

https://github.com/davidortinau/AllTheLists/blob/main/src/Pages/VirtualListViewPage.xaml#L14

Works in .NET 9 Preview 4. Getting this error on Preview 5. Same ContentView works fine in CollectionView and ListView but is throwing errors in these other controls. Maybe it's not that view at all, but the implementation of those controls.

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

Unknown/Other

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

9.0.0-preview.4.10690

Affected platforms

iOS, Android, macOS

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

@davidortinau davidortinau added the t/bug Something isn't working label Jun 11, 2024
Copy link
Contributor

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@simonrozsival
Copy link
Member

From what I can tell we're failing to compare type references because for some reason one of them is imported in the MPowerKit module:
image

@Redth
Copy link
Member

Redth commented Jun 11, 2024

Something is odd here that it's showing DataTemplate for the baseClass coming from the MPowerKit.VirtualizeListView module. Looking at that assembly, I do not see any duplicated types, so what would be causing it to appear as though it's imported from that module?

@egvijayanand
Copy link
Contributor

All my custom ContentPage inherited XAML definitions are resulting in XAMLC errors.

When I surround the XAML with the ContentPage's Content node, it compiles. In that case, all my customization is not working.

Understand it's a Preview release but the basic scenario itself is failing. UT needs to be strengthened further.

@kevinxufei kevinxufei added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jun 12, 2024
@kevinxufei
Copy link

Verified this issue on VS Code 1.90.0 (9.0.0-preview.5.24307.10). Can repro it with sample project.

@jsuarezruiz jsuarezruiz added this to the Backlog milestone Jun 12, 2024
@Redth Redth modified the milestones: Backlog, 9.0-preview6 Jun 12, 2024
@Redth Redth added potential-regression This issue described a possible regression on a currently supported version., verification pending high It doesn't work at all, crashes or has a big impact. Priority:0 labels Jun 12, 2024
@Redth
Copy link
Member

Redth commented Jun 12, 2024

It seems this may be due to a change in the runtime. We are currently investigating this and have some ideas of how we can at least mitigate it in the short term.

@RobbiewOnline
Copy link

I also experienced this issue, it propagated as a compiler error for the MAUI community toolkit, whilst compiling.

XC0009 No property, BindableProperty, or event found for "Content", or mismatching type between value and property.

<?xml version="1.0" encoding="utf-8" ?>
<toolkit:Popup xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
               xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
               xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
               x:Class="MyTeamSafe.Views.ProgressPopup">
    <VerticalStackLayout HorizontalOptions="Center" VerticalOptions="Center" BackgroundColor="Purple">
        <ActivityIndicator IsRunning="True" />
        <Label Text="{Binding Message}" />
    </VerticalStackLayout>

</toolkit:Popup>

My temporary workaround was to switch the TargetFramework from

<TargetFrameworks>net9.0-android</TargetFrameworks>

to

<TargetFrameworks>net8.0-android</TargetFrameworks>

But I'm now installing dotnet SDK 9 preview 4 and referencing that from my global.json file to force my project to use preview 4 instead of preview 5

{
  "sdk": {
    "INFO": "From command line type  `dotnet --list-sdks` to get the list of installed dotnet SDKs",
    "version": "9.0.100-preview.4.24267.66"
  }
}

@egvijayanand
Copy link
Contributor

XC0009 No property, BindableProperty, or event found for "Content", or mismatching type between value and property.

Could you try enclosing the VerticalStackLayout with an explicit Content property tag, which might work?

<toolkit:Popup.Content>
<!-- Everything in-betwen -->
</toolkit:Popup.Content>

@RobbiewOnline
Copy link

Could you try enclosing the VerticalStackLayout with an explicit Content property tag, which might work?

I'm sorry, but this doesn't fix it.

@egvijayanand
Copy link
Contributor

This crude method works.

Define an intermediate base class and modify your Popups to inherit from it.

public class MauiPopup : Popup
{
    public override View? Content
    {
        get => base.Content;
        set => base.Content = value;
    }
}

@PureWeen PureWeen added the area-xaml XAML, CSS, Triggers, Behaviors label Jun 20, 2024
@davidortinau
Copy link
Contributor Author

Another example of this:

https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/views/expander

<mct:Expander>
    <mct:Expander.Header>
        <Label Text="Baboon"
               FontAttributes="Bold"
               FontSize="Medium" />
    </mct:Expander.Header>
    <HorizontalStackLayout Padding="10">
        <Image Source="http://upload.wikimedia.org/wikipedia/commons/thumb/f/fc/Papio_anubis_%28Serengeti%2C_2009%29.jpg/200px-Papio_anubis_%28Serengeti%2C_2009%29.jpg"
               Aspect="AspectFill"
               HeightRequest="120"
               WidthRequest="120" />
        <Label Text="Baboons are African and Arabian Old World monkeys belonging to the genus Papio, part of the subfamily Cercopithecinae."
               FontAttributes="Italic" />
    </HorizontalStackLayout>
</mct:Expander>

@davidortinau
Copy link
Contributor Author

davidortinau commented Jun 21, 2024

Tested 8.0.70-ci.net8.24320.1 and I'm no longer seeing the error. A result of #23031 being merged?

Nightly 9.0.0-preview.5.24307.10 still generates the error. In both cases building with net9.0-ios.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-xaml XAML, CSS, Triggers, Behaviors fixed-in-9.0.0-preview.6.24327.7 high It doesn't work at all, crashes or has a big impact. platform/android 🤖 platform/iOS 🍎 platform/macOS 🍏 macOS / Mac Catalyst potential-regression This issue described a possible regression on a currently supported version., verification pending Priority:0 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

10 participants