- Roslyn Cookbook
- Manish Vasani
- 192字
- 2021-07-15 17:07:34
Creating a compilation analyzer to analyze whole compilation and report issues
A stateful compilation analyzer registers action callbacks that require compilation-wide analysis of symbols and/or syntax to report issues about declarations or executable code in the compilation. These analyzers generally need to initialize some mutable state at the start of the analysis, which is updated while analyzing the compilation, and the final state is used to report diagnostics.
In this section, we will create an analyzer that performs compilation-wide analysis and reports. Diagnostic secure types must not implement interfaces with insecure methods for the following scenarios:
- Assume we have an interface, say MyNamespace.ISecureType, which is a well-known secure interface, i.e. it is a marker for all secure types in an assembly.
- Assume we have a method attribute, say MyNamespace.InsecureMethodAttribute, which marks the method on which the attribute is applied as insecure. An interface which has any member with such an attribute, must be considered insecure.
- We want to report diagnostics for types implementing the well-known secure interface that also implements any insecure interfaces.
Analyzer performs compilation-wide analysis to detect such violating types and reports diagnostics for them in the compilation end action.
推薦閱讀
- Data Analysis with IBM SPSS Statistics
- Learning AndEngine
- Python機器學習:手把手教你掌握150個精彩案例(微課視頻版)
- C語言實驗指導及習題解析
- 從Excel到Python:用Python輕松處理Excel數據(第2版)
- 用戶體驗增長:數字化·智能化·綠色化
- Learning FuelPHP for Effective PHP Development
- Python 3.7從入門到精通(視頻教學版)
- Spring Boot+MVC實戰指南
- Distributed Computing in Java 9
- 硬件產品設計與開發:從原型到交付
- ASP.NET求職寶典
- Qt 4開發實踐
- Unity Android Game Development by Example Beginner's Guide
- Kotlin進階實戰