Fix StyleCop, FxCop/CA, implement CodeContracts and update doc comments