Skip to content

Commit 74788a9

Browse files
committed
Correct disposal of ShellManager & Bump dependencies
1 parent d5426ed commit 74788a9

11 files changed

Lines changed: 63 additions & 40 deletions

File tree

92 Bytes
Binary file not shown.

GoAwayEdge.slnx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Solution>
2+
<Configurations>
3+
<Platform Name="ARM64" />
4+
<Platform Name="x64" />
5+
<Platform Name="x86" />
6+
</Configurations>
7+
<Project Path="GoAwayEdge.Helper.Package/GoAwayEdge.Helper.Package.wapproj" Type="c7167f0d-bc9f-4e6e-afe1-012c56b48db5">
8+
<Build Project="false" />
9+
<Deploy />
10+
</Project>
11+
<Project Path="GoAwayEdge.Helper/GoAwayEdge.Helper.csproj">
12+
<Platform Solution="*|x64" Project="x64" />
13+
<Platform Solution="*|x86" Project="x86" />
14+
<Build Project="false" />
15+
</Project>
16+
<Project Path="GoAwayEdge/GoAwayEdge.csproj" />
17+
</Solution>

GoAwayEdge/App.xaml.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,42 +51,42 @@ public void Application_Startup(object sender, StartupEventArgs e)
5151
if (IsAdministrator() == false)
5252
{
5353
ElevateAsAdmin();
54-
Environment.Exit(740);
54+
Configuration.SafeShutdown(740);
5555
return;
5656
}
5757

5858
var installer = new UserInterface.Setup.Installer();
5959
installer.ShowDialog();
60-
Environment.Exit(0);
60+
Configuration.SafeShutdown(0);
6161
break;
6262
}
6363
case > 0:
6464
{
6565
if (args.Contains("--debug"))
6666
IsDebug = true;
6767
if (args.Contains("-ToastActivated")) // Clicked on notification, ignore it.
68-
Environment.Exit(0);
68+
Configuration.SafeShutdown(0);
6969
if (args.Contains("--control-panel"))
7070
{
7171
if (IsAdministrator() == false)
7272
{
7373
ElevateAsAdmin(string.Join(" ", args));
74-
Environment.Exit(740);
74+
Configuration.SafeShutdown(740);
7575
return;
7676
}
7777

7878
// Check if user allowed opening the control panel
7979
if (RegistryConfig.GetKey("ControlPanelIsInstalled") != "True")
8080
{
8181
Logging.Log("Control Panel is not allowed on this system, exiting ...", Logging.LogLevel.ERROR);
82-
Environment.Exit(1);
82+
Configuration.SafeShutdown(1);
8383
return;
8484
}
8585

8686
Configuration.InitialEnvironment();
8787
var controlCenter = new UserInterface.ControlPanel.ControlPanel();
8888
controlCenter.ShowDialog();
89-
Environment.Exit(0);
89+
Configuration.SafeShutdown(0);
9090
}
9191

9292
if (args.Contains("--copilot-dock"))
@@ -98,14 +98,14 @@ public void Application_Startup(object sender, StartupEventArgs e)
9898
DebugMessage.DisplayDebugMessage("GoAwayEdge",
9999
$"Opening AI Provider '{Configuration.AiProvider}' (Triggered with argument) ...");
100100
UserInterface.CopilotDock.InterfaceManager.ShowDock();
101-
Environment.Exit(0);
101+
Configuration.SafeShutdown(0);
102102
}
103103
else
104104
{
105105
IsDebug = true;
106106
DebugMessage.DisplayDebugMessage("GoAwayEdge",
107107
"You cannot open the Copilot dock if your AI provider is set to default");
108-
Environment.Exit(1);
108+
Configuration.SafeShutdown(1);
109109
}
110110
}
111111

@@ -149,36 +149,36 @@ public void Application_Startup(object sender, StartupEventArgs e)
149149
if (IsAdministrator() == false)
150150
{
151151
var elevatedProcess = ElevateAndWait(string.Join(" ", args));
152-
Environment.Exit(elevatedProcess);
152+
Configuration.SafeShutdown(elevatedProcess);
153153
return;
154154
}
155155

156156
Configuration.InstallControlPanel = true;
157157
var result = InstallRoutine.Install(null);
158-
Environment.Exit(result);
158+
Configuration.SafeShutdown(result);
159159
}
160160
if (args.Contains("-u"))
161161
{
162162
if (IsAdministrator() == false)
163163
{
164164
var elevatedProcess = ElevateAndWait(string.Join(" ", args));
165-
Environment.Exit(elevatedProcess);
165+
Configuration.SafeShutdown(elevatedProcess);
166166
return;
167167
}
168168
var result = InstallRoutine.Uninstall(null);
169-
Environment.Exit(result);
169+
Configuration.SafeShutdown(result);
170170
}
171171
if (args.Contains("--update"))
172172
{
173173
var statusEnv = Configuration.InitialEnvironment();
174-
if (statusEnv == false) Environment.Exit(1);
174+
if (statusEnv == false) Configuration.SafeShutdown(1);
175175

176176
// Check for app update
177177
var updateAvailable = Updater.CheckForAppUpdate();
178178

179179
var updateSkipped = RegistryConfig.GetKey("SkipVersion");
180180
if (updateAvailable == updateSkipped)
181-
Environment.Exit(0);
181+
Configuration.SafeShutdown(0);
182182

183183
if (!string.IsNullOrEmpty(updateAvailable))
184184
{
@@ -194,17 +194,17 @@ public void Application_Startup(object sender, StartupEventArgs e)
194194
case "Btn1":
195195
{
196196
var updateResult = Updater.UpdateClient();
197-
if (!updateResult) Environment.Exit(0);
197+
if (!updateResult) Configuration.SafeShutdown(0);
198198
break;
199199
}
200200
case "Btn3":
201201
RegistryConfig.SetKey("SkipVersion", updateAvailable);
202-
Environment.Exit(0);
202+
Configuration.SafeShutdown(0);
203203
break;
204204
}
205205
}
206206

207-
Environment.Exit(0);
207+
Configuration.SafeShutdown(0);
208208
}
209209

210210
break;
@@ -213,7 +213,7 @@ public void Application_Startup(object sender, StartupEventArgs e)
213213

214214
Configuration.InitialEnvironment();
215215
ArgumentParse.Parse(args);
216-
Environment.Exit(0);
216+
Configuration.SafeShutdown(0);
217217
}
218218

219219
private static void ElevateAsAdmin(string? arguments = null)

GoAwayEdge/Common/Configuration.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,12 @@ public static bool IsCopilotDockPipeAvailable()
221221
}
222222
}
223223

224+
public static void SafeShutdown(int exitCode)
225+
{
226+
ShellManager?.Dispose();
227+
Environment.Exit(exitCode);
228+
}
229+
224230
/// <summary>
225231
/// Get a list of all available Edge Channels.
226232
/// </summary>

GoAwayEdge/Common/Installation/InstallRoutine.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static int Install(object? sender, DoWorkEventArgs? e = null)
3939
var messageUi = new MessageUi("GoAwayEdge", errorMessage, "OK");
4040
messageUi.ShowDialog();
4141
});
42-
Environment.Exit(1);
42+
Configuration.SafeShutdown(1);
4343
return 1;
4444
}
4545

@@ -107,7 +107,7 @@ public static int Install(object? sender, DoWorkEventArgs? e = null)
107107
var messageUi = new MessageUi("GoAwayEdge", errorMessage, "OK");
108108
messageUi.ShowDialog();
109109
});
110-
Environment.Exit(1);
110+
Configuration.SafeShutdown(1);
111111
return 1;
112112
}
113113
}
@@ -120,7 +120,7 @@ public static int Install(object? sender, DoWorkEventArgs? e = null)
120120
var messageUi = new MessageUi("GoAwayEdge", errorMessage, "OK");
121121
messageUi.ShowDialog();
122122
});
123-
Environment.Exit(1);
123+
Configuration.SafeShutdown(1);
124124
return 1;
125125
}
126126

