- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- Administrator's Guide
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
ID: csharp-best-practices/diagnostic-analyzer-language
Language: C#
Severity: Warning
Category: Error Prone
This rule is designed to ensure that the correct language is specified for the DiagnosticAnalyzer
attribute in C#. The DiagnosticAnalyzer
attribute is used to indicate that a class is a diagnostic analyzer, which is a component that analyzes code to find problems. The language parameter specifies the language that the analyzer supports.
It is crucial to accurately specify the language of the DiagnosticAnalyzer
because it determines the language syntax and semantics the analyzer will use. If you specify the wrong language, it can lead to incorrect or incomplete code analysis.
To fix this issue, always specify “C#” as the language for DiagnosticAnalyzer
in C# projects. For instance, use [DiagnosticAnalyzer("C#")]
to indicate that the analyzer supports C# language. Avoid specifying other languages such as [DiagnosticAnalyzer("C")]
or [DiagnosticAnalyzer("VB")]
in a C# project.
// language should be C#
[DiagnosticAnalyzer("C")]
class MyAnalyzer : DiagnosticAnalyzer
{
}
[DiagnosticAnalyzer("C#")]
class MyAnalyzer : DiagnosticAnalyzer
{
}
|
|
For more information, please read the Code Security documentation
Identify code vulnerabilities directly in yourVS Code editor
Identify code vulnerabilities directly inJetBrains products