Skip to content

Setting SystemTrigger or ApplicationTrigger as background task triggers throws exception when registering #3840

@Diegorro98

Description

@Diegorro98

Describe the bug

I'm looking to create Win32 COM background task with Time, System and Application Triggers. Time works, but when System or Application triggers are set, calling BackgroundTaskBuilder.Register throws the following exception

System.Runtime.InteropServices.COMException: "Incompatible request (0x80070032)"

Steps to reproduce the bug

In BackgroundTaskWinMainComSample/CS project from DesktopBridgeToUWP-Sample repository I'm able to replicate the issue.

Only thing needed to update is at MainWindow.xaml.cs:172, change the Time trigger by any of the others mentioned:

RegisterBackgroundTaskWithSystem(new SystemTrigger(SystemTriggerType.SessionConnected, false), typeof(TimeTriggeredTask).GUID, typeof(TimeTriggeredTask).Name);
RegisterBackgroundTaskWithSystem(new ApplicationTrigger(), typeof(TimeTriggeredTask).GUID, typeof(TimeTriggeredTask).Name);

Expected behavior

It should be able to register the task and triggers should work.

Screenshots

No response

NuGet package version

Windows App SDK 1.4.0: 1.4.230822000

Packaging type

Packaged (MSIX)

Windows version

Insider Build (xxxxx)

IDE

Visual Studio 2022

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-AppContainerTopics related to AppContainer in Windows App SDK (packaged apps in partial trust environments etc.)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions