-
Notifications
You must be signed in to change notification settings - Fork 232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[REGRESSION]: QuerySelectorAllAsync causes InvalidCastException #2830
Labels
Comments
I was able to reproduce, thanks for filing! |
What timing! I actually came here to find/report something similar, but for me it happens when capturing console messages. Same error message: Microsoft.Playwright.TargetClosedException : Unable to cast object of type 'Microsoft.Playwright.Transport.Converters.ChannelToGuidConverter' to type 'System.Text.Json.Serialization.JsonConverter`1[Microsoft.Playwright.Core.JSHandle]'.
----> System.InvalidCastException : Unable to cast object of type 'Microsoft.Playwright.Transport.Converters.ChannelToGuidConverter' to type 'System.Text.Json.Serialization.JsonConverter`1[Microsoft.Playwright.Core.JSHandle]'.
at Microsoft.Playwright.Transport.Connection.InnerSendMessageToServerAsync[T](ChannelOwner object, String method, Dictionary`2 dictionary, Boolean keepNulls) in /_/src/Playwright/Transport/Connection.cs:line 208
at Microsoft.Playwright.Transport.Connection.WrapApiCallAsync[T](Func`1 action, Boolean isInternal) in /_/src/Playwright/Transport/Connection.cs:line 538
at Microsoft.Playwright.Core.Frame.GotoAsync(String url, FrameGotoOptions options) in /_/src/Playwright/Core/Frame.cs:line 792
at Sipc.WebSite.Portal.Tests.FirstTestFixture.Test() in C:\Code\SIPC\Sipc.BackOffice\tests\Sipc.WebSite.Portal.Tests\FirstTestFixture.cs:line 72
at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.BlockUntilCompleted()
at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaiter)
at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(Func`1 invoke)
at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand.<>c__DisplayClass1_0.<Execute>b__0()
at NUnit.Framework.Internal.Commands.DelegatingTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)
--InvalidCastException
at System.Text.Json.Serialization.JsonCollectionConverter`2.GetElementConverter(JsonTypeInfo elementTypeInfo)
at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value)
at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
at System.Text.Json.JsonSerializer.ReadFromSpan[TValue](ReadOnlySpan`1 utf8Json, JsonTypeInfo jsonTypeInfo, Nullable`1 actualByteCount)
at System.Text.Json.JsonSerializer.ReadUsingMetadata[TValue](JsonElement element, JsonTypeInfo jsonTypeInfo)
at System.Text.Json.JsonSerializer.Deserialize[TValue](JsonElement element, JsonSerializerOptions options)
at Microsoft.Playwright.Helpers.JsonExtensions.ToObject[T](JsonElement element, JsonSerializerOptions options) in /_/src/Playwright/Helpers/JsonExtensions.cs:line 52
at Microsoft.Playwright.Core.BrowserContext.OnMessage(String method, Nullable`1 serverParams) in /_/src/Playwright/Core/BrowserContext.cs:line 161
at Microsoft.Playwright.Transport.Connection.Dispatch(PlaywrightServerMessage message) in /_/src/Playwright/Transport/Connection.cs:line 314 I can also confirm that downgrading the package to 1.40.0 or updating the target to .NET 8 both resolve the issue. |
@daveaglick thanks, we'll release an update soon - .NET 8 is a great workaround in the meantime. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Context:
Code Snippet
Project at https://github.com/JustusGreiberORGADATA/playwright-reproduction
Prints stacktrace
Describe the bug
This for some reason only happens if my TargetFramework is
net6.0
. On.net7.0
and.net8.0
everything works fine.The text was updated successfully, but these errors were encountered: