[NRTM] Implemented guard clauses using Code Contracts

just confirm CI.