@@ -141,7 +141,7 @@ public static int Install(object? sender, DoWorkEventArgs? e = null)
141141
var messageUi = new MessageUi("GoAwayEdge", errorMessage, "OK");
142142
messageUi.ShowDialog();
143143
});
144-
Environment.Exit(1);
144+
Configuration.SafeShutdown(1);
145145
return 1;
146146
}
147147
}
@@ -162,7 +162,7 @@ public static int Install(object? sender, DoWorkEventArgs? e = null)
162162
var messageUi = new MessageUi("GoAwayEdge", errorMessage, "OK");
163163
messageUi.ShowDialog();
164164
});
165-
Environment.Exit(1);
165+
Configuration.SafeShutdown(1);
166166
return 1;
167167
}
168168
}
@@ -200,7 +200,7 @@ public static int Install(object? sender, DoWorkEventArgs? e = null)
200200
var messageUi = new MessageUi("GoAwayEdge", errorMessage, "OK");
201201
messageUi.ShowDialog();
202202
});
203-
Environment.Exit(1);
203+
Configuration.SafeShutdown(1);
204204
return 1;
205205
}
206206

@@ -215,7 +215,7 @@ public static int Install(object? sender, DoWorkEventArgs? e = null)
215215
var messageUi = new MessageUi("GoAwayEdge", errorMessage, "OK");
216216
messageUi.ShowDialog();
217217
});
218-
Environment.Exit(1);
218+
Configuration.SafeShutdown(1);
219219
return 1;
220220
}
221221

@@ -260,7 +260,7 @@ public static int Uninstall(object? sender, DoWorkEventArgs? e = null)
260260
var messageUi = new MessageUi("GoAwayEdge", errorMessage, "OK");
261261
messageUi.ShowDialog();
262262
});
263-
Environment.Exit(1);
263+
Configuration.SafeShutdown(1);
264264
return 1;
265265
}
266266
Process.Start(new ProcessStartInfo
@@ -269,7 +269,7 @@ public static int Uninstall(object? sender, DoWorkEventArgs? e = null)
269269
Arguments = "-u",
270270
UseShellExecute = true
271271
});
272-
Environment.Exit(3010);
272+
Configuration.SafeShutdown(3010);
273273
}
274274

275275
// Remove installation directory
@@ -287,7 +287,7 @@ public static int Uninstall(object? sender, DoWorkEventArgs? e = null)
287287
var messageUi = new MessageUi("GoAwayEdge", errorMessage, "OK");
288288
messageUi.ShowDialog();
289289
});
290-
Environment.Exit(1);
290+
Configuration.SafeShutdown(1);
291291
return 1;
292292
}
293293

@@ -309,7 +309,7 @@ public static int Uninstall(object? sender, DoWorkEventArgs? e = null)
309309
var messageUi = new MessageUi("GoAwayEdge", errorMessage, "OK");
310310
messageUi.ShowDialog();
311311
});
312-
Environment.Exit(1);
312+
Configuration.SafeShutdown(1);
313313
return 1;
314314
}
315315

@@ -358,7 +358,7 @@ public static int Uninstall(object? sender, DoWorkEventArgs? e = null)
358358
var messageUi = new MessageUi("GoAwayEdge", errorMessage, "OK");
359359
messageUi.ShowDialog();
360360
});
361-
Environment.Exit(1);
361+
Configuration.SafeShutdown(1);
362362
return 1;
363363
}
364364

GoAwayEdge/Common/Localization.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static void LoadLanguage()
4141
var messageUi = new MessageUi("GoAwayEdge",
4242
$"Failed to load language: {ex.Message}", "OK", isMainThread: true);
4343
messageUi.ShowDialog();
44-
Environment.Exit(1);
44+
Configuration.SafeShutdown(1);
4545
}
4646

