Hidden Naming Conventions in the Visual Studio Debugger
The Visual Studio debugger uses specific naming conventions to represent compiler-generated elements, often referred to as "magic names". These names are not displayed to users under normal circumstances.
Example:
- Unused local variables starting with 'CS$' will be hidden.
- Anonymous method types have unique identifiers.
- Backup fields for automatic properties follow a special pattern.
Understand naming conventions
Unfortunately, these naming conventions are not publicly documented and may change in future compiler updates. However, we can share some insights into its structure.
Local variables:
- Unused local variables are marked with the '__Deleted$' suffix.
- The temporary variable is named 'CS$X$Y', where 'X' represents the temporary type and 'Y' is the allocated number.
Compiler generated elements:
- Iterator state, current value and saved parameters are assigned specific names.
- Closure class instances and anonymous method instances have unique identifiers.
- Anonymous type fields and types use predefined naming patterns.
- Backing fields for automatic properties follow the "BackingField" convention.
Generated name structure:
Magic names usually follow the "PC__SI" pattern:
- 'P' is 'CS$' for cached delegate and display class instances
- 'N' is the original name associated with the element
- 'C' is a character indicating the element type (e.g. 's' for iterator status)
- 'S' is a descriptive suffix (e.g., 'current')
- 'I' is an optional unique number
The above is the detailed content of What are the Hidden Naming Conventions Used by the Visual Studio Debugger?. For more information, please follow other related articles on the PHP Chinese website!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn