Edge Extension Native Messaging: UWP application is closed if the response is not sent back to Edge browser / Extension

Each Edge browser request requires an appropriate response to send. If not, then the accompanying UWP (and the associated Win32 application, if any) will exit with a link to "SystemPolicy". To illustrate this problem, I can refer to SecureInput .

    /// <summary>
    /// Receives message from Extension (via Edge)
    /// </summary>
    private async void OnAppServiceRequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args)
    {
        AppServiceDeferral messageDeferral = args.GetDeferral();

        try
        {
            if (this.desktopBridgeAppLaunched)
            {
                this.currentConnectionIndex = Int32.Parse(sender.AppServiceName);
                this.desktopBridgeConnection = desktopBridgeConnections[this.currentConnectionIndex];

                // Send message to the desktopBridge component and wait for response
                AppServiceResponse desktopBridgeResponse = await this.desktopBridgeConnection.SendMessageAsync(args.Request.Message);
                await args.Request.SendResponseAsync(desktopBridgeResponse.Message);
            }
            else
            {
                throw new Exception("Failed to launch desktopBridge App!");
            }
        }
        finally
        {
            messageDeferral.Complete();
        }
    }

After commenting on the line that calls "SendResponseAsync (...)", UWP and the Win32 application (PasswordInputProtection.exe) exit because the OnAppServicesCanceled (...) handler is called with a SystemPolicy cause.

, . , Edge Extension. SendMessageAsync (...) Win32 UWP.

, , , , ACK UWP. , , - ?

+4
1

Edge . . , ​​ .

, !

+1

Source: https://habr.com/ru/post/1690069/


All Articles