|
ConfigureValueAnalysis
Value Analysis and Assertions are configured in Resharpers Options dialog in the Assertions and Value Analysis page.
Options are configure per type - that is, you can configure a set of options for System.Object and a different set for System.String. The * and System.Object rules are default rules that are used, if no other rules are found. In the Options start by adding a new rule. In the Rule options box, specify the type for which this rule should apply. Next specify which Value Analysis attribute should be applied by default. Then specify assertion statements for parameters, assignments and return values. The assertions are formatted using string.Format, so use {0} to substitute the name of the variable.
|
Sign in to add a comment
I spent some time in order to make this feature work properly. If you have problems like message "Type members should be annotated with Value Analysis attributes." when you already annotate all args then you will need to do this:
[AssertionMethod] public static void ArgumentNotNull<T>([AssertionCondition(AssertionConditionType.IS_NOT_NULL)]T obj, string argumentName) where T : class { //you assertion logic here }Hope this helps