0

I have a stupid problem - sometimes I have an identifier is source code which starts with "с" (russian letter which looks like english "c", and is located on the same button on keyboard!). Since these two look like it is a same letter I cannot see this myself during coding. And sometimes this can cause bugs in the applications I am developing. So my question is - are there any tools that can detect such a case during build process and report an Error or Warning to Visual Studio?

DarkDeny
  • 1,750
  • 2
  • 21
  • 31
  • It would be easy to do so with Roslyn, if you're happy to use the VS2015 Preview. If you can't use the preview, would you be happy to defer this until VS2015 is out and you can upgrade to it? – Jon Skeet Jan 15 '15 at 16:06
  • I think writing some code, `foreach` (iterating through) each .cs, `foreach` each character, and then determine the char is ASCII or not would be a pleasure. Then add the exe to the PreBuild event. Oh, I forget that only the symbols need to be checked, happy debugging time. – kennyzx Jan 15 '15 at 16:09
  • Side note: it may be better to solve cases where your code does not fail regular C# compilation in case of such mistypings... Consider showing sample (or maybe separate question) so better approach could be suggested. – Alexei Levenkov Jan 15 '15 at 16:10
  • 1
    @kennyzx just regular `findstr` may be enough. Also I think you mean `File.RealAllText(...).Any(c => c > `\u00ff`)`, not `foreach`... – Alexei Levenkov Jan 15 '15 at 16:15
  • you are right, LINQ wins. – kennyzx Jan 15 '15 at 16:22

0 Answers0