This is not an issue in regards to CRM.
You are basically overwriting the Execute method of CodeActivity when you are creating a new workflow activity. You can't add contracts at this point.
See this question for a explanation: Why can't I add Contract.Requires in an overridden method? And for more details: http://stefanoricciardi.com/2009/07/17/code-contracts-and-inheritance/