Files
test/Documentation/WHY_STILL_BLUE.md
2026-03-13 16:03:47 +07:00

1.2 KiB

Nguyên nhân analyzer vẫn màu xanh

Tìm ra nguyên nhân: File .editorconfig đang override severity về warning!

Vấn đề

File .editorconfig (dòng 16) có:

dotnet_diagnostic.UNITY_EDITOR_ONLY_USAGE.severity = warning

EditorConfig có priority cao hơn analyzer code, nên dù analyzer code đã đổi thành Error, EditorConfig vẫn override về warning.

Đã sửa

Đổi dòng 16 trong .editorconfig từ:

dotnet_diagnostic.UNITY_EDITOR_ONLY_USAGE.severity = warning

Thành:

dotnet_diagnostic.UNITY_EDITOR_ONLY_USAGE.severity = error

Reload Visual Studio

  1. Đóng Visual Studio hoàn toàn
  2. Mở lại: double-click perfect-world-unity.sln
  3. Visual Studio sẽ đọc .editorconfig mới
  4. GetCurPanel1() sẽ hiển thị màu đỏ

Priority Order

EditorConfig (.editorconfig)
    ↓ (highest priority)
Project Settings (.csproj)
    ↓
Analyzer Code (DiagnosticDescriptor)
    ↓ (lowest priority)

EditorConfig luôn thắng!

Kết luận

Đã sửa cả 2 chỗ:

  • Analyzer code: DiagnosticSeverity.Error
  • EditorConfig: severity = error

Reload Visual Studio để thấy màu đỏ.