Skip to content

Bug: Cannot cast some of the UWP activation arguments using dotnet as operator #1860

Open
@lhak

Description

@lhak

Description

This is related to microsoft/microsoft-ui-xaml#9983 (comment)

When publishing a UWP project using the preview .net 9 support with AOT, I noticed a crash when an appservice from a win32 helper tries to connect. It turns out that casting the argument (args.TaskInstance.TriggerDetails) in the BackgroundActivated(BackgroundActivatedEventArgs args) activation method to AppServiceTriggerDetails fails using the dotnet as operator. However, it works using args.TaskInstance.TriggerDetails.As<AppServiceTriggerDetails>().

Steps To Reproduce

A project that uses background activation through an appservice with a win32 helper is needed. The project also has to be published with AOT in release mode by creating an msix package (it sometimes worked in Debug configuration).

Expected Behavior

Casting using dotnet operator should work

Version Info

cswinrt 2.1.16
dotnet 9 rc2

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions