[Feature]: NativeAOT and trimming support

Aperta
#3,441 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
csharp
Ambito
backend

Direzione di ricerca

Start by locating protocol JSON serialization, EvaluateAsync<T>, and runsettings mapping in the Microsoft.Playwright source; the issue does not name specific files or tests. Review existing serialization and trimming annotations, then check that the requested source-generated context and JsonTypeInfo<T> overload cover the stated paths. Done means NativeAOT publishing produces no IL2026 or IL3050 warnings from Microsoft.Playwright and reflection-based runsettings mapping is removed.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

🚀 Feature Request

Make Microsoft.Playwright trim- and AOT-safe:

  • Source-generated JsonSerializerContext for protocol types and EvaluateAsync<T> (with a JsonTypeInfo<T> overload).
  • Remove the reflection-based runsettings mapping.
  • Annotate the remaining dynamic code paths with [RequiresUnreferencedCode] / [RequiresDynamicCode].
Example
var data = await page.EvaluateAsync("() => window.appState", AppJsonContext.Default.AppState);
// dotnet publish -p:PublishAot=true  -> no IL2026/IL3050 warnings from Microsoft.Playwright
Motivation

Playwright is increasingly embedded in tools such as scrapers, PDF and screenshot services, CLI utilities and MCP servers, where NativeAOT startup time and size matter. Today those apps get trimming and AOT warnings and runtime failures from reflection-based JSON.

Lingua principale
C#
Stelle
3k
Fork
307
Merge medio
1g 13h
PR unite (30g)
21

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/playwright-dotnet

Tutte le issue di microsoft/playwright-dotnet

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.