Skip to content

Fix async method naming convention in code example #47588

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

Merged
merged 2 commits into from
Jul 29, 2025
Merged

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 25, 2025

The documentation in async-scenarios.md states: "Add 'Async' as the suffix of every async method name you write." However, the code example contradicted this recommendation by using GetDotNetCount instead of GetDotNetCountAsync.

This change updates the code example to be consistent with the documented best practice by:

  • Renaming the method from GetDotNetCount to GetDotNetCountAsync
  • Updating the method call in the Main method
  • Updating the comment that referenced the old method name

The fix ensures that the code example properly demonstrates the async naming convention that is recommended in the documentation.

Fixes #43830.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • learn.microsoft.com
    • Triggering command: /home/REDACTED/work/docs/docs/docs/csharp/asynchronous-programming/snippets/async-scenarios/bin/Debug/net8.0/async-scenarios (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Async suffix ommited on code example Fix async method naming convention in code example Jul 25, 2025
Copilot finished work on behalf of gewarren July 25, 2025 22:32
@Copilot Copilot AI requested a review from gewarren July 25, 2025 22:32
@gewarren gewarren marked this pull request as ready for review July 27, 2025 02:54
@gewarren gewarren requested review from BillWagner and a team as code owners July 27, 2025 02:54
Copy link

@Binnygarg Binnygarg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -147,9 +147,9 @@ private static async Task<User[]> GetUsersAsyncByLINQ(IEnumerable userIds)

Name should be GetUsersByLINQAsync(IEnumerable userIds)

Below method should return await
static public async Task GetDotNetCountAsync(string URL)
{

Copy link
Member

@BillWagner BillWagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM and I'll :shipit: now.

@BillWagner BillWagner merged commit 7f9c6b5 into main Jul 29, 2025
20 checks passed
@BillWagner BillWagner deleted the copilot/fix-43830 branch July 29, 2025 20:53
@gewarren gewarren mentioned this pull request Jul 29, 2025
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Async suffix ommited on code example
4 participants