Skip to content

Exception occurs when setting ExtendsContentIntoTitleBar to true #10494

@toto45638

Description

@toto45638

Describe the bug

When setting ExtendsContentIntoTitleBar to true on a window that is not the main window, and enabling native debugging, an exception is thrown and the app crashes.
This issue does not occur in version 1.6, but it started happening from version 1.7.
WinUI3 with C#

Steps to reproduce the bug

  1. Right-click the project name and select "Properties", then turn "Enable native code debugging" to ON.

Image

  1. Appxaml.cs
namespace MyCrashSample
{
    public partial class App : Application
    {
        public App()
        {
            this.InitializeComponent();
        }

        protected override async void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
        {
            SplashScreen splash_screen = new();
            splash_screen.Activate();

            await Task.Delay( 100 );

            this.m_window = new MainWindow();
            this.m_window.Activate();

            splash_screen?.Close();
        }

        private Window? m_window;
    }
}
  1. Create a SplashWindow separately from the main window. The code is as follows:
    Set ExtendsContentIntoTitleBar to true.
namespace MyCrashSample
{
    public sealed partial class SplashScreen : Window
    {
        public SplashScreen()
        {
            this.InitializeComponent();
            this.ExtendsContentIntoTitleBar = true;
        }
    }
} 
  1. Run the app. An exception is thrown immediately on launch. If it doesn't happen on the first try, it will occur after a few attempts.

Exception thrown at 0x00007FFF0313933A (in AtoDeKesu.exe): Microsoft C++ exception: winrt::hresult_error (memory location 0x000000139FF9DBF0).

Expected behavior

No response

Screenshots

No response

NuGet package version

Windows App SDK 1.7.0: 1.7.250310001

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 24H2

IDE

Visual Studio 2022

Metadata

Metadata

Assignees

No one assigned

    Labels

    Crashwhenever user reports a crash or app freezearea-AppWindow

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions