Service: show the running version in the Service menu (so a self-update is visible)

Local checkpoint - NOT for public release. Answers "how will we know if the service
updated itself?"

- The service records its version + start time on every OnStart into ServiceStore
  (ProgramData). A self-update restart therefore bumps the version and refreshes the
  start time.
- The Service menu status line now shows it: "Service: installed, running — version 5.3,
  running since 2 min ago". So you can see the running version at a glance, and a recent
  start with a bumped version is the self-update landing.
- Also logged on start ("service: OnStart, version X") for the service log.

Status round-trip covered by the isolation self-test. Gate 27/27.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ednunp
2026-07-13 09:51:59 +01:00
co-authored by Claude Opus 4.8
parent 56dbd0b80f
commit d5767050f2
4 changed files with 49 additions and 1 deletions
+6 -1
View File
@@ -40,7 +40,12 @@ public sealed class RemSoundService : ServiceBase
protected override void OnStart(string[] args)
{
log = new RemSoundLog { Enabled = SafeServiceLogging() };
log.Event("service: OnStart");
var version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
var versionText = version is null ? "?" : $"{version.Major}.{version.Minor}";
log.Event($"service: OnStart, version {versionText}");
// Record the running version + start time so the app's Service menu can show them — this is how a
// self-update is visible (the version bumps and the start time is recent).
try { ServiceStore.SaveStatus(new ServiceStore.ServiceStatus { Version = versionText, StartedUtc = DateTime.UtcNow }); } catch { }
host = ServiceSendHost.FromConfig(msg => log?.Event(msg));
worker = new Thread(() =>
{