Reputation: 41
Every request from Edge browser needs a corresponding response to be sent. If not, the companion UWP(and the associated Win32 App, if any) exit citing "SystemPolicy" as the reason. To illustrate the problem, I can refer to the SecureInput sample.
/// <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();
}
}
By commenting out the line that calls "SendResponseAsync(...)", the UWP and the Win32 App(PasswordInputProtection.exe) are exiting because of the "OnAppServicesCanceled(...)" handler being invoked with SystemPolicy reason.
I understand that for this particular example, it's meaningless not to send a response back. But I have scenarios where there's no need send a response back to the Edge Extension. Instead, I intend to use SendMessageAsync(...) from the Win32 App to communicate with the Extension through the UWP App.
Also, I noticed that the native messaging samples I found online send at-least a useless ACK message back to the Extension from the UWP. So, Is it by design that a response needs to be sent or am I missing something here?
Upvotes: 4
Views: 556
Reputation: 13850
The Edge team has investigated this and confirmed it's a bug in one of their components. They are working on a fix for the next update. Until the fix is out, you will need to always send a response.
Thanks for reporting the problem, and sorry for the inconvenience this may cause!
Upvotes: 1