FAQ: When looking at the names of locals in a custom rule, why do I see strange names such as 'CS$1$0000' and 'VB$1$0000'?

Previously we showed you how to access the locals or variables of a method. Once you started to run your rule over an assembly, you might start to notice strange locals with names that start with 'CS$' and 'VB$'. These are compiler generated locals that are outside the control of the user.

If you are writing a rule to check the names of locals, you will want to skip over these, To do this, simply pass the local to RuleUtilities.IsCompilerGenerated method and check the result.

Note: This will also skip over locals when source and line information (PDBs) is not alongside the assembly under analysis.