Open
Description
Description
I created both a brand new single and multi-app MAUI project, and added System.Diagnostics.Debug.WriteLine(Windows.ApplicationModel.Background.BackgroundTaskRegistration.AllTasks.Count);
to the WinUI App constructor after InitializeComponent();
and it throws this exception. Works for .NET 8, but not for .NET 9. Creating the new project for .NET 8, then selecting .NET 9 for Windows prompts to install the Android SDKs when building.
Steps to Reproduce
- Create a new .NET 9 MAUI project
- Add
System.Diagnostics.Debug.WriteLine(Windows.ApplicationModel.Background.BackgroundTaskRegistration.AllTasks.Count);
to the WinUI App constructor afterInitializeComponent();
- Run
Link to public reproduction project repository
https://github.com/Mvk3aJKQh/COMException-2147023728
Version with bug
9.0.14 SR1.4
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
.NET 8
Affected platforms
Windows
Affected platform versions
Windows 10 build 19045.5371
Did you find any workaround?
No response
Relevant log output
System.Runtime.InteropServices.COMException
HResult=0x80070490
Message=
Source=WinRT.Runtime
StackTrace:
at WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|38_0(Int32 hr)
at WinRT.ExceptionHelpers.ThrowExceptionForHR(Int32 hr)
at ABI.Windows.ApplicationModel.Background.IBackgroundTaskRegistrationStaticsMethods.get_AllTasks(IObjectReference _obj)
at Windows.ApplicationModel.Background.BackgroundTaskRegistration.get_AllTasks()
at Product.Platforms.Windows.App..ctor() in {ProjectPath}\Platforms\Windows\App.xaml.cs:line 11
at Product.Platforms.Windows.Program.<>c.<Main>b__0_0(ApplicationInitializationCallbackParams p) in {OutputPath}\obj\Debug\net9.0-windows10.0.19041.0\win10-x64\Platforms\Windows\App.g.i.cs:line 29
at ABI.Microsoft.UI.Xaml.ApplicationInitializationCallback.Do_Abi_Invoke(IntPtr thisPtr, IntPtr p)
Metadata
Metadata
Assignees
Labels
Issues with code structure, SDK structure, implementation detailsThis issue described a confirmed regression on a currently supported versionTells automation to ask the person to use VS Feedback to report the issueIssue has more information and needs another lookIssue has been reviewedVerified / Reproducible Issue ready for Engineering TriageSomething isn't working