roslyn: Setting csharp_style_throw_expression to false doesn't seem to work

Version Used: VS 15.0.0+26208.0.d15rel

Steps to Reproduce:

  1. Create a new project
  2. Either thru a .editorconfig file or through the VS UI make using throw expressions an error (csharp_style_throw_expression = false:error or the UI below).
  3. Add a throw expression in the code. I used the code snippet from https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference#null_checking_throw_expressions.
  4. Build inside VS

Expected Behavior: Building in VS produces errors.

Actual Behavior: No error is produced.

Have I understood this particular switch incorrectly?

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 15 (12 by maintainers)

Most upvoted comments

It just seemed like a bug that the Error option has no effect:

It’s certainly a bug. The question is: what is the right solution 😃

To me, it’s not making it so that you get an error if you pick “false:error”.

Instead, the right solution is separating out the helpful ‘nudge’ features that offer tiny suggestions and improvements into their own bucket, independent of ‘code style’. While under the covers we use the same infrastructure, these features would really only allow you to opt-into if you want the tip, and even then would only offer to show the light-bulb, or the light-bulb+dots+item-in-messages-list.