4747
if (dict.Source ==

GoAwayEdge/GoAwayEdge.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<AssemblyName>GoAwayEdge</AssemblyName>
1313
<Company>Exploitox</Company>
1414
<Authors>valnoxy</Authors>
15-
<Version>2.0.1.260</Version>
15+
<Version>2.0.2.263</Version>
1616
<Copyright>Copyright © 2018 - 2026 Exploitox. All rights reserved.</Copyright>
1717
<PackageProjectUrl>https://github.com/valnoxy/GoAwayEdge</PackageProjectUrl>
1818
<RepositoryUrl>https://github.com/valnoxy/GoAwayEdge</RepositoryUrl>
@@ -54,10 +54,10 @@
5454
<ItemGroup>
5555
<PackageReference Include="ManagedShell" Version="0.0.337" />
5656
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
57-
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3595.46" />
58-
<PackageReference Include="System.Drawing.Common" Version="10.0.0" />
57+
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3856.49" />
58+
<PackageReference Include="System.Drawing.Common" Version="10.0.5" />
5959
<PackageReference Include="TaskScheduler" Version="2.12.2" />
60-
<PackageReference Include="WPF-UI" Version="4.0.3" />
60+
<PackageReference Include="WPF-UI" Version="4.2.0" />
6161
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
6262
</ItemGroup>
6363
<ItemGroup>

GoAwayEdge/Properties/PublishProfiles/FolderProfile.pubxml.user

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
44
-->
55
<Project>
66
<PropertyGroup>
7-
<History>True|2025-11-11T22:01:38.3710950Z||;True|2025-11-11T22:58:53.2512937+01:00||;True|2025-11-11T22:30:24.9441816+01:00||;True|2025-11-11T21:38:29.7052265+01:00||;True|2025-11-11T21:37:39.2745702+01:00||;True|2025-11-11T21:34:37.3346974+01:00||;True|2025-11-11T21:18:05.8166436+01:00||;True|2025-11-11T21:16:57.0144769+01:00||;True|2024-12-26T18:33:52.9873568+01:00||;True|2024-12-26T18:31:07.1677995+01:00||;True|2024-12-26T17:03:19.1985996+01:00||;True|2024-12-26T16:24:41.8789667+01:00||;True|2024-12-26T15:22:32.4690057+01:00||;True|2024-12-26T15:09:04.1027404+01:00||;True|2024-12-26T15:03:19.0005711+01:00||;True|2024-12-25T17:22:09.8471194+01:00||;True|2024-08-13T19:39:30.3814052+02:00||;True|2024-08-13T19:35:07.3638159+02:00||;True|2024-08-13T01:10:27.4137217+02:00||;True|2024-08-13T01:06:17.9215774+02:00||;True|2024-08-13T00:56:54.4657665+02:00||;True|2024-08-13T00:49:21.1156303+02:00||;True|2024-08-13T00:45:56.3970427+02:00||;True|2024-08-13T00:25:23.5481220+02:00||;True|2024-08-12T22:11:19.4188626+02:00||;True|2024-08-12T22:10:38.2923046+02:00||;True|2024-08-12T22:08:45.6517147+02:00||;True|2024-07-30T00:22:22.2984409+02:00||;True|2024-07-30T00:18:17.4366719+02:00||;True|2024-07-30T00:17:49.8084336+02:00||;True|2024-07-22T18:41:59.8117684+02:00||;True|2024-06-18T00:28:22.3138517+02:00||;True|2024-06-18T00:16:46.9788815+02:00||;True|2024-06-09T20:14:23.6305404+02:00||;True|2024-06-09T19:02:49.2570274+02:00||;True|2024-06-09T18:47:29.9573023+02:00||;True|2024-06-09T18:46:39.8011527+02:00||;False|2024-06-09T18:46:05.6633541+02:00||;False|2024-06-09T18:45:59.2563619+02:00||;True|2024-02-18T17:16:27.0408261+01:00||;True|2024-02-18T17:15:41.3961034+01:00||;True|2024-02-18T17:11:58.7761728+01:00||;True|2024-02-18T17:08:57.9390623+01:00||;True|2024-02-18T17:08:26.6377454+01:00||;True|2024-02-18T17:07:45.2050537+01:00||;True|2024-02-18T17:05:12.7495146+01:00||;True|2024-02-18T17:02:32.4549017+01:00||;True|2024-02-18T16:48:25.3074382+01:00||;True|2023-10-19T00:00:28.0962969+02:00||;True|2022-11-13T02:33:03.7406004+01:00||;True|2022-11-13T02:19:07.9073988+01:00||;True|2022-11-13T02:18:35.3043045+01:00||;True|2022-11-12T20:05:07.6366825+01:00||;False|2022-11-12T20:04:52.3576134+01:00||;True|2022-11-12T19:36:12.8480978+01:00||;</History>
7+
<History>True|2026-03-30T23:03:26.3210199Z||;True|2025-11-11T23:01:38.3710950+01:00||;True|2025-11-11T22:58:53.2512937+01:00||;True|2025-11-11T22:30:24.9441816+01:00||;True|2025-11-11T21:38:29.7052265+01:00||;True|2025-11-11T21:37:39.2745702+01:00||;True|2025-11-11T21:34:37.3346974+01:00||;True|2025-11-11T21:18:05.8166436+01:00||;True|2025-11-11T21:16:57.0144769+01:00||;True|2024-12-26T18:33:52.9873568+01:00||;True|2024-12-26T18:31:07.1677995+01:00||;True|2024-12-26T17:03:19.1985996+01:00||;True|2024-12-26T16:24:41.8789667+01:00||;True|2024-12-26T15:22:32.4690057+01:00||;True|2024-12-26T15:09:04.1027404+01:00||;True|2024-12-26T15:03:19.0005711+01:00||;True|2024-12-25T17:22:09.8471194+01:00||;True|2024-08-13T19:39:30.3814052+02:00||;True|2024-08-13T19:35:07.3638159+02:00||;True|2024-08-13T01:10:27.4137217+02:00||;True|2024-08-13T01:06:17.9215774+02:00||;True|2024-08-13T00:56:54.4657665+02:00||;True|2024-08-13T00:49:21.1156303+02:00||;True|2024-08-13T00:45:56.3970427+02:00||;True|2024-08-13T00:25:23.5481220+02:00||;True|2024-08-12T22:11:19.4188626+02:00||;True|2024-08-12T22:10:38.2923046+02:00||;True|2024-08-12T22:08:45.6517147+02:00||;True|2024-07-30T00:22:22.2984409+02:00||;True|2024-07-30T00:18:17.4366719+02:00||;True|2024-07-30T00:17:49.8084336+02:00||;True|2024-07-22T18:41:59.8117684+02:00||;True|2024-06-18T00:28:22.3138517+02:00||;True|2024-06-18T00:16:46.9788815+02:00||;True|2024-06-09T20:14:23.6305404+02:00||;True|2024-06-09T19:02:49.2570274+02:00||;True|2024-06-09T18:47:29.9573023+02:00||;True|2024-06-09T18:46:39.8011527+02:00||;False|2024-06-09T18:46:05.6633541+02:00||;False|2024-06-09T18:45:59.2563619+02:00||;True|2024-02-18T17:16:27.0408261+01:00||;True|2024-02-18T17:15:41.3961034+01:00||;True|2024-02-18T17:11:58.7761728+01:00||;True|2024-02-18T17:08:57.9390623+01:00||;True|2024-02-18T17:08:26.6377454+01:00||;True|2024-02-18T17:07:45.2050537+01:00||;True|2024-02-18T17:05:12.7495146+01:00||;True|2024-02-18T17:02:32.4549017+01:00||;True|2024-02-18T16:48:25.3074382+01:00||;True|2023-10-19T00:00:28.0962969+02:00||;True|2022-11-13T02:33:03.7406004+01:00||;True|2022-11-13T02:19:07.9073988+01:00||;True|2022-11-13T02:18:35.3043045+01:00||;True|2022-11-12T20:05:07.6366825+01:00||;False|2022-11-12T20:04:52.3576134+01:00||;True|2022-11-12T19:36:12.8480978+01:00||;</History>
88
<LastFailureDetails />
99
</PropertyGroup>
1010
</Project>

GoAwayEdge/UserInterface/CopilotDock/CopilotDock.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private void CloseButton_OnClick(object sender, RoutedEventArgs e)
6464
Configuration.ShellManager.Dispose();
6565
}
6666

67-
Environment.Exit(0);
67+
Configuration.SafeShutdown(0);
6868
}
6969

7070
private void DockButton_OnClick(object sender, RoutedEventArgs e)

GoAwayEdge/UserInterface/CopilotDock/InterfaceManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ public static void ShowDock()
6666

6767
// Dock was closed
6868
Logging.Log("Closed CopilotDock");
69-
Environment.Exit(0);
69+
Configuration.SafeShutdown(0);
7070
}
7171
else
7272
{
7373
PipeManager.SendMessage("BringToFront");
74-
Environment.Exit(0); // Exit the second instance
74+
Configuration.SafeShutdown(0); // Exit the second instance
7575
}
7676
}
7777
}

0 commit comments

Comments
 (0)