Мы пытаемся вызвать Process.Start для URI, чтобы он открыл браузер по умолчанию. Код работает в WPF, но не в WinUI 3, поскольку выдает следующее исключение:
An error occurred trying to start process [the big long authorizationRequest string is shown here...] with working directory 'C:\Windows\system32'. The system cannot find the file specified.
Ссылаясь на этот ответ, я убедился, что приложение работает как x64, но мы все равно получаем исключение.
Какие изменения можно внести чтобы этот код работал на WinUI3?
const string clientID = "581786658708-elflankerquo1a6vsckabbhn25hclla0.apps.googleusercontent.com";
const string clientSecret = "3f6NggMbPtrmIBpgx-MK2xXK";
const string authorizationEndpoint = "https://accounts.google.com/o/oauth2/v2/auth";
const string tokenEndpoint = "https://www.googleapis.com/oauth2/v4/token";
const string userInfoEndpoint = "https://www.googleapis.com/oauth2/v3/userinfo";
// Creates the OAuth 2.0 authorization request.
string authorizationRequest = string.Format("{0}?response_type=code&scope=openid%20profile&redirect_uri={1}&client_id={2}&state={3}&code_challenge={4}&code_challenge_method={5}",
authorizationEndpoint,
System.Uri.EscapeDataString(redirectURI),
clientID,
state,
code_challenge,
code_challenge_method);
// Opens request in the browser.
System.Diagnostics.Process.Start(authorizationRequest);
Подробнее здесь: https://stackoverflow.com/questions/791 ... ot-winui-3