2

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

poupou
  • 43,413
  • 6
  • 77
  • 174
user644107
  • 33
  • 3

1 Answers1

1

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.

poupou
  • 43,413
  • 6
  • 77
  • 174