Skip to content

[🐛 Bug]: dotnet NotSupportedException on changing NetworkConditions #14712

@pnatashap

Description

@pnatashap

What happened?

Exception for changing driver's NetworkConditions.

Fix should be like https://github.com/SeleniumHQ/selenium/pull/14697/files but add line [JsonSerializable(typeof(ChromiumNetworkConditions))]

Error:

System.NotSupportedException : JsonTypeInfo metadata for type 'OpenQA.Selenium.Chromium.ChromiumNetworkConditions' was not provided by TypeInfoResolver of type 'OpenQA.Selenium.CommandJsonSerializerContext'. If using source generation, ensure that all root types passed to the serializer have been annotated with 'JsonSerializableAttribute', along with any types that might be serialized polymorphically ```

### How can we reproduce the issue?

```shell
Execute code:

driver.NetworkConditions = new ChromiumNetworkConditions
{
    
IsOffline = false, 
    
DownloadThroughput = 5000, 
    
UploadThroughput = 5000,
    
Latency = TimeSpan.FromMilliseconds(5)

};

Relevant log output

System.NotSupportedException : JsonTypeInfo metadata for type 'OpenQA.Selenium.Chromium.ChromiumNetworkConditions' was not provided by TypeInfoResolver of type 'OpenQA.Selenium.CommandJsonSerializerContext'. If using source generation, ensure that all root types passed to the serializer have been annotated with 'JsonSerializableAttribute', along with any types that might be serialized polymorphically

Operating System

windows, linux

Selenium version

dotnet 4.26.0, 4.26.1

What are the browser(s) and version(s) where you see this issue?

chrome 130

What are the browser driver(s) and version(s) where you see this issue?

Chromedriver

Are you using Selenium Grid?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-dotnet.NET BindingsI-defectSomething is not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions