microsoft / playwright-dotnet

.NET version of the Playwright testing and automation library.
https://playwright.dev/dotnet/
MIT License
2.47k stars 235 forks source link

[Bug] dotnet build does not override files #2069

Closed mxschmitt closed 2 years ago

mxschmitt commented 2 years ago

This scenario is currently broken:

dotnet add package Microsoft.Playwright --version 1.19.1
dotnet build
./bin/Debug/net6.0/dotnet2
dotnet add package Microsoft.Playwright --version 1.20.1
dotnet build
./bin/Debug/net6.0/dotnet2

Actual: it does not override driver files -> driver won't start -> breaks Playwright Expected: it works.

Relates:

cc @campersau do you know anything that could be the cause of this? Otherwise, I would dig into it.

campersau commented 2 years ago

I think the problem is that the files under the package folder in the driver zip files don't have the correct modified date. https://playwright.azureedge.net/builds/driver/playwright-1.20.0-mac.zip https://playwright.azureedge.net/builds/driver/playwright-1.20.0-linux.zip https://playwright.azureedge.net/builds/driver/playwright-1.20.0-win32_x64.zip

And these incorrect modified dates are also present in the nuget package as you can see here version 1.19.1 vs 1.20.1: image

Only the protocol.yml has a correct modified date which is the only file which gets copied by a normal dotnet build. Here a screenshot after following your steps: image

After manually touching (find . -type f -exec touch {} +) all files in the nuget download folder for version 1.20.1 %userprofile%\.nuget\packages\microsoft.playwright\1.20.1\.playwright\package these files get correctly copied by dotnet build.

campersau commented 2 years ago

Looks like it is an intentional npm pack behavior: https://github.com/npm/npm/pull/20027#discussion_r173985677

mxschmitt commented 2 years ago

Yup! I created a fix for it: https://github.com/microsoft/playwright/pull/12864

Thank you very much for your input and good finding! 💯

mxschmitt commented 2 years ago

Note: We'll publish on Monday evening a fix with it. In the meantime dotnet clean is a workaround.

rsantosdev commented 2 years ago

The fix was supposed to go out yesterday, but nothing up to know. Even clean and restore are working anymore for me. Any new dates?

mxschmitt commented 2 years ago

Sorry for the delay, it's live now. 1.20.2

rsantosdev commented 2 years ago

One last thing ... what about the docker image?

mxschmitt commented 2 years ago

@rsantosdev see here https://github.com/microsoft/playwright-dotnet/issues/1611#issuecomment-1077771163

Joe118 commented 2 years ago

I am still hitting the issue mentioned in issue #2071 with playwright.dll from microsoft.playwright.1.22.0.nupkg\lib\netstandard2.0

The line at which the NPE happens is: 214: ctx = await browser.NewContextAsync(options);

The stack trace is not very informative, including it for whatever its worth:

06/11/2022 21:48:34:574: INFO : T9: Sys: GC 06/11/2022 21:48:46:240: WARN: T15: DBD: BrowserNewContext failed: Object reference not set to an instance of an object. 06/11/2022 21:48:46:240: INFO : T15: DBD: at Microsoft.Playwright.Core.Browser.d__33.MoveNext()

06/11/2022 21:48:46:240: INFO : T15: DBD: --- End of stack trace from previous location where exception was thrown --- 06/11/2022 21:48:46:240: INFO : T15: DBD: at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 06/11/2022 21:48:46:240: INFO : T15: DBD: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 06/11/2022 21:48:46:240: INFO : T15: DBD: at DojoPlatform.DojoBrowserDriver.d__63.MoveNext() in D:\dojodev\Dojo\DojoBrowserDriver\DojoBrowserObject.cs:line 214

Please help, this is a total blocker for my use of microsoft.playwright 1.22.0 from nuget.org

Thanks, --Joe

mxschmitt commented 2 years ago

I am still hitting the issue mentioned in issue #2071 with playwright.dll from microsoft.playwright.1.22.0.nupkg\lib\netstandard2.0

The line at which the NPE happens is: 214: ctx = await browser.NewContextAsync(options);

The stack trace is not very informative, including it for whatever its worth:

06/11/2022 21:48:34:574: INFO : T9: Sys: GC 06/11/2022 21:48:46:240: WARN: T15: DBD: BrowserNewContext failed: Object reference not set to an instance of an object. 06/11/2022 21:48:46:240: INFO : T15: DBD: at Microsoft.Playwright.Core.Browser.d__33.MoveNext()

06/11/2022 21:48:46:240: INFO : T15: DBD: --- End of stack trace from previous location where exception was thrown --- 06/11/2022 21:48:46:240: INFO : T15: DBD: at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() 06/11/2022 21:48:46:240: INFO : T15: DBD: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 06/11/2022 21:48:46:240: INFO : T15: DBD: at DojoPlatform.DojoBrowserDriver.d__63.MoveNext() in D:\dojodev\Dojo\DojoBrowserDriver\DojoBrowserObject.cs:line 214

Please help, this is a total blocker for my use of microsoft.playwright 1.22.0 from nuget.org

Thanks, --Joe

Please file a new issue.