Threading and Host Customization

Threading requirements are part of the product surface because the native dialog APIs are not uniform across platforms.

Runtime Host Model

The default managed path routes calls through INativeMessageBoxHost. By default, NativeMessageBoxClient selects a runtime-backed host for native targets and a browser host when running in the browser.

Host Configuration

NativeMessageBoxHostOptions exposes the main default-host knobs:

Platform Requirements

Platform Requirement
Windows Advanced dialogs may require STA
macOS Main-thread execution
Linux GTK-compatible UI context
iOS Main-thread presenter
Android UI-thread activity presentation
Browser Main-thread overlay flow

Custom Host Scenarios

Implement INativeMessageBoxHost when you need:

  • Dispatcher-aware scheduling
  • App-specific telemetry or logging
  • Alternate error or retry policy
  • A fake host for tests