-
Notifications
You must be signed in to change notification settings - Fork 348
Exception when launching appsfeatures-app settings uri with LaunchUriAsync #4460
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
Comments
See MicrosoftDocs/winrt-api#1107 - the docs for In an ideal world, we'd update WASDK to include a |
@jonwis Can't get it working. Still exceptions at the launch line. Updated code: winrt::Windows::System::LauncherOptions options;
options.TargetApplicationPackageFamilyName(winrt::Windows::ApplicationModel::Package::Current().Id().FamilyName());
winrt::check_hresult(options.as<::IInitializeWithWindow>()->Initialize(GetHwnd(*this))); /*Get hwnd of this window*/
winrt::Windows::System::Launcher::LaunchUriAsync(
winrt::Windows::Foundation::Uri{ L"ms-settings:appsfeatures-app" },
options
); |
I tested calling LaunchUriAsync() without any options set and it correctly opens the application specific settings for me. I do no think that TargetApplicationPackageFamilyName is actually the optional parameter that the documentation talks about. |
@lhak Now things gets interesting. Directly using |
Aha, correct. Is your app packaged, on both Win10 and Win11? Settings uses the identity of the app-that-does-the-launch to navigate to the right settings page. |
@jonwis Yes, self-packaging winui3 project on both OS. Also if the |
Packaging as in "has package identity" via an MSIX deployment or sparse packaging after an MSI or other installer? The caller must have package identity (which you appear to, per your sample.) For
This property is not specific to Settings. It's a general purpose "I know a specific app - like Visual Studio or Task Manager or Terminal - handles this launch; don't prompt the user to let them pick, and don't guess which one on your own. Launch this one, specifically." There does not appear to be a general-purpose way to launch another app's settings page. You could ask the other app to add a URI that "auto redirects" to settings. |
So I'm curious to know how the Start menu and web-based search lead to the app's Settings page. Are they using some kind of private api? |
The Start Menu just calls ShellExecuteEx on the link ("10 - AppsAndFeatures.lnk" on my Windows 10 OS) |
@jonwis I was using the "winui3 project (packaged)" template from visual studio, and yes it would be packaged to msix, that has a package family name. That's why it doesn't throw exception on the |
I uploaded a sample to demo everything I tried. There is called with parameter, without parameter, and with other apps' family name as parameter, nothing works on Windows 10 17763. |
Ah sorry, I thought you were talking about the "Apps & Features" menu item on right-click on Start Menu (which is not associated with an app) |
On Windows 10, I must set "windows.immersivecontrolpanel_cw5n1h2txyewy" for TargetApplicationPackageFamilyName if I use options |
Describe the bug
I need to launch the settings app to the settings of my app. But I got exceptions and nothing was launched.
The uri is documented here.
Steps to reproduce the bug
App.OnLaunch
Expected behavior
No response
Screenshots
No response
NuGet package version
Windows App SDK 1.5.3: 1.5.240428000
Packaging type
Packaged (MSIX)
Windows version
Windows 11 version 22H2 (22621, 2022 Update)
IDE
Visual Studio 2022
Additional context
No response
The text was updated successfully, but these errors were encountered: