Docs: Stop is missing from the keywords list

Created on 28 Aug 2020  Â·  5Comments  Â·  Source: dotnet/docs

I get this warning:

Rename virtual/interface member IFileWatcher.Stop() so that it no longer conflicts with the reserved language keyword 'Stop'. Using a reserved keyword as the name of a virtual/interface member makes it harder for consumers in other languages to override/implement the member.

But I can't find it on the list on this page, it should be updated (or the warning is wrong).


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

  • ID: fa5712fd-a965-e2a9-5b1c-0b295d5e8ccd
  • Version Independent ID: 4b943400-309d-0437-5513-0533456297f0
  • Content: C# Keywords
  • Content Source: docs/csharp/language-reference/keywords/index.md
  • Product: dotnet-csharp
  • Technology: csharp-language-reference
  • GitHub Login: @BillWagner
  • Microsoft Alias: wiwagn
Area - C# Guide

Most helpful comment

@Youssef1313 I'm pretty sure it is. As the message implies, this warning exists so that code written in one language can be easily consumed from other .Net languages. That's why it's warning about VB keywords in C# code.

All 5 comments

I don't think C# have a keyword named "Stop". It's a VB keyword.

The analyzer does seem to always lookup for all keywords regardless of the language.

https://github.com/dotnet/roslyn-analyzers/blob/0cbdd68e14722e911d50eee64ee95823b3ffa09c/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldNotMatchKeywords.cs#L239

@mavasani, Is this behavior intended?

cc: @Evangelink

@Youssef1313 I'm pretty sure it is. As the message implies, this warning exists so that code written in one language can be easily consumed from other .Net languages. That's why it's warning about VB keywords in C# code.

@svick Ahh, I didn't read the message till the end 😄

@SpaceOgre I think you can do one of the following:

  • Rename the method as suggested. This option might not always be actionable.
  • Suppress the rule.

Yes, this is by design.

Thank you for the clarification. It would be nice if this was added to the documentation then for the analyzer error code. Will create an issue for that over there.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gmatv picture gmatv  Â·  3Comments

svick picture svick  Â·  3Comments

mekomlusa picture mekomlusa  Â·  3Comments

ike86 picture ike86  Â·  3Comments

LJ9999 picture LJ9999  Â·  3Comments