Prevent invoked expectations from being modified after they are invoked.
Changelog entry for #837