question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NullReferenceException in NewContextAsync

See original GitHub issue
System.NullReferenceException : Object reference not set to an instance of an object.
   at Microsoft.Playwright.Core.Browser.NewContextAsync(BrowserNewContextOptions options) in /_/src/Playwright/Core/Browser.cs:line 121
   at Microsoft.Playwright.Core.Browser.NewPageAsync(BrowserNewPageOptions options) in /_/src/Playwright/Core/Browser.cs:line 164
  • net6
  • <PackageReference Include="Microsoft.Playwright" Version="1.20.1" />
using System.Threading.Tasks;
using Microsoft.Playwright;

class Program
{
    public static async Task Main()
    {
        using var playwright = await Playwright.CreateAsync();
        await using var browser = await playwright.Chromium.LaunchAsync();
        var page = await browser.NewPageAsync();
        // ...
    }
}

offending line

https://github.com/microsoft/playwright-dotnet/blob/main/src/Playwright/Core/Browser.cs#L121

 ((Tracing)context.Tracing).LocalUtils = LocalUtils;

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
mxschmittcommented, Mar 17, 2022

Folding into https://github.com/microsoft/playwright-dotnet/issues/2069 Thank you folks for the input! We’ll fix it in the driver side and provide recent modification dates with the next release.

0reactions
Joe118commented, Jun 13, 2022

Done, #2175

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use Microsoft.Playwright.Core.Browser.NewContextAsync ...
Use the NewContextAsync method in Microsoft.Playwright.Core package in your next Playwright-dotnet project with LambdaTest Automation Testing Advisor.
Read more >
Use Microsoft.Playwright.MSTest.BrowserTest. ...
Use the NewContextAsync method in Microsoft.Playwright.MSTest package in your next Playwright-dotnet project with LambdaTest Automation Testing Advisor.
Read more >
Browser | Playwright .NET
NewContextAsync ​. Added in: v1.8 browser.NewContextAsync. Creates a new browser context. It won't share cookies/cache with other browser ...
Read more >
Execute Playwright not via test runner
raising a NullReferenceException for await browserTest.NewContext(); . I'm using: .NET 7; Chromium browser; OS: Linux (Docker).
Read more >
How to maximize Chrome in Playwright using c# Nunit
To start the browser maximized, you need to pass null instead of width ... NewContextAsync(new BrowserNewContextOptions { ViewportSize = new ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found