Gendarme unsafe code detection
Anyone familiar with Gendarme kn开发者_如何学JAVAow if it's possible to create a rule that detects C# unsafe code?
Yes, this would be possible and fairly easy to do so.
Unsafe code is not directly marked on the metadata. However you can look at the IL instructions and types (local, parameters and return values) to find construct that requires the 'unsafe' C# keyword (when compiling code).
A good reference book on ILasm would help a lot. So would testing your rule against huge projects (with source available) to ensure you're not missing any case.
精彩评论