Skip to content

DRY: App.xaml.cs initialization duplicated between Servy and Manager (~400 lines) #405

@Christophe-Rogiers

Description

@Christophe-Rogiers

Description

src/Servy/App.xaml.cs (~290 lines) and src/Servy.Manager/App.xaml.cs (~285 lines) contain near-identical initialization logic:

  • OnStartup(): Identical rendering tier detection, software rendering fallback
  • OnExit(): Identical SecureData disposal
  • InitializeApp(): Both do identical unhandled exception handlers, splash screen parsing, ConfigurationBuilder setup, AppFoldersHelper.EnsureFolders, DatabaseInitializer, ProtectedKeyProvider + SecureData, ResourceHelper.CopyEmbeddedResource calls

Only the log filename and appsettings filename differ.

Estimated redundant lines: ~400

Suggested fix

Extract an AppBootstrapper class in a shared project that handles common initialization. Each App.xaml.cs passes project-specific values (log filename, appsettings filename, MainWindow factory).

Metadata

Metadata

Assignees

Labels

refactorChanges that improve structure, readability, or maintainability without altering external behavior

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions