Skip to main content
Version: 10.5.0

GeneralUpdate.Bowl

Namespace: GeneralUpdate.Bowl | Main Entry Point: new BowlBootstrap().LaunchAsync(BowlContext, CancellationToken) | NuGet Package: GeneralUpdate.Bowl

1. Component Overview​

1.1 Introduction​

GeneralUpdate.Bowl is a startup watchdog component that runs after an upgrade completes (the entry class Bowl was renamed to BowlBootstrap as of 10.5.0-rc.1). It does not download, extract, or replace update packages. Instead, after new version files are deployed and the main process is about to start or has started, it monitors the target process for startup crashes. If a crash is detected, it generates a memory dump, writes a failure report JSON, exports system diagnostics, and in Upgrade mode automatically restores the backup directory to the install directory, preventing users from being stuck on a non-bootable new version.

Core Capabilities:

CapabilityDescription
Process Crash MonitoringAttaches to target process via ProcDump (Windows/Linux) to catch unhandled startup exceptions
Memory Dump SnapshotsSupports Full / Mini / Heap dump types, selectable by file size and completeness
Crash Report GenerationAuto-generates {version}_fail.json report with monitoring parameters and tool output
System Diagnostics ExportOn Windows, exports driver list, system info, and recent system event logs
Automatic RollbackIn Upgrade mode, copies backup directory back to install directory for one-click rollback
Failed Version MarkingPre-writes the upgrade failure marker (UpgradeFail); note: the 10.5.0 upgrade pipeline does not yet write this marker (reserved)
Event CallbackOnCrash callback for uploading diagnostics, notifying users, or recording audit info
Standalone MonitoringNormal mode only captures crashes and generates reports without auto-restore

Business Problems Solved:

  • New version crashes during startup after upgrade, leaving users unable to use the app and unable to roll back
  • Developers lack crash site information (dump, system environment) to diagnose "won't start after upgrade" issues
  • Need automated rollback mechanism to reduce upgrade risk and avoid manual intervention

Use Cases:

  • Desktop app post-upgrade startup health check with automatic rollback protection
  • General process startup crash monitoring and diagnostic collection
  • Automatic diagnostics after CI/CD smoke test failures

1.2 Environment & Dependencies​

ItemDescription
Version10.5.0
Target Frameworknetstandard2.0 (.NET Framework 4.6.1+ / .NET Core 2.0+ / .NET 5+)
DependenciesSystem.Collections.Immutable, System.Text.Json
Bundled ToolsWindows: procdump.exe / procdump64.exe / procdump64a.exe; Linux: procdump deb/rpm + install.sh
CompatibilityWindows (full) / Linux (deb/rpm distros); other platforms throw PlatformNotSupportedException

2. Feature List​

FeatureDescriptionTypeRequiredNotes
Upgrade Mode MonitoringMonitor new version startup crash, auto-restore backup, mark failed versionCoreRecommendedWorkModel = "Upgrade"
Standalone MonitoringCapture crash and generate report only, no auto-restoreCoreOptionalWorkModel = "Normal"
Full DumpComplete memory snapshot, most detailCoreOptionalDumpType.Full, largest file
Mini DumpSmall memory snapshot, faster generationCoreOptionalDumpType.Mini, recommended for production
Heap DumpMini dump with heap informationCoreOptionalDumpType.Heap, between Mini and Full
Crash Report JSONAuto-generate structured crash report fileCoreAutomaticOutput to FailDirectory
System Diagnostics ExportExport driver list, system info, event logs (Windows)ExtendedAutomaticWindows only
Auto Backup RestoreCopy backup directory back to install directory on crashCoreOptionalAutoRestore = true
Failed Version MarkingPre-write upgrade failure version; Core skips subsequentlyCoreAutomaticUpgrade mode only; the 10.5.0 upgrade pipeline does not yet write this marker (reserved)
Crash CallbackBusiness callback triggered on crash detectionExtendedOptionalOnCrash callback function
Trace LoggingGeneralTracer runtime diagnostic logsExtendedOptionalEnabled by default, can be disabled

3. API Configuration Reference​

3.1 Configuration Properties (Props)​

BowlContext:

FieldTypeDefaultRequiredValuesDescription
ProcessNameOrIdstring—YesProcess name or PIDTarget process to monitor
DumpFileNamestring—YesValid filenameDump output filename, e.g., "{version}_fail.dmp"
FailFileNamestring—YesValid filenameCrash report JSON filename, e.g., "{version}_fail.json"
TargetPathstring—YesValid directory pathApp install root; backup restored here on crash
FailDirectorystring—YesValid directory pathFailure artifact output, e.g., {TargetPath}/fail/{version}
BackupDirectorystring—RecommendedValid directory pathPre-upgrade backup; must exist when AutoRestore = true
WorkModelstring"Upgrade" (after Normalize())Optional"Upgrade" / "Normal"Work mode: upgrade rollback / standalone monitoring
ExtendedFieldstringnullOptional—Extended field, typically the version number
TimeoutMsint30000 (after Normalize())OptionalPositive integer (ms)Monitoring subprocess timeout
DumpTypeDumpTypeDumpType.Full (after Normalize())OptionalFull(0), Mini(1), Heap(2)Dump capture type
AutoRestoreboolfalseOptionaltrue / falseAuto-restore backup; set true in upgrade mode
OnCrashFunc<CrashInfo, CancellationToken, Task>?nullOptional—Crash event callback, fires only when dump detected

DumpType Enum:

ValueCodeWindows ProcDump FlagCharacteristics
Full0-maComplete memory snapshot, most detail, largest file
Mini1-mmSmall snapshot, fast generation, recommended for production
Heap2-mhSmall dump with heap info, between Mini and Full

3.2 Instance Methods​

BowlBootstrap:

MethodParametersReturnsUse CaseNotes
LaunchAsync(BowlContext, CancellationToken)context — execution context (call Normalize() first); ct — cancellation tokenTask<BowlResult>Start crash monitoring daemonThree phases: prepare → run → handle crash if dump found

BowlContext:

MethodParametersReturnsUse CaseNotes
Normalize()NoneBowlContextApply defaults (WorkModel → "Upgrade", TimeoutMs → 30000, DumpType → Full)Returns new instance; does not modify original

3.3 Callback Events​

EventCallback ParametersTrigger TimingUsage Notes
OnCrashCrashInfo — DumpFilePath, CrashReportPath, Version, ExitCode; CancellationTokenAfter dump file is detectedUse for uploading diagnostics, notifying users "new version rolled back", recording audit. Callback exceptions are logged to trace but don't block LaunchAsync return

4. Advanced Examples​

4.1 Extension Points Overview​

Bowl's primary extension point is the BowlContext.OnCrash callback. Internal strategy interfaces (IBowlStrategy, ICrashReporter, ISystemInfoProvider) are internal; contribute to the GeneralUpdate repository for new platform support or custom report logic.

Extension PointTypeDescription
OnCrash CallbackFunc<CrashInfo, CancellationToken, Task>?Configured in BowlContext, triggered on crash
GeneralTracer LoggingStatic classToggle via SetTracingEnabled

4.2 Examples by Scenario​

Scenario 1: Upgrade Mode Monitoring + Crash Alert Upload​

Description: Desktop app upgrades to new version; Bowl monitors for startup crash. On crash, auto-rollback and upload diagnostics to internal log platform.

using GeneralUpdate.Bowl;

var version = "2.0.0";
var installPath = AppDomain.CurrentDomain.BaseDirectory;

var context = new BowlContext
{
ProcessNameOrId = "MyApp.exe",
DumpFileName = $"{version}_fail.dmp",
FailFileName = $"{version}_fail.json",
TargetPath = installPath,
FailDirectory = Path.Combine(installPath, "fail", version),
BackupDirectory = Path.Combine(installPath, version),
WorkModel = "Upgrade",
ExtendedField = version,
TimeoutMs = 60_000,
DumpType = DumpType.Mini,
AutoRestore = true,
OnCrash = async (info, ct) =>
{
var zipPath = Path.Combine(
Path.GetDirectoryName(info.DumpFilePath)!,
$"crash_{info.Version}_{DateTimeOffset.Now:yyyyMMddHHmmss}.zip");
System.IO.Compression.ZipFile.CreateFromDirectory(
Path.GetDirectoryName(info.DumpFilePath)!, zipPath);

using var client = new HttpClient();
var content = new MultipartFormDataContent();
content.Add(new StreamContent(File.OpenRead(zipPath)), "file", Path.GetFileName(zipPath));
content.Add(new StringContent(info.Version), "version");
content.Add(new StringContent(info.ExitCode.ToString()), "exitCode");
await client.PostAsync("https://logs.example.com/api/crash", content, ct);

Console.WriteLine($"Version {info.Version} crashed (exit code {info.ExitCode}).");
Console.WriteLine("Diagnostics uploaded. Previous version restored.");
}
};

BowlResult result = await new BowlBootstrap().LaunchAsync(context);

if (result.DumpCaptured && result.Restored)
Console.WriteLine("Crash detected and backup restored.");

Scenario 2: Standalone Monitoring (Non-Upgrade)​

Description: General-purpose worker process startup crash monitoring; collect diagnostics only, no auto-rollback.

var context = new BowlContext
{
ProcessNameOrId = "MyWorker.exe",
DumpFileName = "startup_fail.dmp",
FailFileName = "startup_fail.json",
TargetPath = AppDomain.CurrentDomain.BaseDirectory,
FailDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "fail", "startup"),
BackupDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "backup"),
WorkModel = "Normal",
TimeoutMs = 15_000,
DumpType = DumpType.Mini,
AutoRestore = false
};

