- 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.
推薦閱讀
- 自己動(dòng)手寫搜索引擎
- Learning RxJava
- Microsoft Dynamics 365 Extensions Cookbook
- vSphere High Performance Cookbook
- C/C++算法從菜鳥到達(dá)人
- Python從入門到精通(精粹版)
- Instant Typeahead.js
- Python編程完全入門教程
- C/C++常用算法手冊(cè)(第3版)
- EPLAN實(shí)戰(zhàn)設(shè)計(jì)
- Visual Basic程序設(shè)計(jì)實(shí)踐教程
- Active Directory with PowerShell
- 第一行代碼 C語(yǔ)言(視頻講解版)
- 微信小程序開發(fā)與實(shí)戰(zhàn)(微課版)
- Mastering Python Design Patterns