microsoft-ui-xaml icon indicating copy to clipboard operation
microsoft-ui-xaml copied to clipboard

titlebar customization and AppWindowPresenterKind.FullScreen crashes winforms app

Open ivanjx opened this issue 9 months ago • 3 comments

Describe the bug

when trying to enter full screen using the API, i keep experiencing crash on my packaged winforms app (with windowsappsdk nuget installed).

other modes such as Default, CompactOverlay, etc work just fine.

Steps to reproduce the bug

  1. create winforms app
  2. setup to use windows app sdk
  3. create msix installer project and reference the winforms app
  4. create a button
// in the form.
    AppWindow GetAppWindow()
    {
        return AppWindow.GetFromWindowId(
            Win32Interop.GetWindowIdFromWindow(this.Handle));
    }

// in the button.
GetAppWindow().SetPresenter(AppWindowPresenterKind.FullScreen);

Expected behavior

no crash

Screenshots

No response

NuGet package version

Windows App SDK 1.6.6: 1.6.250228001

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 24H2 (22621, October 2024 Update)

IDE

Visual Studio 2022

Additional context

No response

ivanjx avatar Mar 18 '25 14:03 ivanjx

ok after hours of finding out the problem i finally got the true trigger of this bug. make sure to set the titlebar color to something custom and it will crash on fullscreen.

ivanjx avatar Mar 18 '25 19:03 ivanjx

reproducible on sample winforms app both on unpackaged and packaged mode.

https://github.com/user-attachments/assets/92f97a3b-6252-4a06-aeb1-d296519ca841

ivanjx avatar Mar 18 '25 19:03 ivanjx

seems to work after upgrading the winappsdk nuget to 1.7 but i still can see a minor glitch when entering full screen if the titlebar is customized.

i think i will leave this open until the glitch is fixed.

ivanjx avatar Mar 19 '25 10:03 ivanjx