microsoft / Windows-Packaging-Samples

Windows Application Packaging Project Samples.
MIT License
56 stars 38 forks source link

Element not found. (Exception from HRESULT: 0x80070490) #14

Closed iamshiao closed 2 years ago

iamshiao commented 2 years ago

After cloned the repo I tried to run the WPF and ran into

An unhandled exception of type 'System.Exception' occurred in WpfUIWithBackgroundTask.exe Additional information: Element not found. (Exception from HRESULT: 0x80070490)

While BackgroundTaskRegistration.AllTasks.Select

public List<string> GetRegisteredTasks()
{
    return BackgroundTaskRegistration.AllTasks.Select(t => t.Value.Name).ToList<string>();
}

I'm using VS2019 and had 1803/17134 Windows SDK installed.

iamshiao commented 2 years ago

I should use WPFUIWithBackgroundTask.Package as startup project