@@ -44,6 +44,7 @@ public class HostAppEntry : IEquatable<HostAppEntry>, IComparable<HostAppEntry>
44
44
public HostAppEntry (
45
45
string kind , // 'host', or the Edge browser kind 'browser', 'renderer', and so on.
46
46
string exePath , // Path to the host app executable
47
+ string commandLine , // Command line of the process
47
48
int pid , // PID of the host app process
48
49
int parentPid , // PID of the parent process
49
50
string sdkPath , // Path to a WebView2 SDK DLL
@@ -54,6 +55,7 @@ public HostAppEntry(
54
55
{
55
56
Kind = kind ;
56
57
ExecutablePath = exePath == null ? "Unknown" : exePath ;
58
+ CommandLine = commandLine ;
57
59
PID = pid ;
58
60
ParentPID = parentPid ;
59
61
SdkInfo = new SdkFileInfo ( sdkPath , interestingLoadedDllPaths ) ;
@@ -87,6 +89,7 @@ public string DisplayLabel
87
89
public string ExecutablePath { get ; private set ; }
88
90
public string ExecutableName => Path . GetFileName ( ExecutablePath ) ;
89
91
public string ExecutablePathDirectory => Path . GetDirectoryName ( ExecutablePath ) ;
92
+ public string CommandLine { get ; private set ; }
90
93
public int PID { get ; private set ; } = 0 ;
91
94
public int ParentPID { get ; private set ; } = 0 ;
92
95
public string PIDAndStatus =>
@@ -395,6 +398,7 @@ private static IEnumerable<HostAppEntry> AddRuntimeProcessInfoToHostAppEntriesBy
395
398
pidToRuntimeHostAppEntry [ pid ] = currentProcessEntry = new HostAppEntry (
396
399
userDataPathAndProcessType . Item2 ,
397
400
msedgewebview2Process . MainModule . FileName ,
401
+ userDataPathAndProcessType . Item3 ,
398
402
msedgewebview2Process . Id ,
399
403
parentProcess . Id ,
400
404
null ,
@@ -420,6 +424,7 @@ private static IEnumerable<HostAppEntry> AddRuntimeProcessInfoToHostAppEntriesBy
420
424
HostAppEntry newHostAppEntry = new HostAppEntry (
421
425
"host" ,
422
426
hostAppEntry . ExecutablePath ,
427
+ "" ,
423
428
hostAppEntry . PID ,
424
429
0 ,
425
430
hostAppEntry . SdkInfo . Path ,
@@ -458,19 +463,27 @@ private static IEnumerable<HostAppEntry> GetHostAppEntriesFromMachineByProcessMo
458
463
List < HostAppEntry > results = new List < HostAppEntry > ( ) ;
459
464
foreach ( Process process in Process . GetProcesses ( ) )
460
465
{
461
- var interestingDllPaths = ProcessUtil . GetInterestingDllsUsedByPid ( process . Id ) ;
462
- if ( interestingDllPaths . Item1 != null || interestingDllPaths . Item2 != null )
466
+ try
463
467
{
464
- results . Add ( new HostAppEntry (
465
- "host" ,
466
- process . MainModule . FileName ,
467
- process . Id ,
468
- 0 ,
469
- interestingDllPaths . Item2 ,
470
- ClientDllPathToRuntimePath ( interestingDllPaths . Item1 ) ,
471
- null ,
472
- interestingDllPaths . Item3 ,
473
- 0 ) ) ;
468
+ var interestingDllPaths = ProcessUtil . GetInterestingDllsUsedByPid ( process . Id ) ;
469
+ if ( interestingDllPaths . Item1 != null || interestingDllPaths . Item2 != null )
470
+ {
471
+ results . Add ( new HostAppEntry (
472
+ "host" ,
473
+ process . MainModule . FileName ,
474
+ "" ,
475
+ process . Id ,
476
+ 0 ,
477
+ interestingDllPaths . Item2 ,
478
+ ClientDllPathToRuntimePath ( interestingDllPaths . Item1 ) ,
479
+ null ,
480
+ interestingDllPaths . Item3 ,
481
+ 0 ) ) ;
482
+ }
483
+ }
484
+ catch ( Exception e )
485
+ {
486
+ Debug . WriteLine ( "Unable to get app entry (" + process . Id + ") from machine by process module: " + e . Message ) ;
474
487
}
475
488
}
476
489
return results ;
@@ -525,6 +538,7 @@ public static IEnumerable<HostAppEntry> GetHostAppEntriesFromMachineByPipeEnumer
525
538
hostAppEntries . Add ( new HostAppEntry (
526
539
"host" ,
527
540
process . MainModule . FileName ,
541
+ "" ,
528
542
process . Id ,
529
543
0 ,
530
544
sdkDllPath ,
@@ -605,6 +619,7 @@ private static IEnumerable<HostAppEntry> AddRuntimeProcessInfoToHostAppEntriesBy
605
619
var runtimeEntry = new HostAppEntry (
606
620
"host" ,
607
621
hostAppEntry . ExecutablePath ,
622
+ "" ,
608
623
hostAppEntry . PID ,
609
624
0 ,
610
625
hostAppEntry . SdkInfo . Path ,
@@ -616,6 +631,7 @@ private static IEnumerable<HostAppEntry> AddRuntimeProcessInfoToHostAppEntriesBy
616
631
runtimeEntry . Children . Add ( new HostAppEntry (
617
632
userDataPathAndProcessType . Item2 ,
618
633
runtimeProcess . MainModule . FileName ,
634
+ userDataPathAndProcessType . Item3 ,
619
635
runtimeProcess . Id ,
620
636
runtimeEntry . PID ,
621
637
null ,
@@ -706,6 +722,7 @@ private static IEnumerable<HostAppEntry> AddRuntimeProcessInfoToHostAppEntriesBy
706
722
var runtimeEntry = new HostAppEntry (
707
723
"host" ,
708
724
hostAppEntry . ExecutablePath ,
725
+ "" ,
709
726
hostAppEntry . PID ,
710
727
0 ,
711
728
hostAppEntry . SdkInfo . Path ,
@@ -716,6 +733,7 @@ private static IEnumerable<HostAppEntry> AddRuntimeProcessInfoToHostAppEntriesBy
716
733
runtimeEntry . Children . Add ( new HostAppEntry (
717
734
userDataPathAndProcessType . Item2 ,
718
735
runtimeProcess . MainModule . FileName ,
736
+ userDataPathAndProcessType . Item3 ,
719
737
runtimeProcess . Id ,
720
738
runtimeEntry . PID ,
721
739
null ,
@@ -775,9 +793,10 @@ private static string ClientDllPathToRuntimePath(string clientDllPath)
775
793
return null ;
776
794
}
777
795
778
- public static Tuple < string , string > GetUserDataPathAndProcessTypeFromProcessViaCommandLine ( Process process )
796
+ public static Tuple < string , string , string > GetUserDataPathAndProcessTypeFromProcessViaCommandLine ( Process process )
779
797
{
780
- CommandLineUtil . CommandLine commandLine = new CommandLineUtil . CommandLine ( process . GetCommandLine ( ) ) ;
798
+ string commandLineAsString = process . GetCommandLine ( ) ;
799
+ CommandLineUtil . CommandLine commandLine = new CommandLineUtil . CommandLine ( commandLineAsString ) ;
781
800
string processType = commandLine . GetKeyValue ( "--type" ) ;
782
801
string userDataPath = commandLine . GetKeyValue ( "--user-data-dir" ) ;
783
802
@@ -795,7 +814,7 @@ public static Tuple<string, string> GetUserDataPathAndProcessTypeFromProcessViaC
795
814
processType = "browser" ;
796
815
}
797
816
798
- return new Tuple < string , string > ( userDataPath , processType ) ;
817
+ return new Tuple < string , string , string > ( userDataPath , processType , commandLineAsString ) ;
799
818
}
800
819
}
801
820
}
0 commit comments