Skip to content

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

@optsing

Description

@optsing

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions