Here's how we do it:
- Disable (or rather: do not enable) Code Analysis (CA) for debug collections.
- Create a new build configuration called Verify, where code analysis is enabled, and warnings are treated as errors.
- Save the issue as is.
We are doing the usual development in debug mode and just have an informal rule that you must pass to the Verify assembly before registering.
Itβs easy to forget, but we run Continuous Integration (CI) in the Verify assembly, so if you check the code with code analysis warnings, you break the assembly, so people quickly learned how to manually verify the assembly before checking :)
You can also use Debug without CA and Release with CA, but since the inclusion of CA defines the constant CODE_ANALYSIS, this means that CA Suppressions will be included in IL, and I prefer not to have this in my binary versions (YMMV).
source share