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

AppWindow.Presenter is not OverlappedPresenter on Net 9 and PublishAot=true #1930

Open
optsing opened this issue Feb 20, 2025 · 1 comment
Open

Comments

@optsing
Copy link

optsing commented Feb 20, 2025

Describe the bug

AppWindow.Presenter is not recognized as or casted to OverlappedPresenter when changing the framework from Net 8 to Net 9 with PublishAot=true

Steps to reproduce the bug

  1. Create new WindowsAppSdk project
  2. Write something like myButton.Content = AppWindow.Presenter is OverlappedPresenter ? "Yes" : "No"; in MainWindow.xaml.cs
  3. Publish with net8.0-windows10.0.19041.0 (default) and PublishAot=true - “Yes” is displayed on the button
  4. Change TargetFramework to net9.0-windows10.0.19041.0 and publish aot - "No" is on the button

Expected behavior

The result should be the same

Screenshots

No response

NuGet package version

Windows App SDK 1.6.3: 1.6.250108002

Packaging type

Unpackaged

Windows version

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

IDE

Visual Studio 2022

Additional context

If you add AppWindow.Presenter.As<OverlappedPresenter>(); somewhere even without using the result, it fixes the type check and cast

@RDMacLachlan RDMacLachlan transferred this issue from microsoft/WindowsAppSDK Feb 21, 2025
@dongle-the-gadget
Copy link
Contributor

Duplicate of #1860.

Workaround is to use .As<T>()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants