Skip to content

Migrate Browser Wrangler to Native AOT - #29

Merged
damianh merged 2 commits into
devfrom
dh/native-aot-migration
Jul 26, 2026
Merged

damianh merged 2 commits into
devfrom
dh/native-aot-migration

Conversation

@damianh

@damianh damianh commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Why

Browser Wrangler is a short-lived on-demand app, so startup cost matters. This migrates the app and release pipeline from ReadyToRun/partial trim to Native AOT to reduce cold-start overhead and remove runtime JIT dependency.

What changed

  • Enabled AOT-oriented project settings in the app and core projects (IsAotCompatible, PublishAot, AllowUnsafeBlocks where required by CsWinRT analyzer).
  • Replaced System.Drawing.Common icon extraction with Win32-based extraction (SHGetFileInfo + bitmap conversion to WriteableBitmap) to avoid non-AOT-safe APIs.
  • Switched Firefox profile-store SQLite access to Microsoft.Data.Sqlite.Core + SQLitePCLRaw.provider.winsqlite3, with explicit one-time provider initialization.
  • Removed single-file/AOT warning path in diagnostics fallback logic.
  • Updated workflows:
    • CI PR trigger targets dev.
    • CI now runs a Native AOT publish step in the platform matrix.
    • Release publish uses PublishAot=true instead of PublishReadyToRun=true.
  • Updated README to describe Native AOT builds.

Notes

  • Local Native AOT publish requires Visual Studio C++ toolchain prerequisites (MSVC + Windows SDK). CI on windows-latest is configured to validate publish in automation.
  • The CI branch filter change to dev is intentional for the requested channel target.

Switch app and release pipeline from partial trim/ReadyToRun to Native AOT, including CI AOT publish validation on dev PRs.

Replace System.Drawing icon extraction with Win32 APIs for AOT compatibility and move Firefox SQLite reads to winsqlite3 provider initialization.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 26, 2026 17:34
@damianh
damianh changed the base branch from main to dev July 26, 2026 17:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Migrates Browser Wrangler from ReadyToRun to Native AOT to improve cold-start performance.

Changes:

  • Enables Native AOT publishing and CI validation.
  • Replaces non-AOT-compatible icon and SQLite dependencies.
  • Updates diagnostics and documentation.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
IconLoader.cs Replaces System.Drawing icon extraction with Win32 APIs.
DiagnosticsInfo.cs Uses assembly metadata for SDK version fallback.
PickerWindow.xaml.cs Accepts generalized image sources.
BrowserWrangler.csproj Enables Native AOT and removes System.Drawing.
FirefoxProfiles.cs Initializes the Windows SQLite provider.
BrowserWrangler.Core.csproj Uses AOT-compatible SQLite packages.
README.md Documents Native AOT releases.
release.yml Publishes Native AOT release artifacts.
ci.yml Validates AOT publishing for x64 and ARM64.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Use DrawIconEx-to-DIB rasterization in IconLoader so transparency/mask semantics are applied correctly and avoid GetDIBits source-selection pitfalls.

Add shared SqliteProviderBootstrap and invoke it in both production and tests before opening SQLite connections.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@damianh
damianh merged commit 815b4ac into dev Jul 26, 2026
2 checks passed
@damianh
damianh deleted the dh/native-aot-migration branch July 26, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants