Commit 0b4bd31
authored
Fix Windows uninstaller crash with launcher strategy (#115)
* Attempt to fix Uninstall process
* Implement launcher strategy to fix uninstaller crash on Windows
Problem:
- Uninstaller crashed with access violation (0xc0000005) when executed from installation directory
- .NET Single-File runtime extraction fails in locked/restricted directories
- Crash occurred before Program.Main, making debugging impossible
Root Cause:
- When executed from AppData\Local\Programs, .NET runtime cannot extract bundled files
- Desktop execution worked fine, proving issue was location-dependent
Solution Implemented:
- Created UninstallLauncher.exe (WinExe, ~12MB single-file .NET 8 app)
- Launcher copies Uninstall.exe to %TEMP%\DotnetPackaging\Uninstallers\{GUID}\
- Executes uninstaller from %TEMP% and waits for completion (WaitForExit)
- Registry UninstallString points to launcher instead of uninstaller directly
Key Changes:
- New project: src/DotnetPackaging.Exe.UninstallLauncher/
* WinExe (no console window)
* Single-file, trimmed .NET 8
* Handles copy, execute, and wait logic
- Modified src/DotnetPackaging.Exe.Installer/Core/Installer.cs:
* Copies installer as Uninstall.exe to installation directory
* Extracts UninstallLauncher.exe from embedded resources
* Registry points to launcher
- Updated DotnetPackaging.Exe.Installer.csproj:
* Embeds UninstallLauncher.exe as resource
- Comprehensive documentation in WARP.md and AGENTS.md:
* Architecture and execution flow
* Implementation details
* Why it works
* 6 future improvements (Native AOT, GitHub downloads, etc.)
* Testing checklist
* Lessons learned
Benefits:
✅ Uninstaller always runs from %TEMP% (no extraction issues)
✅ No console window (WinExe)
✅ No Windows 'program may not have uninstalled correctly' dialog (WaitForExit)
✅ Robust to %TEMP% cleanup (recreates on each run)
✅ Fallback to direct uninstaller if launcher extraction fails
Testing:
✅ Install/uninstall works correctly
✅ No console window appears
✅ No Windows error dialogs
✅ Uninstaller UI shows properly
✅ Works after multiple install/uninstall cycles
Future Improvements:
- Native AOT or C++ launcher (reduce from 12MB to <1MB)
- Download launcher from GitHub releases (smaller installer)
- Self-deleting temp uninstaller
- Retry logic for antivirus locks
See WARP.md lines 383-618 for complete documentation.
* Restore installation directory removal during uninstall
* Add UninstallLauncher project to solution1 parent ac4c54f commit 0b4bd31
File tree
24 files changed
+1630
-112
lines changed- src
- DotnetPackaging.Exe.Installer
- Core
- Installation
- Wizard/Install
- Resources
- Uninstallation
- DotnetPackaging.Exe.Tests
- DotnetPackaging.Exe.UninstallLauncher
- DotnetPackaging.Exe
24 files changed
+1630
-112
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | | - | |
31 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
52 | | - | |
| 54 | + | |
53 | 55 | | |
54 | | - | |
| 56 | + | |
55 | 57 | | |
56 | 58 | | |
57 | | - | |
| 59 | + | |
58 | 60 | | |
59 | 61 | | |
60 | 62 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
46 | 52 | | |
47 | 53 | | |
48 | 54 | | |
| |||
233 | 239 | | |
234 | 240 | | |
235 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
236 | 266 | | |
237 | 267 | | |
238 | 268 | | |
239 | 269 | | |
240 | 270 | | |
| 271 | + | |
241 | 272 | | |
242 | | - | |
243 | 273 | | |
244 | | - | |
| 274 | + | |
245 | 275 | | |
| 276 | + | |
246 | 277 | | |
247 | 278 | | |
248 | 279 | | |
| |||
0 commit comments