vs-threading icon indicating copy to clipboard operation
vs-threading copied to clipboard

VSTHRD111: Order of suggested code fix options

Open rwv37 opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe.

No, I wouldn't say it's a "problem", but: At least for me, when VSTHRD111 happens, and I "Alt-Enter" to get to the suggested code fixes, the first code fix listed is always to use ConfigureAwait(true). Since it is the first listed, it is the default choice when you hit "Alt-Enter" then "Enter".

In my experience, that's almost never what I want. I want ConfigureAwait(false). I get the feeling that that's true of most people, too. If I'm wrong about that, please just forget about this request.

Describe the solution you'd like

I'd like the first listed one to be ConfigureAwait(false), so that it is the default choice.

Describe alternatives you've considered

Of course I can (and do) just "Alt-Enter", "Down", "Enter", which is obviously not a huge travail in and of itself. But I've sometimes caught myself mistakenly just doing "Alt-Enter", "Enter", because of (1) longstanding muscle memory from an old analyzer with this same rule (or maybe an old version of this one? I forget), and (2) the high degree of visual similarity between the top two choices. That's the sort of thing that I'm really hoping to prevent, rather than merely the extra keystroke.

Additional context

rwv37 avatar Jan 27 '22 00:01 rwv37

Your reasoning is fair. We use the true policy a lot in VS, but as that is the default, the only people who would want true as a code fix are those with style policies requiring it be explicit, which I suspect is a much smaller set of people than those who want the false policy.

AArnott avatar Jan 27 '22 13:01 AArnott

Follow the Steps

  1. Fork the Repository: Go to the GitHub repository where you want to contribute, in this case, the Microsoft repository related to the specific project you mentioned. Click the "Fork" button in the upper-right corner to create your copy of the repository.

  2. Clone Your Fork: After forking, you need to clone your forked repository to your local machine. Open a terminal or command prompt and run the following command, replacing <your-username> with your GitHub username:

    git clone https://github.com/<your-username>/repository-name.git
    
  3. Create a New Branch: It's a good practice to create a new branch for your specific contribution. This keeps your changes isolated and makes it easier to manage pull requests. Use a descriptive branch name:

    git checkout -b configure-await-false
    
  4. Make the Necessary Code Changes: Navigate to the relevant code files in your local repository and make the changes you've described. In this case, you want to modify the order of suggested code fixes to prioritize ConfigureAwait(false).

  5. Commit Your Changes: Once you've made the changes, commit them with a descriptive message:

    git add .
    git commit -m "Change the default code fix suggestion to ConfigureAwait(false)"
    
  6. Push Your Changes: Push the changes to your forked repository on GitHub:

    git push origin configure-await-false
    
  7. Create a Pull Request: Go to your forked repository on GitHub. You should see a message indicating that you've recently pushed a new branch. Click the "Compare & pull request" button.

  8. Describe Your Pull Request: Give your pull request a meaningful title and description, explaining the problem and your solution. Mention any additional context or reasoning.

  9. Submit the Pull Request: Click the "Create pull request" button to submit your changes for review.

  10. Participate in the Review Process: Be prepared to engage in discussions and make further changes if necessary. Collaboration and feedback are an integral part of open-source contributions.

  11. Wait for Approval: The maintainers of the Microsoft repository will review your pull request. If they find it acceptable, it will be merged into the main repository.

sujitmahapatra avatar Oct 03 '23 14:10 sujitmahapatra