Skip to content

Why doesn't the code generated by UWP's App.xaml contain the LoadComponent method #10381

@Gaoyifei1011

Description

@Gaoyifei1011

Describe the bug

Why doesn't the code generated by UWP's App.xaml contain the LoadComponent method

------------------------------------

为什么 UWPApp.xaml 生成的代码没有包含 LoadComponent 方法


Image

如图片所示,WinUI 3(左侧)的 App.xaml 生成的代码 WinUIApp.g.i.cs 包含 LoadComponent 方法,可以加载对应的 App.xaml 文件,但在 UWP(右侧) 中却没有包含相应的实现,如果在 Xaml islands 中,将 App.xaml 修改成其他名称(比如 TestApp.xaml),应用程序在启动时会因为找不到资源而失败

As shown in the picture, the code generated by App.xaml of WinUI 3 (left) contains the LoadComponent method, which can load the corresponding App.xaml file, but the corresponding implementation is not included in UWP (right). If you change App.xaml to something else in Xaml islands, such as TestApp.xaml, the application will fail at startup because the resource cannot be found

Steps to reproduce the bug

See description

Expected behavior

Add the LoadComponent method in app.g.i.cs (the corresponding code implementation of App.xaml)

-------------------------

App.g.i.cs 中(App.xaml 相应的代码实现)添加 LoadComponent 方法

Screenshots

See description

NuGet package version

WinUI 3 - Windows App SDK 1.6.5: 1.6.250205002

Windows version

Windows Insider Build (xxxxx), Windows 11 (24H2): Build 26100

Additional context

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingclosed-ByDesignDescribed behavior is by design.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions