Repository navigation
Home
Artyom M. edited this page Nov 2, 2026
·
2 revisions
Welcome to the Scarlet.Extensions.Hosting.DirectN wiki!
An unofficial implementation of Microsoft.Extensions.Hosting for DirectN (Win32 / Direct2D) desktop applications. This library brings the power of the .NET Generic Host to DirectN, enabling dependency injection, configuration, logging, and hosted services in your desktop applications, Native AOT compatible end to end.
This wiki describes version 1. Coming from WPF? See Migrating from Extensions.Hosting.Wpf.
-
Generic Host integration for DirectN applications, with
Host.CreateApplicationBuilder(IHostApplicationBuilder) orHost.CreateDefaultBuilder(IHostBuilder) -
Native AOT: every package is
IsAotCompatibleand verifies that its references are too - Components created, initialized and disposed on the UI thread, with constructor injection
-
Predictable lifecycle: the UI thread starts after every hosted service has started and stops before them, and startup failures surface from
host.Run() -
A reliable UI-thread
SynchronizationContext: works before the UI thread starts and inside modal loops, flows the caller'sExecutionContext, and never hangs or throws on shutdown -
System tray icon support with WinForms
NotifyIconbehavior (optional extension) -
Thread switching between UI and background threads with
JoinableTaskFactoryandAsyncLazy<T>(optional extension)
Scarlet.Extensions.Hosting.DirectN
Getting Started
Core Features
Extensions
Reference