• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

743
Views
PlaywrightException: Connection closed (System.Threading.ThreadAbortException: System error - only when debugging

I have some UI test written in MS Test 2 framework.

The test runs fine when I run it from Visual Studio 2022's test explorer.

When I try to debug the test I'm getting:

Microsoft.Playwright.PlaywrightException: Connection closed (System.Threading.ThreadAbortException: System error.
   at System.IO.Strategies.BufferedFileStreamStrategy.WriteToNonSeekableAsync(ReadOnlyMemory`1 source, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at System.IO.Strategies.BufferedFileStreamStrategy.WriteToNonSeekableAsync(ReadOnlyMemory`1 source, CancellationToken cancellationToken)
   at System.IO.Strategies.BufferedFileStreamStrategy.WriteAsync(ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
   at System.IO.FileStream.WriteAsync(ReadOnlyMemory`1 buffer, CancellationToken cancellationToken)
   at Microsoft.Playwright.Transport.StdIOTransport.SendAsync(String message))

  Stack Trace: 
Connection.SendMessageToServerAsync[T](String guid, String method, Object args)
Frame.WaitForFunctionAsync(String expression, Object arg, FrameWaitForFunctionOptions options)
MyTest.MyAsyncMethod() line 23
ThreadOperations.ExecuteWithAbortSafety(Action action)

on following call to WaitForFunctionAsync:

  var jshandle = await Page.WaitForFunctionAsync(script,
                null, 
                new() { Timeout = 5000, PollingInterval = 300 });

The error occurs only if the breakpoint is hit before the call.

I'm experiencing similar behavior with QuerySelectorAsync().

How can I debug playwright tests?!

over 3 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error