Gendarme unsafe code detection

255 views Asked by At

Anyone familiar with Gendarme know if it's possible to create a rule that detects C# unsafe code?

1

There are 1 answers

0
poupou On

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.