Working on a large project making use of code-contracts and resharper.
Through numerous refactors some method parameters are no longer required, but code contracts appear to be hiding this. e.g.
Original code may have been
public foo( IMyInterface param1, IMyOtherInterface param2 )
{
Contract.Requires<ArgumentNullException>( param1 != null );
Contract.Requires<ArgumentNullException>( param2 != null );
_param1 = param1
_param2 = param2
}
However due to refactoing param 2 is no longer used / assigned.
public foo( IMyInterface param1, IMyOtherInterface param2 )
{
Contract.Requires<ArgumentNullException>( param1 != null );
Contract.Requires<ArgumentNullException>( param2 != null );
_param1 = param1
}
Without the contracts, resharper would alert us that param2 is not being used, and could be removed. But with the contract in place the code mistakenly believes the parameter to be actively in use.
Is there any way to force resharper to ignore the contract while working out if the parameter is being used or not?