I was looking at some code I wrote for class and just realized that I named a bool variable “error”
It doesn’t make the code to malfunction and Visual Studio just underlined it with two dots but didn’t give any errors or warnings back.

I know it’s not convenient to use words like that to name a var but doesn’t seem to do any harm in this case… Anyone knows if this could be a problem in more complicated projects or something?

Why do you think it’s an issue? As long as it’s used to convey whether there’s an error or not, it’s fine. Personally, I’ve used a bool named error quite a few times. Usually, I’d add another variable called errorMessage.
Maybe VS is just suggesting that the variable-declaration itself can be “simplified” by using ‘var’ instead of ‘bool’, as the right hand side of the assignment clearly is of type bool.

Try moving the cursor on the squiggled line and hit ‘ctrl+.’, that should bring up the quick-fix menu.

Have a look at your error-list and select ‘info’ – items, also. If I’m guessing right, this tip should also appear there.

Ideally I would name a bool using the ‘is’ or ‘has’ prefix, eg. isError or hasError. You could also include the type of error to help with clarity. So, ‘isNullError’ or something.

What color is the underline? Red means error, everything else tends to mean “I think there might be a better way to write this line” and is usually ignorable.

It’s grey, when I hover it says unnecessary assignation (idk if I translated it correctly cause my vs is in spanish, the code is IDE0059) Then it recommends to just write bool error;

Visual Studio just underlined it with two dots
Can you hover over the dots, and wait a few seconds? Is there no lightbulb or anything? Two dots means it has a suggestion.

Yes, it says that the assignation is unnecessary. the issue was that I assing false again in the next code block, but when I posted this I thought it was because of the name I gave it…

You’ve already had some good answers explaining what’s going on.
But let’s look at your original theory, that the word “error” has some special meaning.

You can find a list of all of the keywords that have a special meaning in C# on this page. And you’ll notice that “error” doesn’t appear there at all.
Gray dots are message level alerts so they won’t show up if you’re only displaying warnings and errors.

Depending on how the variable is being used VS will often message that the initial assignment isn’t required.
Whatever the actual message is, you should be able to see it in the error list if you click on the Messages box or by mousing over the underline.

source