BowlResult result = await new BowlBootstrap().LaunchAsync(context);

if (result.DumpCaptured)
{
Console.WriteLine($"Dump captured at: {result.DumpFilePath}");
Console.WriteLine($"Report at: {result.CrashReportPath}");
}

5. Basic Usage Examples​

5.1 Quick Start (Minimal Demo)​

using GeneralUpdate.Bowl;

var context = new BowlContext
{
ProcessNameOrId = "MyApp.exe",
DumpFileName = "fail.dmp",
FailFileName = "fail.json",
TargetPath = AppDomain.CurrentDomain.BaseDirectory,
FailDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "fail"),
BackupDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "backup"),
}.Normalize();

BowlResult result = await new BowlBootstrap().LaunchAsync(context);
Console.WriteLine($"Success: {result.Success}, Dump captured: {result.DumpCaptured}");

5.2 Basic Parameter Combination​

var version = "2.0.0";
var installPath = @"C:\Program Files\MyApp";

var context = new BowlContext
{
ProcessNameOrId = "MyApp.exe",
DumpFileName = $"{version}_fail.dmp",
FailFileName = $"{version}_fail.json",
TargetPath = installPath,
FailDirectory = Path.Combine(installPath, "fail", version),
BackupDirectory = Path.Combine(installPath, version),
WorkModel = "Upgrade",
ExtendedField = version,
TimeoutMs = 30_000,
DumpType = DumpType.Full,
AutoRestore = true,
OnCrash = (info, ct) =>
{
Console.WriteLine($"Crash: {info.DumpFilePath}");
return Task.CompletedTask;
}
};

BowlResult result = await new BowlBootstrap().LaunchAsync(context);

if (result.DumpCaptured && result.Restored)
Console.WriteLine("The upgraded version crashed and the backup was restored.");

5.3 Production-Ready Example​

Full post-upgrade Bowl daemon workflow integrated into the upgrade process:

using GeneralUpdate.Bowl;

var version = "2.0.0";
var installPath = @"C:\Program Files\MyApp";

var bowlContext = new BowlContext
{
ProcessNameOrId = "MyApp.exe",
DumpFileName = $"{version}_fail.dmp",
FailFileName = $"{version}_fail.json",
TargetPath = installPath,
FailDirectory = Path.Combine(installPath, "fail", version),
BackupDirectory = Path.Combine(installPath, "backups", version),
WorkModel = "Upgrade",
ExtendedField = version,
TimeoutMs = 45_000,
DumpType = DumpType.Mini,
AutoRestore = true,
OnCrash = async (info, ct) =>
{
try
{
using var client = new HttpClient();
var crashData = new
{
version = info.Version,
exitCode = info.ExitCode,
dumpPath = info.DumpFilePath,
reportPath = info.CrashReportPath,
timestamp = DateTimeOffset.UtcNow
};
await client.PostAsJsonAsync(
"https://monitor.mycompany.com/api/crash-report", crashData, ct);
}
catch (Exception ex)
{
Console.WriteLine($"Failed to upload crash report: {ex.Message}");
}
}
};

var result = await new BowlBootstrap().LaunchAsync(bowlContext);

if (result.Success)
Console.WriteLine("New version started successfully.");
else if (result.DumpCaptured)
{
Console.WriteLine($"New version crashed (exit code: {result.ExitCode}).");
Console.WriteLine($"Backup restored: {result.Restored}");
Console.WriteLine($"Dump: {result.DumpFilePath}");
}

6. Global Configuration​

Bowl does not rely on global configuration files. All configuration is passed via BowlContext. Logging behavior is controlled through the static GeneralTracer class.

Logging Toggle​

GeneralTracer.SetTracingEnabled(false);
var result = await new BowlBootstrap().LaunchAsync(context);
GeneralTracer.SetTracingEnabled(true);

Output File Structure​

MyApp/
fail/
2.0.0/
2.0.0_fail.dmp # Memory dump
2.0.0_fail.json # Crash report JSON
driverInfo.txt # Windows driver list
systeminfo.txt # OS/hardware/memory info
systemlog.evtx # Windows system event log
Logs/
generalupdate-trace 2026-01-01.log # Bowl trace logs

Platform Differences​

PlatformMonitoring ToolDiagnostics ExportNotes
WindowsBuilt-in ProcDump (procdump.exe/procdump64.exe/procdump64a.exe)Supports driverInfo.txt, systeminfo.txt, systemlog.evtxRequires sufficient permissions for dumps
LinuxBuilt-in deb/rpm + install.sh ProcDump installCurrently no-opSupports Ubuntu/Debian/RHEL/CentOS/Fedora/ClearOS