feat(log): the launcher's log kept in a file, with the run before, its crashes and what it did to the player's data #171

Merged
HumanBean merged 6 commits from madebyjordan/LongshotLauncher:feat/launcher-log-file into main 2026-11-17 21:09:01 +00:00
Member

Player reports arrive with no launcher log: #146 ("deleted all saves"), #141 ("existing build not shown") and #152 ("exits with Unknown Hard Error") have only game logs, and the #146 reporter found no logs folder. LauncherLog kept its lines in memory only and the launcher had no unhandled-exception handler, so a crash at start left nothing. Now the launcher keeps its log in a file, with the run before, its crashes, and what it did to the player's data.

What changes

  • logs/launcher.log in the launcher's home, plus the run before as launcher.1.log, 1 MB per file. A shortcut's Play (--play, no window) appends to play.log beside it instead, so it never touches the file an open launcher is writing. Where:
    • installed Windows: %LOCALAPPDATA%\LongshotLauncher\logs\launcher.log
    • portable Windows: <exe folder>\LongshotLauncher-data\logs\launcher.log
    • Linux: ~/.local/share/longshot/launcher/logs/launcher.log (a portable AppImage: <AppImage>.home/logs/)
  • Every line LauncherLog already records goes there with a timestamp, after a first line saying which launcher on which system. Every line has no user name (Privacy.Scrub from #164: the home folder as %USERPROFILE% or ~, the name elsewhere in a path as <user>), including the lines that don't go through Add (the first line, a crash's stack). Links are logged without their query or fragment (LauncherLog.Link, where they are written; Add cuts any left over), so no signed download token is in memory, the file or a bug report. Each line goes at the file's end, so a line another launcher appended is never written over. Writing never throws into the app.
  • What it did to the player's data, logged: save gather (the backup, which save was kept, the slots put in a free slot or kept only in the backup, the folders renamed), build delete (and where the save it held was backed up), a refused delete or a failed gather before it, rows ForgetGone drops, builds.json and settings.json set aside, Free up space and the shader caches it clears, self-update steps (recover, rollback), install and uninstall.
  • Crashes: AppDomain.UnhandledException, TaskScheduler.UnobservedTaskException and Avalonia's dispatcher write the exception before the process ends.
  • launcher.log opens only after the instance lock, so --play or a second launcher never moves the running launcher's log aside. A crash with no file open (before the lock, or after the file stopped) is appended to play.log. A start that hands over to the installed launcher appends rather than rolling, so the run before survives. Uninstall with data closes the file before deleting the home, and nothing is written after; "Run portable" reopens it in the new home.
  • The bug report ends with the log file's path (and names launcher.1.log and play.log beside it). README lists logs/.

First lines, from the real writer:

2026-11-17 10:32:07.521 +00:00 Longshot Launcher v1.4.0 (installed) started; Microsoft Windows 10.0.26200, X64, .NET 10.0.15; home %USERPROFILE%\AppData\Local\LongshotLauncher
2026-11-17 10:32:09.609 build v3.2.0 dropped from the list: its folder is gone: D:\Games\Longshot\stable

Testing

Windows 11, .NET SDK 10.0.404.

  • Rebased onto main after #164, #170, #175, #176 and #178.
  • python -I tests/test_launcher_core.py: 1634 checks pass. The check commit fails on main with A builds.json set aside is logged, with where it was kept:, and passes with the change. LauncherLogChecks covers the file written with no user name, rolled over at the cap, the run before kept, a crash written once, play.log appended to and never launcher.log, a line another launcher appended kept whole, links cut (a decoded Uri, a fragment), the saves gather logged, and a failing disk not throwing. Mutations of the fix (no seek to the end, Link returning the whole link, the crash going to launcher.log, the gather line removed) each fail a check.
  • On Windows the suite needs TEMP as its long path: with the 8.3 short one (JORDAN~1.DES) main itself fails a few checks.
  • dotnet build: 0 errors, 0 warnings.

Two cold reviews by a second agent (code only). The second approved; what each found is fixed in the fix(log) commits.

Not tested: the crash handlers firing in a real launcher, and --play from a real shortcut (built, not run). The log stays on the PC; nothing sends it.

🤖 Generated with Claude Code

Player reports arrive with no launcher log: #146 ("deleted all saves"), #141 ("existing build not shown") and #152 ("exits with Unknown Hard Error") have only game logs, and the #146 reporter found no logs folder. `LauncherLog` kept its lines in memory only and the launcher had no unhandled-exception handler, so a crash at start left nothing. Now the launcher keeps its log in a file, with the run before, its crashes, and what it did to the player's data. ## What changes - **`logs/launcher.log`** in the launcher's home, plus the run before as `launcher.1.log`, 1 MB per file. A shortcut's Play (`--play`, no window) appends to `play.log` beside it instead, so it never touches the file an open launcher is writing. Where: - installed Windows: `%LOCALAPPDATA%\LongshotLauncher\logs\launcher.log` - portable Windows: `<exe folder>\LongshotLauncher-data\logs\launcher.log` - Linux: `~/.local/share/longshot/launcher/logs/launcher.log` (a portable AppImage: `<AppImage>.home/logs/`) - Every line `LauncherLog` already records goes there with a timestamp, after a first line saying which launcher on which system. Every line has no user name (`Privacy.Scrub` from #164: the home folder as `%USERPROFILE%` or `~`, the name elsewhere in a path as `<user>`), including the lines that don't go through `Add` (the first line, a crash's stack). Links are logged without their query or fragment (`LauncherLog.Link`, where they are written; `Add` cuts any left over), so no signed download token is in memory, the file or a bug report. Each line goes at the file's end, so a line another launcher appended is never written over. Writing never throws into the app. - **What it did to the player's data**, logged: save gather (the backup, which save was kept, the slots put in a free slot or kept only in the backup, the folders renamed), build delete (and where the save it held was backed up), a refused delete or a failed gather before it, rows `ForgetGone` drops, builds.json and settings.json set aside, Free up space and the shader caches it clears, self-update steps (recover, rollback), install and uninstall. - **Crashes**: `AppDomain.UnhandledException`, `TaskScheduler.UnobservedTaskException` and Avalonia's dispatcher write the exception before the process ends. - `launcher.log` opens only after the instance lock, so `--play` or a second launcher never moves the running launcher's log aside. A crash with no file open (before the lock, or after the file stopped) is appended to `play.log`. A start that hands over to the installed launcher appends rather than rolling, so the run before survives. Uninstall with data closes the file before deleting the home, and nothing is written after; "Run portable" reopens it in the new home. - **The bug report** ends with the log file's path (and names `launcher.1.log` and `play.log` beside it). README lists `logs/`. First lines, from the real writer: ``` 2026-11-17 10:32:07.521 +00:00 Longshot Launcher v1.4.0 (installed) started; Microsoft Windows 10.0.26200, X64, .NET 10.0.15; home %USERPROFILE%\AppData\Local\LongshotLauncher 2026-11-17 10:32:09.609 build v3.2.0 dropped from the list: its folder is gone: D:\Games\Longshot\stable ``` ## Testing Windows 11, .NET SDK 10.0.404. - Rebased onto main after #164, #170, #175, #176 and #178. - `python -I tests/test_launcher_core.py`: 1634 checks pass. The check commit fails on main with `A builds.json set aside is logged, with where it was kept:`, and passes with the change. `LauncherLogChecks` covers the file written with no user name, rolled over at the cap, the run before kept, a crash written once, `play.log` appended to and never `launcher.log`, a line another launcher appended kept whole, links cut (a decoded `Uri`, a fragment), the saves gather logged, and a failing disk not throwing. Mutations of the fix (no seek to the end, `Link` returning the whole link, the crash going to `launcher.log`, the gather line removed) each fail a check. - On Windows the suite needs TEMP as its long path: with the 8.3 short one (`JORDAN~1.DES`) main itself fails a few checks. - `dotnet build`: 0 errors, 0 warnings. Two cold reviews by a second agent (code only). The second approved; what each found is fixed in the `fix(log)` commits. Not tested: the crash handlers firing in a real launcher, and `--play` from a real shortcut (built, not run). The log stays on the PC; nothing sends it. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Players' reports (#141, #146, #152) say a build or its saves went missing, and the launcher's log has nothing on it: a
builds.json set aside, a build's folder deleted or refused, the rows ForgetGone drops and the launcher's own update leave
no line. This check asks for one each. It fails on main: a builds.json set aside is not logged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Players' reports (#141, #146, #152) come with no launcher log: it lived in memory only, so it was gone once the launcher
closed, and a launcher that crashed at its start (#152, "Unknown Hard Error") left nothing, as the app had no handler for an
exception nothing caught.

- LauncherLog also writes <home>/logs/launcher.log once the launcher holds its home (not --play, nor a second launcher,
  which would move the first one's log aside): the launcher's version, kind, system and home first, then the lines it
  already had, each dated. The run before is kept as launcher.1.log, one run only; a run past 1 MB carries on in a new file,
  its start in launcher.1.log. The file has the home folder as ~ (BugReport.Scrub) and no link's query (a signed download
  link's token). Every write is caught: a disk that refuses it leaves the log in memory, as before. Lines are flushed as
  written, so the last ones survive the process.
- An exception nothing catches (AppDomain.UnhandledException, Avalonia's Dispatcher.UnhandledException) is written whole,
  with its stack, and flushed to the disk before the process ends (LauncherLog.Crash), once though both see it; before the
  home is held it is appended to the log file there. A task's exception nobody saw (TaskScheduler.UnobservedTaskException)
  and the no-fonts failure are logged too.
- What the launcher does to the player's data is logged: the saves gather (what was backed up where, which save is kept,
  which folders were renamed, or why not), a build's folder deleted or refused, a row removed or dropped by ForgetGone,
  builds.json set aside, each step of the launcher's own update (and a recovery or rollback), install, uninstall (which
  lets go of the log file before it deletes the home) and the Start menu shortcut made again.
- The bug report names the log file (as ~\...), and launcher.1.log beside it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs(log): the launcher's home lists its logs folder
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 3s
97a54bb6a4
The home now holds logs/ (launcher.log and launcher.1.log), so the README's row for LONGSHOT_LAUNCHER_HOME names it with
the other files a tester moves with the home.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member

Heads-up from #164 (#164): LauncherLog.Add now takes the OS user's name out of every line before it keeps it (Privacy.Scrub in Core/Privacy.cs: the home folder as ~, the name elsewhere in a path as [user]). If logs/launcher.log writes the lines Add keeps, this PR gets that for free. A writer that formats its own text before Add would need to call Privacy.Scrub itself. Whichever merges second rebases; LauncherLog.cs only changes in Add.

Heads-up from #164 (https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/164): LauncherLog.Add now takes the OS user's name out of every line before it keeps it (Privacy.Scrub in Core/Privacy.cs: the home folder as ~, the name elsewhere in a path as [user]). If logs/launcher.log writes the lines Add keeps, this PR gets that for free. A writer that formats its own text before Add would need to call Privacy.Scrub itself. Whichever merges second rebases; LauncherLog.cs only changes in Add.
madebyjordan force-pushed feat/launcher-log-file from 97a54bb6a4
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 3s
to 8693339072
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 6s
2026-11-17 20:39:33 +00:00
Compare
fix(log): links logged without their query, --play's own play.log, and every line at the file's end
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 2s
1be5dbcc73
From a cold review of this pull request:

- A signed link's token could stay in the log: the query was cut from the finished text, but a Uri as .NET writes it is
  decoded, so a query with a space or a quote in it (response-content-disposition=attachment; filename="x.zip") stopped
  the cut early, and a #fragment kept the whole query. Links are now logged with LauncherLog.Link (scheme, host and path,
  then ?…) where they are written: Fetcher, the launcher's update. Add cuts any query left in a line too, so the lines in
  memory, the file and the bug report have none.
- --play from a shortcut runs a saves gather and may set builds.json aside, but wrote no file. It now appends to
  logs/play.log (moved to play.1.log past 1 MB), never to the window launcher's launcher.log, which that launcher may be
  writing. A crash with no file open (before the home is held, or after the file stopped) goes to play.log too.
- Each line is written at the file's end, so a line another launcher appended is never written over.
- A start that hands over to the installed launcher (Install, or a newer installed one) appends to the log instead of
  rolling it, so the run before is not lost to two rolls. No crash file before the home is known (a portable launcher's
  is beside it) or after uninstall let go of the home. A file that stops (its disk refused it) is no longer named by the
  bug report.
- The gather's line says the save was copied, names the slots taken in from another copy, and no longer says "in use" for
  every rename that failed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
madebyjordan force-pushed feat/launcher-log-file from 1be5dbcc73
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 2s
to 78d6b7a04d
All checks were successful
CI / Compile and test (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 4s
2026-11-17 21:06:48 +00:00
Compare
Author
Member

Rebased onto main (after #164, #170, #175, #176, #178) and reworked after two cold reviews:

  • #164's scrub, as @dyst said: every line in the file has no user name, including the header and a crash's stack, which skip Add.
  • No signed link in the log: links are now written with LauncherLog.Link where they are logged (scheme, host, port, path; no query, fragment or user:password@). The old regex missed a decoded Uri with a space or quote in its query, and kept a query followed by #. Add cuts any query left over, so the bug report has none either.
  • --play writes logs/play.log. It runs a saves gather and wrote nothing before; it never touches the open launcher's launcher.log. A crash with no file open goes there too, with a line saying which process and version. Every line is written at the file's end.
  • Smaller fixes: a hand-off start (Install, a newer installed launcher) appends instead of rolling, so the run before isn't lost; no crash file before the home is known or after uninstall; a file that stopped isn't named in the report.
  • More logged: the delete logging now sits on #176's code, the gather line on #175's, and settings.json set aside (#170) and Free up space (#178) are logged too.

1634 checks pass on Windows; mutations of the fixes each fail a check.

Rebased onto main (after #164, #170, #175, #176, #178) and reworked after two cold reviews: - **#164's scrub, as @dyst said:** every line in the file has no user name, including the header and a crash's stack, which skip `Add`. - **No signed link in the log:** links are now written with `LauncherLog.Link` where they are logged (scheme, host, port, path; no query, fragment or `user:password@`). The old regex missed a decoded `Uri` with a space or quote in its query, and kept a query followed by `#`. `Add` cuts any query left over, so the bug report has none either. - **`--play` writes `logs/play.log`.** It runs a saves gather and wrote nothing before; it never touches the open launcher's `launcher.log`. A crash with no file open goes there too, with a line saying which process and version. Every line is written at the file's end. - **Smaller fixes:** a hand-off start (Install, a newer installed launcher) appends instead of rolling, so the run before isn't lost; no crash file before the home is known or after uninstall; a file that stopped isn't named in the report. - **More logged:** the delete logging now sits on #176's code, the gather line on #175's, and settings.json set aside (#170) and Free up space (#178) are logged too. 1634 checks pass on Windows; mutations of the fixes each fail a check.
HumanBean deleted branch feat/launcher-log-file 2026-11-17 21:09:01 +00:00
Owner

Verdict: Approve. Until now a crash or a lost save left no launcher log anywhere. This gives the launcher a log file on disk, capped at 1 MB, with no user name and no signed link in it, and it costs nothing a player would notice. Nothing I found blocks it. Two follow-ups would make it say what its description says (see Suggestions).

The PR merged before this review was posted. The forge only takes reviews on open PRs, so this review is a comment, and the line notes are in the Suggestions list.

What it does for a player: when they report a crash at start, lost saves or a missing build, the launcher now has logs/launcher.log (plus the run before it) showing what it did to their data and why it ended. The code gets better: the logging calls sit where the actions happen, and the file writer is one small class that never throws. The cost is one synchronous append under the existing lock per log line, and the launcher already makes very few lines.

Reviewed: 78d6b7a04d (the head; the squash on main, 029f025382, has the same tree) against 7a4a61e7c9 (fix(settings) from #170, the fork point). Read in full where they changed: Core/LauncherLog.cs, App/Program.cs (all of Main, OpenLog, BecomePortable, Rollback, PlayWithoutWindow), App/App.axaml.cs, App/LauncherService.cs, Core/BugReport.cs, Core/BuildRegistry.cs, Core/Disk.cs, Core/Fetcher.cs, Core/Installer.cs, Core/LauncherSettings.cs, Core/Saves.cs, Core/SelfUpdate.cs, Core/ShaderCaches.cs, tests/launcher_core/LauncherLogChecks.cs, and the SavesChecks and Program test hooks. For context I also read Core/Privacy.cs and LauncherLayout.OffersInstall. README was only skimmed. Nothing was run: this is a code review.
Fixed in this review: nothing (the PR is merged).
Checked and fine:

  • Privacy. Every line that reaches the file goes through Privacy.Scrub, including the header, the arguments and each line of a crash's stack (Clean). That covers the home folder, the user name anywhere in a path, and the Windows 8.3 short form (JORDAN~1). Links are logged through LauncherLog.Link (no query, fragment or user:password@), and NoQuery cuts any that slip past. No LauncherLog.Add in Core/ or App/ logs a raw URL. The saves gather logs paths, profile and slot folder names and the backup folder, never the contents of a save. The proxy line logs Authority, which carries no credentials. No hostname or account name is logged apart from these.
  • Cap and rotation. The size is counted in UTF-8 bytes, and the cap holds for both files (tested). A file that can't be moved aside stops instead of growing. A file trimmed in an editor is handled by the seek to the end before each line. play.log is appended to and rolled only once it is past the cap.
  • Threads. Every write to writer, written, name and FilePath happens under gate. FilePath is read without the lock, which is safe for a reference.
  • A crash while the log is locked. Crash takes gate, which is reentrant. A crash on the thread that holds it therefore goes through, because .NET runs the unhandled-exception event before that thread's finally blocks unwind. A crash on another thread waits for a write that only waits on the disk. The whole of Crash is in try/catch. The dispatcher sees the exception first and the process handler sees it again, and ReferenceEquals writes it only once. Neither handler marks the exception handled, so the launcher still ends exactly as before. Reporting UnobservedTaskException doesn't call SetObserved, so nothing changes there either.
  • Startup can't fail because of this. OpenLog comes after TakeLock, and every step in OpenFile, Start and Write is in try/catch. A second launcher, or --play, never rolls the running launcher's launcher.log. The hand-off starts (Install, OffersInstall with a newer installed launcher) append instead of rolling. A self-update rolls the file in the new process while the old one holds it open, which FileShare.Delete allows on Windows and Linux allows anyway.
  • Uninstall with data. It calls CloseFile before DeleteKeeping, and letGo keeps a later crash from making the deleted home again.
  • Windows and Linux. Every path is built with Path.Combine, and the file is UTF-8 with no BOM. Both sides open it with FileShare.ReadWrite | Delete, which gives compatible advisory locks on Linux.
  • The checks. They test the file's behaviour (each line at the end, the cap, the run before, one crash, play.log, a disk that fails), not the text of the code. The saves check reads the gather line from the real Saves.Gather.
  • The repository's rules. A core change comes with its check, there are no packages or release files, the description opens with why the PR is needed, and the commits are Conventional Commits.

Suggestions (none of these block)

  • App/Program.cs:58 and the Recover(own) at :49. --rollback, and the recovery from a leftover .old/.new at the top of Main, both run before Home and OpenLog, and CrashLogs is still null there. So the lines SelfUpdate.Rollback and Recover now add (SelfUpdate.cs:92, :237, :247) stay in memory, and that process ends without writing them anywhere. The description lists "self-update steps (recover, rollback)" as logged, but only the later Recover(current) is. A fix: resolve the home in Rollback() and open play.log there (OpenLog(file: LauncherLog.PlayName)), as PlayWithoutWindow does.
  • Core/LauncherLog.cs:206. Rolling over within a run moves launcher.log onto launcher.1.log, so the run before is lost once this run passes 1 MB. The launcher writes few lines, so this is rare. If a later change logs more (unobserved tasks, each with its whole stack), keep the run before as launcher.2.log, or roll within a run to a file of its own.
  • Core/ShaderCaches.cs:204. Because the line is in a finally, it says "cleared: N files" even when a delete threw partway through. Disk.FreeWork says "stopped … deleted:" in that case; this line could do the same.

Testing: The author ran 1634 checks on Windows 11 and dotnet build (0 warnings), and says mutations of the fixes each fail a check. CI's compile-and-test job was skipped, since it only runs on a manual dispatch. What's missing: a run on Linux, and any run of the App/ wiring the core checks can't reach. That means a real start, Install, --play from a shortcut, an update or rollback, and a crash handler firing. The description says these weren't run. They wouldn't hold the merge, because every path is wrapped in try/catch and can't change what the launcher does. A one-time look at a real logs/ folder after a Windows and a Linux start, before the stable release, would still be worth it.
Overlaps and merge order: #182 and #183 (save restore and per-slot delete) change the player's saves and should log those steps the way this PR logs the gather. #42 (Send report) would send the bug report, which now names the log file's path (scrubbed). If it ever attaches the file itself, the scrubbing here is what keeps it private. No file conflicts.

**Verdict: Approve.** Until now a crash or a lost save left no launcher log anywhere. This gives the launcher a log file on disk, capped at 1 MB, with no user name and no signed link in it, and it costs nothing a player would notice. Nothing I found blocks it. Two follow-ups would make it say what its description says (see Suggestions). _The PR merged before this review was posted. The forge only takes reviews on open PRs, so this review is a comment, and the line notes are in the Suggestions list._ What it does for a player: when they report a crash at start, lost saves or a missing build, the launcher now has `logs/launcher.log` (plus the run before it) showing what it did to their data and why it ended. The code gets better: the logging calls sit where the actions happen, and the file writer is one small class that never throws. The cost is one synchronous append under the existing lock per log line, and the launcher already makes very few lines. **Reviewed:** 78d6b7a04d51 (the head; the squash on main, 029f025382fd, has the same tree) against 7a4a61e7c95d (fix(settings) from https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/170, the fork point). Read in full where they changed: `Core/LauncherLog.cs`, `App/Program.cs` (all of `Main`, `OpenLog`, `BecomePortable`, `Rollback`, `PlayWithoutWindow`), `App/App.axaml.cs`, `App/LauncherService.cs`, `Core/BugReport.cs`, `Core/BuildRegistry.cs`, `Core/Disk.cs`, `Core/Fetcher.cs`, `Core/Installer.cs`, `Core/LauncherSettings.cs`, `Core/Saves.cs`, `Core/SelfUpdate.cs`, `Core/ShaderCaches.cs`, `tests/launcher_core/LauncherLogChecks.cs`, and the `SavesChecks` and `Program` test hooks. For context I also read `Core/Privacy.cs` and `LauncherLayout.OffersInstall`. README was only skimmed. Nothing was run: this is a code review. **Fixed in this review:** nothing (the PR is merged). **Checked and fine:** - **Privacy.** Every line that reaches the file goes through `Privacy.Scrub`, including the header, the arguments and each line of a crash's stack (`Clean`). That covers the home folder, the user name anywhere in a path, and the Windows 8.3 short form (`JORDAN~1`). Links are logged through `LauncherLog.Link` (no query, fragment or `user:password@`), and `NoQuery` cuts any that slip past. No `LauncherLog.Add` in `Core/` or `App/` logs a raw URL. The saves gather logs paths, profile and slot folder names and the backup folder, never the contents of a save. The proxy line logs `Authority`, which carries no credentials. No hostname or account name is logged apart from these. - **Cap and rotation.** The size is counted in UTF-8 bytes, and the cap holds for both files (tested). A file that can't be moved aside stops instead of growing. A file trimmed in an editor is handled by the seek to the end before each line. `play.log` is appended to and rolled only once it is past the cap. - **Threads.** Every write to `writer`, `written`, `name` and `FilePath` happens under `gate`. `FilePath` is read without the lock, which is safe for a reference. - **A crash while the log is locked.** `Crash` takes `gate`, which is reentrant. A crash on the thread that holds it therefore goes through, because .NET runs the unhandled-exception event before that thread's `finally` blocks unwind. A crash on another thread waits for a write that only waits on the disk. The whole of `Crash` is in try/catch. The dispatcher sees the exception first and the process handler sees it again, and `ReferenceEquals` writes it only once. Neither handler marks the exception handled, so the launcher still ends exactly as before. Reporting `UnobservedTaskException` doesn't call `SetObserved`, so nothing changes there either. - **Startup can't fail because of this.** `OpenLog` comes after `TakeLock`, and every step in `OpenFile`, `Start` and `Write` is in try/catch. A second launcher, or `--play`, never rolls the running launcher's `launcher.log`. The hand-off starts (Install, `OffersInstall` with a newer installed launcher) append instead of rolling. A self-update rolls the file in the new process while the old one holds it open, which `FileShare.Delete` allows on Windows and Linux allows anyway. - **Uninstall with data.** It calls `CloseFile` before `DeleteKeeping`, and `letGo` keeps a later crash from making the deleted home again. - **Windows and Linux.** Every path is built with `Path.Combine`, and the file is UTF-8 with no BOM. Both sides open it with `FileShare.ReadWrite | Delete`, which gives compatible advisory locks on Linux. - **The checks.** They test the file's behaviour (each line at the end, the cap, the run before, one crash, `play.log`, a disk that fails), not the text of the code. The saves check reads the gather line from the real `Saves.Gather`. - **The repository's rules.** A core change comes with its check, there are no packages or release files, the description opens with why the PR is needed, and the commits are Conventional Commits. **Suggestions** (none of these block) - `App/Program.cs:58` and the `Recover(own)` at `:49`. `--rollback`, and the recovery from a leftover `.old`/`.new` at the top of `Main`, both run before `Home` and `OpenLog`, and `CrashLogs` is still null there. So the lines `SelfUpdate.Rollback` and `Recover` now add (`SelfUpdate.cs:92`, `:237`, `:247`) stay in memory, and that process ends without writing them anywhere. The description lists "self-update steps (recover, rollback)" as logged, but only the later `Recover(current)` is. A fix: resolve the home in `Rollback()` and open `play.log` there (`OpenLog(file: LauncherLog.PlayName)`), as `PlayWithoutWindow` does. - `Core/LauncherLog.cs:206`. Rolling over within a run moves `launcher.log` onto `launcher.1.log`, so the run before is lost once this run passes 1 MB. The launcher writes few lines, so this is rare. If a later change logs more (unobserved tasks, each with its whole stack), keep the run before as `launcher.2.log`, or roll within a run to a file of its own. - `Core/ShaderCaches.cs:204`. Because the line is in a `finally`, it says "cleared: N files" even when a delete threw partway through. `Disk.FreeWork` says "stopped … deleted:" in that case; this line could do the same. **Testing:** The author ran 1634 checks on Windows 11 and `dotnet build` (0 warnings), and says mutations of the fixes each fail a check. CI's compile-and-test job was skipped, since it only runs on a manual dispatch. What's missing: a run on Linux, and any run of the `App/` wiring the core checks can't reach. That means a real start, Install, `--play` from a shortcut, an update or rollback, and a crash handler firing. The description says these weren't run. They wouldn't hold the merge, because every path is wrapped in try/catch and can't change what the launcher does. A one-time look at a real `logs/` folder after a Windows and a Linux start, before the stable release, would still be worth it. **Overlaps and merge order:** https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/182 and https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/183 (save restore and per-slot delete) change the player's saves and should log those steps the way this PR logs the gather. https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/42 (Send report) would send the bug report, which now names the log file's path (scrubbed). If it ever attaches the file itself, the scrubbing here is what keeps it private. No file conflicts.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/LongshotLauncher!171
No description provided.