Project

General

Profile

Actions

Improvement #11077

open

New Feature #10220: Redesigned windows agent

IPC between UWP app and Windows Service

Added by Navod Zoysa 5 months ago. Updated about 2 months ago.

Status:
QA
Priority:
Critical
Assignee:
Start date:
20/05/2024
Due date:
09/08/2024 (59 days late)
% Done:

100%

Estimated time:
Device Type:
Windows
Component:
Windows Agent
Type:
Windows

Description

In the current agent iteration the desktop agent app needs to be opened to sync pending operations and to start a remote screen share session. Since this is not ideal in production the pending operations need to be synced with the background service app and the desktop app should be opened from the background service to initiate a remote screen share session.

Actions #1

Updated by Navod Zoysa 5 months ago

  • Description updated (diff)
  • Due date set to 27/05/2024
  • Priority changed from None to High
  • Start date changed from 26/04/2024 to 13/05/2024
  • Device Type set to Windows
Actions #2

Updated by Navod Zoysa 5 months ago

  • Status changed from New to Implementation
  • % Done changed from 0 to 10
Actions #3

Updated by Navod Zoysa 4 months ago

  • Due date changed from 27/05/2024 to 31/05/2024
  • Start date changed from 13/05/2024 to 20/05/2024
  • % Done changed from 10 to 20
Actions #4

Updated by Navod Zoysa 4 months ago

  • Due date changed from 31/05/2024 to 05/06/2024
Actions #5

Updated by Navod Zoysa 4 months ago

  • Subject changed from Open Windows desktop agent app from background service app to Open UWP app from Windows Service
  • Due date changed from 05/06/2024 to 10/06/2024
  • % Done changed from 20 to 30

Current attempted approaches to open the UWP app from Windows service

1. Open a powershell instance through the Windows service and execute command to open the UWP app through it's app alias [1]
2. Since the UWP did not open with the above approach. Created a WPF app [2] and opened it through the Windows service. This WPF will try to open/communicate with the UWP app to start a remote share session

Due to the Windows service is running as a system process it does not have access to trigger interactive processes (anything UI related). To bypass this restriction we can create a new process under the currently logged in user from the system process and use that to do whatever is needed from the user's context [3]

[1] - https://blogs.windows.com/windowsdeveloper/2017/07/05/command-line-activation-universal-windows-apps/
[2] - https://learn.microsoft.com/en-us/visualstudio/get-started/csharp/tutorial-wpf
[3] - https://www.codeproject.com/Articles/35773/Subverting-Vista-UAC-in-Both-32-and-64-bit-Archite

Actions #6

Updated by Navod Zoysa 4 months ago

  • % Done changed from 30 to 50

Previously the new process created under the currently logged in user from the Windows Service had elevated privileges, this made the UWP app not load. It is now currently creating a new process without elevated privileges under the current user and passing the command line arguments to open the UWP app from anywhere in the Windows Service when we want to.

Due to this, the console app and the WPF app mentioned previously are removed from the project solution.

Actions #7

Updated by Navod Zoysa 4 months ago

  • Due date changed from 10/06/2024 to 13/06/2024
  • % Done changed from 50 to 60
Actions #8

Updated by Navod Zoysa 4 months ago

  • % Done changed from 60 to 70
Actions #9

Updated by Navod Zoysa 4 months ago

  • Due date changed from 13/06/2024 to 19/06/2024

There is an issue with the release agent build where the IPC (Inter-Process Communication) between the UWP app and the background service is not working. There are no error logs found or the apps do not crash. This issue is currently investigated by using message tracing and logging [1] in the Windows Communication Foundation (WCF) service. These logs are readable through the Microsoft Service Trace Viewer tool [2] which is quite different to the carbon logs.

[1] - https://learn.microsoft.com/en-us/dotnet/framework/wcf/samples/tracing-and-message-logging
[2] - https://learn.microsoft.com/en-us/dotnet/framework/wcf/service-trace-viewer-tool-svctraceviewer-exe

Actions #10

Updated by Navod Zoysa 3 months ago

  • Due date changed from 19/06/2024 to 28/06/2024
Actions #11

Updated by Navod Zoysa 3 months ago

  • Due date changed from 28/06/2024 to 05/07/2024
  • Status changed from Implementation to On hold
Actions #12

Updated by Navod Zoysa 3 months ago

  • Component set to Windows Agent
Actions #13

Updated by Navod Zoysa 2 months ago

  • Subject changed from Open UWP app from Windows Service to IPC between UWP app and Windows Service
  • Due date changed from 05/07/2024 to 09/08/2024
Actions #14

Updated by Navod Zoysa 2 months ago

  • Status changed from On hold to Implementation
Actions #15

Updated by Navod Zoysa 2 months ago

  • Priority changed from High to Critical
Actions #16

Updated by Navod Zoysa 2 months ago

  • % Done changed from 70 to 80

Problem was identified as network isolation restriction for services running on localhost [1] which is where the WCF service is hosted.

Solution is to run this command [2] on each enrolled device to allow the UWP app to communicate with the WCF server hosted on the Windows Service. But this does not look like a practical solution. Further research will be done to see if there is a better approach.

[1] - https://learn.microsoft.com/en-us/windows/uwp/communication/interprocess-communication#loopback
[2] - https://github.com/microsoft/WindowsAppSDK/issues/113#issuecomment-868414733

Actions #17

Updated by Navod Zoysa about 2 months ago

  • Status changed from Implementation to QA
  • % Done changed from 80 to 100
Actions

Also available in: Atom PDF