@@ -27,7 +27,6 @@ private static async Task Main()
27
27
if ( AppInstance . RecommendedInstance != null )
28
28
{
29
29
AppInstance . RecommendedInstance . RedirectActivationTo ( ) ;
30
- await TerminateUwpAppInstance ( proc . Id ) ;
31
30
return ;
32
31
}
33
32
else if ( activatedArgs is LaunchActivatedEventArgs )
@@ -49,7 +48,6 @@ private static async Task Main()
49
48
var plInstance = AppInstance . GetInstances ( ) . First ( x => x . Key . Equals ( PrelaunchInstanceKey ) ) ;
50
49
ApplicationData . Current . LocalSettings . Values [ "WAS_PRELAUNCH_INSTANCE_ACTIVATED" ] = true ;
51
50
plInstance . RedirectActivationTo ( ) ;
52
- await TerminateUwpAppInstance ( proc . Id ) ;
53
51
return ;
54
52
}
55
53
else
@@ -59,7 +57,6 @@ private static async Task Main()
59
57
if ( ! instance . IsCurrentInstance && ! string . IsNullOrWhiteSpace ( launchArgs . Arguments ) )
60
58
{
61
59
instance . RedirectActivationTo ( ) ;
62
- await TerminateUwpAppInstance ( proc . Id ) ;
63
60
return ;
64
61
}
65
62
}
@@ -75,7 +72,6 @@ private static async Task Main()
75
72
if ( ! instance . IsCurrentInstance )
76
73
{
77
74
instance . RedirectActivationTo ( ) ;
78
- await TerminateUwpAppInstance ( proc . Id ) ;
79
75
return ;
80
76
}
81
77
}
@@ -87,7 +83,6 @@ private static async Task Main()
87
83
if ( ! instance . IsCurrentInstance )
88
84
{
89
85
instance . RedirectActivationTo ( ) ;
90
- await TerminateUwpAppInstance ( proc . Id ) ;
91
86
return ;
92
87
}
93
88
}
@@ -127,6 +122,8 @@ private static async Task Main()
127
122
if ( ! instance . IsCurrentInstance )
128
123
{
129
124
instance . RedirectActivationTo ( ) ;
125
+ // Terminate "zombie" Files process which remains in suspended state
126
+ // after redirection when launched by command line
130
127
await TerminateUwpAppInstance ( proc . Id ) ;
131
128
return ;
132
129
}
@@ -146,26 +143,6 @@ public static async Task OpenShellCommandInExplorerAsync(string shellCommand, in
146
143
await FullTrustProcessLauncher . LaunchFullTrustProcessForCurrentAppAsync ( ) ;
147
144
}
148
145
149
- public static async Task SpawnUnelevatedUwpAppInstance ( int pid )
150
- {
151
- IActivatedEventArgs activatedArgs = AppInstance . GetActivatedEventArgs ( ) ;
152
- if ( activatedArgs is CommandLineActivatedEventArgs cmdLineArgs )
153
- {
154
- var parsedCommands = CommandLineParser . ParseUntrustedCommands ( cmdLineArgs . Operation . Arguments ) ;
155
- switch ( parsedCommands . FirstOrDefault ( ) ? . Type )
156
- {
157
- case ParsedCommandType . ExplorerShellCommand :
158
- case ParsedCommandType . OpenDirectory :
159
- case ParsedCommandType . OpenPath :
160
- ApplicationData . Current . LocalSettings . Values [ "Folder" ] = parsedCommands [ 0 ] . Payload ;
161
- break ;
162
- }
163
- }
164
- ApplicationData . Current . LocalSettings . Values [ "Arguments" ] = "StartUwp" ;
165
- ApplicationData . Current . LocalSettings . Values [ "pid" ] = pid ;
166
- await FullTrustProcessLauncher . LaunchFullTrustProcessForCurrentAppAsync ( ) ;
167
- }
168
-
169
146
public static async Task TerminateUwpAppInstance ( int pid )
170
147
{
171
148
ApplicationData . Current . LocalSettings . Values [ "Arguments" ] = "TerminateUwp" ;
0 commit comments