SeleniumHQ / SeleniumHQ/selenium

[🐛 Bug]: Async methods cannot be easily recognized

Open
#12,671 13 comments 1 reaction 0 assignees View on GitHub
A-needs decision C-dotnet I-defect P-breaking change
Dominant language
Java
Stars
34.5k
Forks
8.7k
Avg merge
2d 1h
Merged PRs (30d)
92

Description

### What happened?

We cannot easily understand whether a method is asynchronous or not. When we write code, we use synchronous methods and asynchronous beside. There is high chance to make a mistake when dealing with async methods, and don't await them.

Example:
```csharp
driver.Network.StartMonitoring();
```

Who knows it's async or not. Tooling (like IDE) doesn't help us (at least for me) to understand, there is even no warnings.

Even Jim made a mistake:
![image](https://github.com/SeleniumHQ/selenium/assets/22616990/a77d8045-6e9e-4d72-87eb-a7220199c3d5)

I also went through open issues in this repository and observed that people don't await `StartMonitoring()` method.

# Solution
Add `Async` to all async methods according [naming convention](https://learn.microsoft.com/en-us/dotnet/csharp/asynchronous-programming/task-asynchronous-programming-model#BKMK_NamingConvention).

> By convention, methods that return commonly awaitable types (for example, Task, Task, ValueTask, ValueTask) should have names that end with "Async".

### How can we reproduce the issue?

```shell
driver.Network.StartMonitoring();
```

### Relevant log output

```shell
no output
```

### Operating System

any

### Selenium version

any dotnet, selenium 4.0+

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

any

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

any

### Are you using Selenium Grid?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.