I am starting on a new project, and the plan is to reuse several well-tested components from other projects, but rebuild them so the entire solution targets the same version of the .NET runtime.
After switching the legacy project from .NET framework version 3.5 to 4.5, several previously passing tests have started to fail, specifically by throwing an InvalidOperationException with the message "This action is invalid when the mock object is in a verified state". The exception is being triggered when a class unsubscribes from an event (in the case of the tests, one that is raised by a mock object) as part of the referencing object's "Dispose" processing.
The problem is seen using both RhinoMocks v3.6 (which was what the "legacy" component used previously) and v3.6.1.
1) Is unsubscribing from an event handler during the "Dispose" processing an appropriate thing to do?
2) Under normal (non-mock) circumstances, is there any situation in which removing a subscription to an event would cause an exception?
3) What changed in the event processing which may have led to this failure?
Regards,
Richard