dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.24k stars 1.76k forks source link

XAML loader fails after new element added in project #25705

Open kenspencer8996 opened 1 week ago

kenspencer8996 commented 1 week ago

Description

This is a .net 8 maui build. I have been working on this for months. I added new content and it blew up with Parent must be parent error. breakoint stopped at was xamloader.

Steps to Reproduce

open project F5

Link to public reproduction project repository

https://github.com/kenspencer8996/CityScapeApp.git

Version with bug

8.0.92 SR9.2

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

No response

Affected platforms

Windows

Affected platform versions

windows 11 .net 8

Did you find any workaround?

Yes Change a;; xaml to c# code.

Relevant log output

No response

ninachen03 commented 1 week ago

When I open the project and press F5, the following error appears. Is this the error you mentioned? Image

dotnet-policy-service[bot] commented 1 week ago

Hi @kenspencer8996. 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.

drasticactions commented 6 days ago

@kenspencer8996 The error is correct, the bug is in your code:

If you posted the entire exception message, you would have seen it said:

"Parent of a Page must also be a Page"

https://github.com/kenspencer8996/CityScapeApp/blob/master/Views/CityscapeStreets.xaml#L48

https://github.com/kenspencer8996/CityScapeApp/blob/master/Views/Controls/MenuLayoutControl.xaml.cs#L3

MenuLayoutControl is a ContentPage but should instead be a ContentView. Switch that to be a ContentView and it should load correctly.

Also, note that this is unrelated to Windows. If you fix the build to get it running on iOS/Android/Catalyst, it will show the same error.

dotnet-policy-service[bot] commented 2 days ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.