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

OOP Background task not firing in MAUI app for Windows on .NET 8 and .NET 9 #27919

Open
Mvk3aJKQh opened this issue Feb 20, 2025 · 5 comments
Open
Labels
area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) platform/windows 🪟 s/needs-attention Issue has more information and needs another look s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@Mvk3aJKQh
Copy link

Description

The sample provided here by Microsoft is for WPF on .NET 6, and the background task works as expected. However, following the instructions in the README.md file for a MAUI app for Windows on .NET 8 and .NET 9 doesn't function. The task registration is recognized by Visual Studio in the lifecyle events menu, but it doesn't fire when selected, nor on the device TimeZoneChange trigger as expected. The README.md file does say "The packaging app is required for hosting out-of-process WinRT components." However, the "Create a Windows MSIX package." option is selected in this .NET 8 project, and was also selected in the .NET 9 project, though each project handles that setting a bit differently.

Steps to Reproduce

  1. Deploy solution from repository (Be sure to read the README file)

Link to public reproduction project repository

https://github.com/Mvk3aJKQh/BackgroundTaskNET8

Version with bug

9.0.14 SR1.4

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

No response

Affected platforms

Windows

Affected platform versions

Windows 10 build 19045.5487

Did you find any workaround?

No, currently not functional.

Relevant log output

@Mvk3aJKQh Mvk3aJKQh added the t/bug Something isn't working label Feb 20, 2025
@Mvk3aJKQh Mvk3aJKQh changed the title Background task not firing in MAUI app for Windows on .NET 8 and .NET 9 OOP Background task not firing in MAUI app for Windows on .NET 8 and .NET 9 Feb 20, 2025
@RoiChen001 RoiChen001 added s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage platform/windows 🪟 labels Feb 20, 2025
@RoiChen001
Copy link

RoiChen001 commented Feb 20, 2025

I can repro this issue at Windows platform on the latest 17.14.0 Preview 1.0(9.0.40 & 9.0.14 & 8.0.100).
Image

@Mvk3aJKQh
Copy link
Author

The payload bug isn't what I was reporting, though it should also be fixed. The bug I'm reporting is with the background task not firing. If you believe the issue results from this payload bug, then great. Otherwise, there still is the issue with the background task not firing.

@drasticactions
Copy link
Contributor

Can you get your sample to work with a standard WinUI app? I don't believe this will be MAUI specific, outside of the default deployment for .NET 9 apps for MAUI WinUI is Unpackaged.

@drasticactions drasticactions added the s/needs-info Issue needs more info from the author label Feb 20, 2025
@rmarinho rmarinho added the area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) label Feb 20, 2025
@Mvk3aJKQh
Copy link
Author

Mvk3aJKQh commented Feb 21, 2025

Same problem in WinUI3 with and without a packaging project. Same payload bug, and same issue not firing the background task. However, Visual Studio is showing the registered background task in the lifecycle events menu in both solutions. Here is the repository with both WinUI3 solutions with and without a packaging project.

@dotnet-policy-service dotnet-policy-service bot added s/needs-attention Issue has more information and needs another look and removed s/needs-info Issue needs more info from the author labels Feb 21, 2025
@Bricobit
Copy link

Any solution for this? I've been banging my head against the wall for a week trying to get background tasks and notifications on Windows and Android and I can't do it, it's very frustrating. I'm on the preview version of Visual Studio Community MAUI .NET 9 and there's nothing, no nugget that works for both platforms, and if I program it specifically for each platform I can't do it either, I don't know what else to try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-publishing Issues with the app packaging/publishing process (ipk/apk/msix/trimming) platform/windows 🪟 s/needs-attention Issue has more information and needs another look s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants