Adds a unit test whilst trying to narrow down a problem.

In fact there was no issue with the key value serializer.
Adds new feature to dispose-and-replace a service.

This allows a single service instance to be disposed of and replaced using the
registered service factory.