Skip to content

LaunchAsync fails on first run after Native AOT publish #3544

Description

@kalax2

Description

After publishing the application with Native AOT, PuppeteerSharp.LaunchAsync fails on the first run.

Launching the browser throws the following exception:

Failed to launch browser!  at PuppeteerSharp.States.ProcessStartingState.<StartCoreAsync>d__10.MoveNext() + 0x50e
--- End of stack trace from previous location ---
   at PuppeteerSharp.States.ProcessStartingState.<StartCoreAsync>d__10.MoveNext() + 0x77c
--- End of stack trace from previous location ---
   at PuppeteerSharp.Launcher.<LaunchAsync>d__8.MoveNext() + 0x2ac
--- End of stack trace from previous location ---
   at PuppeteerSharp.Launcher.<LaunchAsync>d__8.MoveNext() + 0x118a

However, after closing the executable and launching it again, it works normally without any code changes.

Here is my code:

using var browser = await Puppeteer.LaunchAsync(new LaunchOptions
{
    Headless = true,
    ExecutablePath = @"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe",
    Args = ["--no-sandbox", "--headless=new", "--disable-gpu"]
});

Environment

  • OS: Windows 11
  • .NET: 10.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions