You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Contract validation method marked with ContractArgumentValidator should follow few rules:
Guard method should has a if-throw
if-throw should follow Contract.EndContractBlock
So following code will emit the warning:
usingSystem.Diagnostics.Contracts;publicstaticclassContractValidator{[ContractArgumentValidator]publicstaticvoidGuard(boolcondition){// warning CC1053: No validation code recognized in contract argument // validator 'ContractValidator.Guard(System.Boolean)'.// if (!condition)thrownewException();Contract.EndContractBlock();}}
The same warning would be emitted if uncomment if-condition and comment out Contract.EndContractBlock().
The text was updated successfully, but these errors were encountered:
Contract validation method marked with
ContractArgumentValidator
should follow few rules:Contract.EndContractBlock
So following code will emit the warning:
The same warning would be emitted if uncomment if-condition and comment out
Contract.EndContractBlock()
.The text was updated successfully, but these errors were encountered: