-
Notifications
You must be signed in to change notification settings - Fork 293
Closed
Labels
Description
Version
1.52
Steps to reproduce
- Call
var cookies = await _page.Context.CookiesAsync();
Update: it's a binary breaking change, see #3161 (comment):
So compiled a lib to version <=1.51 and compile your project to >=1.52
Expected behavior
- Don't crash if there are no cookies
- Do throw a ArgumentNullException, we don't send an argument
Actual behavior
a System.ArgumentNullException is thrown
System.ArgumentNullException
HResult=0x80004003
Message=Value cannot be null. (Parameter 'source')
Source=System.Linq
StackTrace:
at System.Linq.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Microsoft.Playwright.Core.BrowserContext.<CookiesAsync>d__106.MoveNext() in /_/src/Playwright/Core/BrowserContext.cs:line 385
at MyProject.End2EndTests.EndToEndSteps.<LogNavigation>d__19.MoveNext() in /_/src/End2EndTests/EndToEndSteps.cs:line 107
This exception was originally thrown at this call stack:
[External Code]
Microsoft.Playwright.Core.BrowserContext.CookiesAsync(System.Collections.Generic.IEnumerable<string>) in BrowserContext.cs
MyProject.End2EndTests.EndToEndSteps.LogNavigation(string) in EndToEndSteps.cs
FYI there is one page in the context, and it's about:blank
This is for a generic logging of the used url and used cookies. Unfortunately we cannot check if Context.Page.Count > 0, as there is a page.
Additional context
It seems this bug is introduced in 1.52
Environment
- Operating System: Windows 11
- CPU: Intel Core i7
- Browser: Chromium
- .NET Version (TFM): net8.0
- Other info: on multiple machines local/CI
